<?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 Naveed Ul Mustafa on Medium]]></title>
        <description><![CDATA[Stories by Naveed Ul Mustafa on Medium]]></description>
        <link>https://medium.com/@numustafa?source=rss-86c9b5840c74------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*vnJbyVj5avZDZlH46Vp12w.png</url>
            <title>Stories by Naveed Ul Mustafa on Medium</title>
            <link>https://medium.com/@numustafa?source=rss-86c9b5840c74------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 18:54:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@numustafa/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[Claude Code, Real Workflows: Plan Mode & Specs]]></title>
            <link>https://numustafa.medium.com/claude-code-real-workflows-plan-mode-specs-f196fb0c3590?source=rss-86c9b5840c74------2</link>
            <guid isPermaLink="false">https://medium.com/p/f196fb0c3590</guid>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[learning]]></category>
            <dc:creator><![CDATA[Naveed Ul Mustafa]]></dc:creator>
            <pubDate>Tue, 24 Feb 2026 07:00:52 GMT</pubDate>
            <atom:updated>2026-02-24T07:00:52.143Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>I am currently learning about Claude Code, and documenting my learning experience here, so future me doesn’t have to get overwhelmed with a lot of redundant info. This article is all about core building blocks with claude code.</blockquote><p>When I work with Claude Code on a real project, I’ve found that a <strong><em>spec-driven workflow</em></strong> produces more reliable results than jumping straight into implementation. The idea is simple:</p><ol><li>write a high-level (non-technical) feature spec</li><li>turn that spec into a detailed technical plan</li><li>implement against the plan</li><li>(optional) <strong>review </strong>and iterate</li></ol><p>This approach keeps the model focused, reduces guesswork, and helps prevent incorrect assumptions — especially on multi-step features where missing context can derail an otherwise good implementation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*stINa7e-Qd81aTg7WBbS7w.png" /><figcaption><strong>workflow overview:</strong> High-level Spec → Technical Plan → Implement Feature → Code Review</figcaption></figure><h3>Why I prefer “spec first”</h3><p>The inspiration for this came from GitHub’s <em>Speckit</em>, which puts a high-level spec at the center of AI-assisted development. I like that philosophy, but I’m also a hands-on developer — I want AI support <strong>without</strong> feeling detached from the decision-making loop.</p><p>So my goal became: a lighter-weight, developer-led version of spec-first development — one that preserves my agency, keeps the process transparent, and still benefits from Claude Code’s planning and implementation capabilities.</p><h4>Git in the loop: branch early, branch often</h4><p>I integrate Git directly into this workflow. Whenever I start a new feature/spec cycle, I switch to a new branch first. It’s a small habit, but it makes experimentation safer and code review cleaner.</p><h3>Making a /spec Command</h3><p>I started by creating a custom /spec command (and later I plan to migrate/refine this into a proper Skill). The goal of /spec is to do a few things consistently:</p><ul><li>generate a feature name (and a matching branch name) from my input</li><li>switch to that new branch</li><li>generate a high-level spec in a predictable format</li><li>write that spec into a dedicated folder (for example, _spec/)</li></ul><p>The key constraint: this spec should be non-technical. It shouldn’t describe implementation details, libraries, or file structures. Instead, it should focus on:</p><ul><li>what the feature does from a user’s perspective</li><li>expected behavior and acceptance criteria</li><li>key edge cases and failure modes</li><li>broader implications (performance, permissions, data correctness, UX)</li></ul><p>In one project, for example, my “spec” described a live dashboard to monitor movement in trading positions. Even though the domain is technical, the spec stayed focused on <em>behavior and outcomes</em>, not code.</p><pre>---<br>description: Create a feature spec file and branch from a short idea (S****l workflow)<br>argument-hint: Short feature description (what + why + who)<br>allowed-tools:<br>  - Read<br>  - Write<br>  - Glob<br>  - Bash(git status:*)<br>  - Bash(git rev-parse:*)<br>  - Bash(git branch:*)<br>  - Bash(git switch:*)<br>---<br><br>You are helping to spin up a new feature spec for this application from a short idea provided in the user input below. when responding.<br><br>**Hard rules**<br>- Always adhere to any rules or requirements set out in any CLAUDE.md files (if).<br>- Produce a spec that is implementable, but DO NOT include code snippets or low-level implementation details.<br>- You MUST harvest repo context from:<br>  1) TECHNICAL_BLUEPRINT.md (root)<br>  2) temp/ (previous example project files)<br>- If either is missing, note it explicitly in the spec “References Used” section and proceed with best effort.<br><br><br>User input: $ARGUMENTS<br><br>## High level behavior<br><br>Your job will be to turn the user input above into:<br><br>- A human friendly feature title in kebab-case (e.g. new-heist-form)<br>- A safe git branch name not already taken (e.g. claude/feature/new-heist-form)<br>- A detailed markdown spec file under the _specs/ directory<br><br>Then save the spec file to disk and print a short summary of what you did.<br><br>## Step 0 — Repository rules + context harvest (MANDATORY)<br><br>1) Find and read any CLAUDE.md files (if any):<br>- Use `Glob(&quot;**/CLAUDE.md&quot;)`, then `Read` each result.<br>- Summarize the key constraints you must follow (privately) before drafting.<br><br>2) Locate the technical blueprint:<br>- Use `Glob(&quot;TECHNICAL_BLUEPRINT*.md&quot;)` and/or `Glob(&quot;*BLUEPRINT*.md&quot;)`.<br>- If found, `Read` it and extract:<br>  - required layering/architecture constraints<br>  - naming conventions and folder structure expectations<br>  - any pipeline/merge conventions relevant to s****l functions<br><br>3) Locate 1–3 relevant example files in `temp/`:<br>- Use `Glob(&quot;temp/**/*s****l*&quot;)`, `Glob(&quot;temp/**/*option*&quot;)`, `Glob(&quot;temp/**/*position*&quot;)`, `Glob(&quot;temp/**/*.py&quot;)` (adjust if repo language differs).<br>- Pick up to 3 files that look most relevant (registration patterns, pipeline structure, df merge patterns) and `Read` them.<br>- Extract:<br>  - how s****l functions are registered/exposed<br>  - how dataframes are shaped/merged<br>  - how errors/warnings are handled<br>If `temp/` is huge, prefer the smallest number of reads that still provides these patterns.<br><br>You will later cite these under “References Used” in the spec (just file paths + what pattern was taken).<br><br>---<br><br>## Step 1. Check the current branch<br><br>Check the current Git branch, and abort this entire process if there are any uncommitted, unstaged, or untracked files in the working directory. Tell the user to commit or stash changes before proceeding, and DO NOT GO ANY FURTHER.<br><br>## Step 2. Parse the arguments<br><br>From `$ARGUMENTS`, extract:<br><br>1. `feature_title`  <br>   - A short, human readable title in Title Case.  <br>   - Example: &quot;Card Component for Dashboard Stats&quot;.<br><br>2. `feature_slug`  <br>   - A git safe slug.  <br>   - Rules:  <br>     - Lowercase <br>     - Kebab-case <br>     - Only `a-z`, `0-9` and `-`  <br>     - Replace spaces and punctuation with `-`  <br>     - Collapse multiple `-` into one  <br>     - Trim `-` from start and end  <br>     - Maximum length 40 characters  <br>   - Example: `card-component` or `card-component-dashboard`.<br><br>3. `branch_name`  <br>   - Format: `claude/feature/&lt;feature_slug&gt;`  <br>   - Example: `claude/feature/card-component`.<br><br>If you cannot infer a sensible `feature_title` and `feature_slug`, ask the user to clarify instead of guessing.<br><br>## Step 3. Switch to a new Git branch<br><br>Before making any content, switch to a new Git branch using the `branch_name` derived from the `$ARGUMENTS`. If the branch name is already taken, then append a version number to it: e.g. `claude/feature/card-component-01`<br><br>## Step 4. Draft the spec content<br><br>Create a markdown spec document that Plan mode can use directly and save it in the _specs folder using the `feature_slug`. Use the exact structure as defined in the spec template file here: @_specs/template.md. Fill in *all required sections*, especially:<br>- S****l function contracts (signature, params, return schema)<br>- Data contracts (required columns, join keys, units)<br>- Business rules (filtering, classification, settlement, greeks versioning)<br>- Architecture boundaries (pure transforms vs orchestration)<br>- Acceptance criteria + test plan with a golden fixture<br>- References Used (TECHNICAL_BLUEPRINT + temp/ example files)<br><br>**Do not include code examples.**<br>If information is missing, write it as an explicit Open Question rather than inventing details.<br><br>## Step 5. Final output to the user<br><br>After the file is saved, respond to the user with a short summary in this exact format:<br><br>Branch: &lt;branch_name&gt;<br>Spec file: _specs/&lt;feature_slug&gt;.md<br>Title: &lt;feature_title&gt;<br><br>Do not repeat the full spec in the chat output unless the user explicitly asks to see it. The main goal is to save the spec file and report where it lives and what branch name to use.</pre><p>I specifically use a user Argument here, which means when i run this spec command later, I will be adding a sentence or two about the new feature we want to spec, so the model can use the input. My scenario, where I used this spec file, is where I had an empty codebase, and I didnt have the CLAUDE.md file, so I made this spec which can work in both scenarion.</p><h4>Templete</h4><p>In the newly created _spec dir, a new tenplete file need to be made. To keep specs consistent across features, I use a template that Claude fills in. A good template usually includes:</p><ul><li>Problem statement (what we’re solving and why)</li><li>User stories / primary flows</li><li>Non-goals (what this feature explicitly does <em>not</em> do)</li><li>Acceptance criteria</li><li>Edge cases</li><li>Open questions (things I need to decide before implementation)</li></ul><p>This template structure helps me stay precise and prevents vague instructions that lead to hallucinated output later</p><pre># Feature Spec: &lt;Feature Title&gt;<br><br>branch: claude/feature/&lt;feature-slug&gt;<br>spec: _specs/&lt;feature-slug&gt;.md<br>owner: numustafa<br>date: &lt;YYYY-MM-DD&gt;<br><br>---<br><br>## 0) Summary<br><br>**One-liner:** &lt;What are we building?&gt;<br>**Why now:** &lt;Why does this matter?&gt;<br>**Who is this for:** &lt;internal users / teams&gt;<br>**Success looks like:** &lt;measurable outcomes&gt;<br><br>---<br><br>## 1) Goals and Non-Goals<br><br>### Goals<br>- ...<br><br>### Non-Goals<br>- ...<br><br>---<br><br>## 2) User Workflow<br><br>### Primary workflow<br>1. ...<br>2. ...<br><br>### Secondary workflows (optional)<br>- ...<br><br>---<br><br>## 3) S****l API Surface (What you expose)<br>### 3.1 Functions<br>For each function:<br>- Name:<br>- Signature:<br>- Parameters (types, defaults, validation):<br>- Returns (type + schema):<br>- Example calls:<br>- Errors/warnings behavior:<br><br>## 4) Data Contracts (DF schemas + join keys)<br>### 4.1 Inputs<br>List each input df you will use and where it comes from:<br>- positions_df:<br>- settlement_df:<br>- ...<br><br>### 4.2 Required columns (minimum contract)<br>For each df:<br>- Required columns (name → type → meaning)<br>- Optional columns (if used)<br>- Expected uniqueness / dedup strategy<br>- Join keys used (exactly)<br><br>### 4.3 Output schema<br>- Output columns added (and meaning)<br>- Any renamed/standardized columns<br><br>## 5) Business Rules<br>### 5.1 Portfolio filtering<br>- Default behavior (e.g., all portfolios)<br>- If portfolios provided:<br>- Other filters:<br><br>### 5.2 ITM/OTM classification<br>- Underlying price definition used:<br>- Call/Put rule table (include ATM handling):<br>- Missing underlying/strike behavior:<br><br>### 5.3 Pricing / Greeks<br>- V1 behavior (computed vs placeholder null columns)<br>- V2 behavior (future)<br><br>## 6) Architecture (must match TECHNICAL_BLUEPRINT)<br>### 6.1 clients/ (I/O boundary)<br>- What data is fetched here:<br><br>### 6.2 constants/ (values only)<br>- Column lists (e.g., transactions fields list)<br>- Mappings, thresholds, config<br><br>### 6.3 utils/ (pure transforms, vectorized)<br>List transforms as df-in → df-out steps:<br>- normalize_positions(...)<br>- normalize_settlement(...)<br>- merge_positions_settlement(...)<br>- classify_itm_otm(...)<br>- compute_greeks(...) (or placeholder)<br><br>### 6.4 orchestration layer (e.g., recon/ or S****l entrypoints)<br>- Wiring flow (fetch → transforms → output)<br>- Caching/perf expectations<br>- Empty df handling strategy<br><br>## 7) Edge Cases<br>- Missing settlement rows<br>- Duplicated keys<br>- Empty portfolio results<br>- Bad types / coercion rules<br>- Time/as-of mismatch<br><br>## 8) Acceptance Criteria<br>Checklist that can be tested:<br>- [ ] Function output schema matches spec<br>- [ ] Filtering works (single/multi/all portfolios)<br>- [ ] Classification correct on golden fixture<br>- [ ] Missing data behavior correct (warn/empty/nulls)<br><br>## 9) Test Plan<br>### 9.1 Golden fixture (required)<br>Define a tiny fixture dataset + expected output columns/rows.<br><br>### 9.2 Unit tests (utils/)<br>List each transform + cases.<br><br>### 9.3 Integration tests (orchestration)<br>Happy path + missing settlement + filter variations.<br><br>## 10) References Used (required)<br>- TECHNICAL_BLUEPRINT.md: &lt;what you followed&gt;<br>- temp/&lt;file&gt;: &lt;what you reused&gt;<br><br>## 11) Open Questions<br>- Q:<br>- Decision owner / date:</pre><p>This gives me the agency to plan in accordance with a given pattern, and allowed to be more precise, instead of loosing context on vague instructions and later getting hallucinated outputs.</p><h3>Plan mode</h3><p>Now I have an actionable /spec custom command, and a template, I switch to Claude Code’s <strong>Plan Mode</strong> to produce an actionable implementation plan. Plan Mode is valuable because it encourages a “research-first” approach: Claude can inspect the codebase context, then propose a plan that includes:</p><ul><li>step-by-step implementation phases</li><li>file structure and where changes should go</li><li>interfaces/contracts (inputs/outputs, types)</li><li>test strategy</li><li>potential pitfalls and trade-offs</li></ul><p>Claude Code plan mode is a read-only mode for creating implementation plan for new features, like the feature, i spec-ed earlier. When we use plan mode, Claude Code spins up something known as “sub-agent”, whose speciality is conducting research and gathering information about codebase in any additional context. And that sub-agent is responsible for providing that information back to claude (then main agent), who then generates a plan markdown file, which is a robust set of instruictions for implementing the plan, incl code examples, file structure, starting guidelines, and so on..</p><p>Once we have that file, we can then ask Claude code to implement the new feature it describes. And this added step of creating a plan is good, especially for multi-step, complex features, b/c it allows for through research about how to best implement features on the current codebase, and as a result, I get a comprehensive guide about how to best add that feature to the project based on codebase analysis, and not just guesswork.</p><p>This is especially useful for complex features, because the plan becomes a shared reference point that both you and the model can follow during implementation.</p><h4>How to invoke Plan mode?</h4><p>Often Claude Code enters Plan Mode automatically if your prompt clearly asks for planning (for example: “Plan the implementation”). You can also toggle it manually (for example via <strong>Shift+Tab</strong>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SW8vOzeFyTQJmJVd0djXwQ.png" /><figcaption><strong>Plan Mode toggle:</strong> The UI indicating “plan mode on” and the active file context.</figcaption></figure><h4>My prompt pattern</h4><p>Once the spec exists, I keep the prompt simple:</p><blockquote>“Plan the feature described in this spec.”</blockquote><p>Because the spec already contains the functional detail, the planning prompt doesn’t need to be long.</p><h4>Where I store the plan</h4><p>In my experience, Claude Code may write the plan to a default location (for example under a Claude directory such as ~/.claude/plans/). That’s convenient initially, but I prefer keeping plans <em>inside the repo</em> for future reference.</p><p>So I usually copy the plan into a project folder like _plans/.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fynSaZcW4aHIKn_jTyvcOQ.png" /><figcaption>plan saved prompt: The plan completion prompt and default plan path, before saving it into the repo.</figcaption></figure><blockquote><strong>Personal habit:</strong> I read the plan carefully before implementing. It’s a great moment to catch missing requirements, reorder steps, or add constraints before any code changes happen.</blockquote><h3>Implementation (models + thinking mode)</h3><p>Once the plan is solid, I ask Claude Code to implement it. Two practical decisions matter here: <strong>model choice</strong> and <strong>thinking mode</strong>.</p><h4>Models</h4><p>My usual workflow:</p><ul><li>use <strong>Sonnet</strong> for spec + planning (fast, strong general reasoning)</li><li>switch to <strong>Opus</strong> for implementation (more reliable for following detailed instructions)</li></ul><p>In practice, Opus tends to adhere more closely to the plan and is less likely to drift into “creative” deviations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d2iyw3F-SHMbFmtHawwDHw.png" /><figcaption><strong>model selection:</strong> Switching models via the /model menu.</figcaption></figure><h4>Thinking mode</h4><p>Thinking mode gives the model more room to reason through multi-step work. It may cost more tokens, but it often pays off when:</p><ul><li>the feature has tricky edge cases</li><li>the plan has gaps that need careful interpretation</li><li>you want the model to check itself before committing to a direction</li></ul><p>You can confirm it’s enabled (and toggle it) using /config.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lHU3xNXpd2me73UiddgG3A.png" /><figcaption><strong>config screen:</strong> The Claude Code preferences menu showing “Thinking mode”.</figcaption></figure><h3>CLAUDE.md</h3><p>Finally, I treat CLAUDE.md as living project documentation.</p><ul><li>If I’m starting from scratch, I validate and test the implementation, then generate an initial CLAUDE.md (for example via /init).</li><li>If the project already has a CLAUDE.md, I update it as the codebase evolves so future planning/implementation stays grounded in current reality.</li></ul><p>This workflow completes a full cycle:</p><p><strong>High-level spec → technical plan → implementation → (optional) review</strong></p><p>It keeps me in control while still leveraging Claude Code where it’s strongest: turning clear requirements into structured plans, then executing those plans faithfully.</p><blockquote>If you’re experimenting with similar spec-first workflows — or if you’ve found better patterns for keeping AI-assisted development predictable — I’d love to compare notes. I can be reached via <a href="https://x.com/numustafa_1">X</a> &amp; <a href="https://www.linkedin.com/in/numustafa/">Linkedin</a>.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f196fb0c3590" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Claude Code, Real Workflows: Commands, Context & Tools.]]></title>
            <link>https://numustafa.medium.com/claude-code-real-workflows-commands-context-tools-964ff89d981a?source=rss-86c9b5840c74------2</link>
            <guid isPermaLink="false">https://medium.com/p/964ff89d981a</guid>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[claude-code]]></category>
            <dc:creator><![CDATA[Naveed Ul Mustafa]]></dc:creator>
            <pubDate>Sun, 22 Feb 2026 13:48:49 GMT</pubDate>
            <atom:updated>2026-03-03T09:24:40.375Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>I am currently learning about Claude Code, and documenting my learning experience here, so future me doesn&#39;t have to get overwhelmed with a lot of redundant info. This article is all about core building blocks with claude code. I can be reached via <a href="https://x.com/numustafa_1">X</a> &amp; <a href="https://www.linkedin.com/in/numustafa/">Linkedin</a>.</blockquote><p>In my earlier articles, I learned how to setup a claude code in a project, <a href="https://medium.com/@numustafa/claude-code-real-workflows-install-authenticate-accelerate-988a94ee7655">briefly chatted about the project and went through models and usage</a>. This article is where I stop “vibing” with Claude Code and start learning the control surface — the parts that make it stable, repeatable, and usable on real projects. The idea is to go deeper into the foundational building blocks that make Claude Code feel less like a chatbot and more like a dev tool:</p><ul><li><strong>Commands</strong> (how I steer the session quickly and consistently)</li><li><strong>Context</strong> (what Claude currently knows and how I manage it)</li><li><strong>Tools</strong> (how Claude acts: read/edit/run/search)</li><li><strong>Hooks</strong> (how to automate guardrails and workflows)</li></ul><p>The goal is simple: build habits that scale. When I return to a project weeks later, I want a workflow that’s predictable and fast — not “relearn everything from scratch.”</p><h3>Slash Commands (/)</h3><p>Slash commands are the fastest way to invoke built-in behaviors without writing a long prompt. They’re basically <strong>verbs</strong> for the Claude Code REPL:</p><ul><li>Type / at the start of a line to see commands (and filter by typing a few letters).</li><li>They cover session management, config, context, model selection, troubleshooting, exports, MCP, tasks, etc.</li></ul><p>During my first few sessions I already used the “obvious” ones: /init, /model, /exit. But once I explored the full list, I realized commands are fundamental to making Claude Code feel stable and repeatable—especially across longer sessions and real repos.</p><h4>My “starter set” of commands (the ones I now reach for daily)</h4><ul><li><strong>/help</strong> — quick usage help (good when you forget what’s available).<br><strong><em>Pro tip</em></strong>: when in doubt, just type / and filter. It’s faster than guessing.</li><li><strong>/init</strong> — generates CLAUDE.md for the repo (a persistent project briefing).</li><li><strong>/memory</strong> — edit memory files (including CLAUDE.md) as your understanding evolves.</li></ul><p>This is where “Claude knows my repo” stops being hope and starts being a system.</p><ul><li><strong>/config</strong> — opens the Settings interface (tabbed config UI).</li><li><strong>/status</strong> — shows version, current model, account/connectivity (Status tab).</li></ul><p>I’ve found /status is the fastest sanity check when something feels “off” (wrong model, disconnected auth, etc.).</p><ul><li><strong>/doctor</strong> — health check for your Claude Code installation.</li><li><strong>/debug</strong> — reads the session debug log and helps troubleshoot what’s happening in the current session.</li></ul><p>This category is underrated. The difference between “Claude feels flaky” and “Claude is predictable” is often just knowing where to look.</p><p>Claude Code gives you multiple ways to understand what you’re spending:</p><ul><li><strong>/context</strong> — visualizes current context usage (useful when sessions get bloated).</li><li><strong>/cost</strong> — token usage statistics.</li></ul><p><strong>/stats</strong> — daily usage + session history + model preferences (a broader view).</p><blockquote>Note: some builds also surface a /usage command (I’ve seen it referenced in the wild), but the official interactive-mode docs emphasize /cost, /context, and /stats as the main visibility tools.</blockquote><p>These are my “session hygiene” tools:</p><ul><li><strong>/compact [instructions]</strong> — compress a long conversation and keep it focused. The optional instructions parameter allows the explicit instructions that should be retained by Claude Code compact summary.</li><li><strong>/clear</strong> — clear conversation history for a fresh start. Removes everything from Context Window.</li><li><strong>/rewind</strong> — rewind the conversation and/or code, or summarize from a selected message.</li><li><strong>/export [filename]</strong> — export the conversation (great for saving investigation notes).</li><li><strong>/copy</strong> — copy last assistant response (small, but surprisingly handy).</li><li><strong>/exit</strong> — exit the REPL.</li></ul><h3>A Context driven workflow I now follow</h3><p>When I open a new repo or restart after a few days, my “default sequence” is:</p><ol><li>/status → confirm model + connectivity</li><li>/init (first time only) → generate CLAUDE.md</li><li>/context → check how much baggage the session is carrying</li><li>Work normally</li><li>/compact if the thread starts getting long or messy</li><li>/export when I finish a big investigation (so I can reuse notes later)</li></ol><p>That’s it. Small habit, big payoff. Following are the ways, I elaborated on the context building for claude code.</p><h4>/init and CLAUD.md (project-level memory)</h4><p>The /init command is my “project onboarding” step. It prompts Claude Code to scan the repo and generate a <strong>project memory file</strong>—typically <strong>./CLAUDE.md</strong></p><p>Claude Code has two kinds of memory that persist across sessions:</p><ul><li><strong>Auto memory</strong> (Claude saves useful patterns/preferences automatically)</li><li><strong>CLAUDE.md files</strong> (instructions and preferences you maintain as markdown)</li></ul><p>Both are loaded at the start of sessions (with a note that auto memory loads only a limited portion of its main file). This is about giving claude code context or memeory, about the project so it can make better decisions about the code changes it makes in the future..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QovJ7LxjYtcvFjCan6FS2Q.png" /><figcaption>for ref</figcaption></figure><blockquote>Quick markdown refresher (for future me) - A lightweight way to write structured text using characters like: hashes (# or <em>##</em>) to add headings, dashes ( -) for lists, backticks for code blocks and asterisks (*) for emphasis.</blockquote><p>At the end of CLAUDE.md, I like to add a small section that’s <em>not</em> about the repo, but about how <strong>I</strong> want Claude to behave while working with me. Additional Coding preferences section. Example entries like:</p><ul><li>Prefer git switch -c for new branches (avoid git checkout)</li><li>Keep diffs small and incremental</li><li>If a change is risky, ask before rewriting large sections</li></ul><p>This is where CLAUDE.md starts acting like a “project policy + personal style guide” that Claude can apply repeatedly.</p><blockquote><strong><em>Tip:</em></strong><em> the docs also support </em><strong><em>modular rules</em></strong><em> under </em><em>.claude/rules/*.md when you want topic-specific or path-specific guidance without bloating </em><em>CLAUDE.md.</em></blockquote><h4>Adding context to an individual task (file &amp; folder references)</h4><p>Even with a good CLAUDE.md, I’ve learned that <em>task-level context</em> is where output quality jumps.</p><p>In Claude Code, typing <strong>@</strong> triggers file path autocomplete, so you can explicitly attach the exact file(s) you want Claude to consider.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*vx24LIScjyEbRnFIhbVheQ.png" /><figcaption>for ref</figcaption></figure><p>What I do in practice:</p><ul><li>Reference the 1–3 most relevant files with @...</li><li>Then tell Claude what to focus on inside those files (e.g., “only the layout logic”)</li></ul><p>This prevents the “Claude scanned too widely and guessed wrong” problem.</p><h4>Adding images as a context</h4><p>Claude models are multimodal, so Claude Code can incorporate images into prompts — useful for:</p><ul><li>UI screenshots</li><li>design references for a new component</li><li>error screenshots (especially when logs are incomplete)</li></ul><p>Two practical workflows I use:</p><ol><li>Save the image in the repo (or a scratch folder) and paste/reference it in the prompt.</li><li>Copy the image to clipboard and paste it directly into the prompt (terminal support varies, but the shortcut is documented).</li></ol><p>If I add an image by mistake, I can remove it from the prompt before sending (in my setup, I just navigate back to the attachment and delete it).</p><h3>Understanding Context Window</h3><p>Here’s the mental model that helped me:</p><p>A session’s <strong>context window</strong> is Claude’s short-term working memory for the conversation. It includes:</p><ul><li>the chat history</li><li>referenced files/folders</li><li>memory files like CLAUDE.md</li><li>tools/tool definitions (including MCP tool metadata)</li><li>system instructions</li></ul><p>As I chat more and attach more files, the session’s working set grows. When context grows too large, results can get worse: vaguer answers, missed constraints, and occasional hallucinations.</p><p>In Claude Code you can visualize context usage with <strong>/context</strong> (it shows a colored grid + a breakdown of what’s taking space).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bPvoxGa-ZpPZ3cl5YcZVvw.png" /><figcaption>For Ref</figcaption></figure><h4>/context Command</h4><p>To get a more accurate picture, lets explore /context command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WxQHFL4I_5iJcNBP8BrOlA.png" /><figcaption>For ref</figcaption></figure><p>The /context command shows a more comprehensive pictorial reference to the context window. The current sessions shows a usage of around 10% out of 200K Tokens limit. Some are taken by System prompt, System tools, MCP tools, and memory files. Memore is the CLAUDE.md file in the ref imge, and free space is shown as 134K tokens.</p><h4>How do I keep my context windows clean and concise?</h4><p>Claude Code supports <strong>/compact [instructions]</strong> to summarize the session and reduce context size. <br>The docs also describe <strong>auto-compaction</strong> as a built-in cost optimization that summarizes conversation history as you approach context limits.</p><p>In practice (based on what I’ve observed), I try not to wait for auto-compaction. I compact intentionally at milestones so I can control what gets preserved.</p><p><strong>Example compaction prompt I use:</strong></p><p>/compact Preserve decisions, final approach, filenames changed, and any TODOs. Drop exploration chatter.</p><p>This is the part I wish I’d learned earlier.</p><p><strong>One session = one “big goal”</strong></p><p>I try to keep a session focused on one major task area:</p><ul><li>“implement feature X”</li><li>“fix pipeline failures”</li><li>“audit reporting logic”</li></ul><p>If I start mixing unrelated concerns (deployment + data modeling + UI tweaks), the context becomes noisy — and Claude becomes less precise.</p><p><strong>Use </strong><strong>/rewind when I notice drift</strong></p><p>If I realize we went off-track, I rewind rather than “argue the session back to truth.” Claude Code supports <strong>/rewind</strong>, and it also has a keyboard shortcut <strong>Esc + Esc</strong> for rewinding/summarizing.</p><p><strong>Export investigations so I don’t rework them</strong></p><p>When I finish a deep investigation, I export it to a file using <strong>/export</strong> so I can paste it into tickets/PRs or use it later.</p><blockquote>In theory, a single session can go on about anytime length, however, my personal experience is; model becomes dumb once it goes on for really long, and give vague responses. Claude Code gives appropriate responses up to two compact cycles. More than that, and you get hallucinations and vague responses.</blockquote><h3>Tools and Permissions</h3><h4>Why CLI feels more “real” than chat?</h4><p>A model on its own can reason and generate text. Claude Code becomes useful because it can <strong>act</strong> via tools:</p><ul><li>read files, search, edit, run shell commands, etc.</li></ul><p>Claude Code’s permission model is intentionally tiered:</p><ul><li>read-only operations like file reads/grep don’t require approval</li><li>bash execution and file modifications typically require approval</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cFHmopypr__rk73IGhQx_w.png" /><figcaption>Ref Fig</figcaption></figure><p><a href="https://code.claude.com/docs/en/settings#tools-available-to-claude">Here</a> is the document, which highlights all the built-in Tools used by Claude code.</p><h4>Understanding permissions</h4><p>You can view and manage tool permissions using <strong>/permissions</strong>. It supports:</p><ul><li><strong>Allow</strong> rules (no manual approval)</li><li><strong>Ask</strong> rules (prompt every time)</li><li><strong>Deny</strong> rules (blocked)</li></ul><p>Claude Code also supports permission <strong>modes</strong> (default, acceptEdits, plan, dontAsk, bypassPermissions, etc.). I personally stick with default while learning my way through Claude Code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/951/1*8CDXLF-RrDBKg9_pcHVoxg.png" /><figcaption>For ref</figcaption></figure><h3>Custom Commands</h3><p>Earlier I have extensively looked into the built-in commands by Claude code. However, Claude code allows a functionality to build a custom command, and use that custom command like any other normal built-in command using /.</p><p>Custom commands can be used to run and orchestrate any kind of common prompt or workflow, thats being used by the application. To create a custom command, check if the root dir has .claude foledr, if not then make one. Then inside that folder, create a new commands dir, and any custom command that being made for the project lives insie the codebase.</p><p>Custom commands are made using a markdown file (just like CLAUDE.md). I am making a very basic custom command commit-message.md, and that how I will invoke it via Claude Code, /commit-message. It uses Key-value pair.</p><pre>---<br>description: Create a commit message by analyzing git diffs<br>allowed-tools: Bash(git status:*), Bash(git diff --staged), Bash(git commit:*)<br>---<br><br>## Your Task<br>Analyze above staged git changes and create a commit message. Use present tense and explain &quot;why&quot; something has changed.<br><br>## Run these Commands<br><br>```bash<br>git status<br>git diff --staged<br>```<br><br>## Commit Types with emojis:<br>Only use the following emojis:<br><br>- ✨ feat: – New feature<br>- 🐛 fix: – Bug fix<br>- 🔨 refactor: – Refactoring code<br>- 📝 docs: – Documentation<br>- 🎨 style: – Styling/formatting<br>- ✅ test: – Tests<br>- ⚡ perf: – Performance<br><br>## Format<br>use the following format for making the commit message<br><br>```<br>&lt;emoji&gt; &lt;type&gt;: &lt;concise_description&gt;<br>&lt;optional_body_explaining_why&gt;<br>```<br><br>## Output<br>1. Show summary of changes currently staged<br>2. Propose commit message with appropriate emoji<br>3. Ask for confirmation before committing<br><br>DO NOT auto-commit - wait for user approval, and only commit if the user says so.<br><br></pre><blockquote>Important details: Custom slash commands have been <strong>merged into skills</strong>. Existing .claude/commands/*.md still work. The recommended structure going forward is .claude/skills/&lt;skill-name&gt;/SKILL.md.</blockquote><p>In this article, I documented the workflow patterns that made Claude Code feel reliable in real projects: using slash commands as a control surface, building durable project memory with /init and CLAUDE.md, and adding task-specific context by referencing files (@...) and images. I also learned to treat the context window like short-term memory—monitor it with /context, compact intentionally at milestones, and keep sessions focused to avoid drift. Finally, I covered why tools and permissions matter, how /permissions helps manage risk, and how custom commands (Skills) turn repeated prompts into reusable workflows.</p><p>In the up-comming articles, I will be sharing my learning experience with Skills.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=964ff89d981a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Claude Code, Real Workflows: Install. Authenticate. Accelerate.]]></title>
            <link>https://numustafa.medium.com/claude-code-real-workflows-install-authenticate-accelerate-988a94ee7655?source=rss-86c9b5840c74------2</link>
            <guid isPermaLink="false">https://medium.com/p/988a94ee7655</guid>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[claude-code]]></category>
            <dc:creator><![CDATA[Naveed Ul Mustafa]]></dc:creator>
            <pubDate>Fri, 13 Feb 2026 05:45:44 GMT</pubDate>
            <atom:updated>2026-02-13T05:45:44.280Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>I’m brand new to <strong>Claude Code</strong>. This post is me documenting the <em>exact</em> setup path I’m taking — screenshots, gotchas, and small productivity tricks — so you can follow along (and so Future Me doesn’t have to relearn it). Some parts of the onboarding flow change occasionally, so think of this as a living “field notes” guide, not a perfectly frozen manual.</blockquote><h3>Step 0 — Pick your access model (Subscription vs API billing)</h3><p>Here is a signup <a href="https://claude.com/pricing">link</a>, for one of the plans on claude code website. You typically have two mainstream ways to authenticate:</p><ol><li><strong>Claude subscription</strong> (Pro/Max/Teams/Enterprise)</li><li><strong>Anthropic Console billing</strong> (usage-based billing via Console)</li></ol><p>The CLI itself will literally prompt you to choose one of these on first login.</p><h4>My recommendation (for beginners):</h4><ul><li>If you want the simplest “one account, one login” experience, start with a <strong>Claude subscription</strong> (Pro/Max). However, in case you hit the daily usage limits, you can also add credits to it.</li><li>If you prefer usage-based billing and cost tracking at the Console/org level, use the <strong>Claude Console</strong> route (requires active billing).</li></ul><p>Currently I am using a plan, provided by my organization.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*FDtb7GTrWnGTsiUK1Rnp4g.png" /><figcaption>browser capture: <a href="https://claude.com/pricing">https://claude.com/pricing</a></figcaption></figure><p>Once signed up, the next step would be to install install claude code into the machine.</p><h3>Step 1 — Install Claude Code</h3><p>Currently I am using Windows machine. In my case, I haven’t set up my claude code, so I cant share my experience installing It over windows, however, there is a comprehensive documentation about claude code installation: <a href="https://code.claude.com/docs/en/overview">here</a></p><h3>Step 2 — Start Claude Code in your project</h3><p>Once installed, go to the desired dir where the project resides, and type claude:</p><pre>cd trainings<br>cd claude_code<br>cd examples<br>claude</pre><h3>Step 3 — First-run setup (Theme)</h3><p>On the first run, Claude Code will guide you through a bit of setup. In my current version it asked me to choose a theme style for the terminal UI (this can change over time).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/1*AvbTBUFb8KnFs-h68pd5gA.png" /><figcaption>snipt from the workflow</figcaption></figure><h3>Step 4 — Authenticate</h3><p>After theme selection, Claude Code asks how you want to authenticate:</p><ul><li><strong>Claude account with subscription</strong> (Pro/Max/Teams/Enterprise)</li><li><strong>Anthropic Console account</strong> (API usage billing)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yufcZQbQTPFaCXyVOLJuzw.png" /><figcaption>snipt from workflow</figcaption></figure><p><strong>What I did:</strong> I used <strong>subscription login</strong>, because my org provides access right now (Teams-style experience), and it’s the most frictionless when you’re new.</p><h3>Step 5 — Your first “it’s working” moment</h3><p>Once you’re in, Claude Code drops you into an interactive REPL and shows a welcome panel (version, model, workspace).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*yHON6kYVaLWzVYUn3CtBWg.png" /><figcaption>Congrats!! you have successfully setup claude code into your machine</figcaption></figure><p>At this point, you can ask basic questions like:</p><ul><li>“Explain this repo”</li><li>“Where is the config loaded?”</li><li>“Run tests and summarize failures”</li></ul><p>(And it can actually run commands + read files, which is the big difference vs plain chat.)</p><h3>Step 6 — Multiline input (the first real productivity fix)</h3><p>If you try to write real prompts, multiline input matters immediately. The docs list multiple ways to insert new lines; the most universal one is:</p><ul><li><strong>Quick escape</strong>: type \ then press Enter to insert a newline (works in all terminals)</li></ul><h4>If you want Shift+Enter (recommended)</h4><p>In some terminals, <strong>Shift+</strong> Enterworks out of the box. For others (VS Code terminal, Alacritty, Zed, Warp), the docs recommend running:</p><ul><li>/terminal-setup</li></ul><p>This configures the keybinding automatically (and the command only appears when needed).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*onHxtOuCzlaZcX_PaMl7nQ.png" /><figcaption>multi-line prompt</figcaption></figure><h3>Why I’m excited about CLI (even though I live in Cursor/VS Code)</h3><p>I’m not switching to CLI because it’s trendy — I’m doing it because Claude Code’s terminal workflow is built for <strong>real execution</strong>:</p><ul><li>It can edit files and run commands directly (agentic workflow).</li><li>It has a deep set of <strong>interactive features</strong> (background tasks, shortcuts, modes).</li><li>It’s designed to scale into <strong>tools (MCP)</strong> and <strong>multi-agent orchestration</strong>.</li></ul><p>So my plan is: learn the CLI “as the source,” then bring the good parts back into my IDE workflow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zzJaSgyKyoUpJZonuukBzw.png" /><figcaption>snipt of my workflow</figcaption></figure><p>I prefer having terminal on the right. This workflow is super relatable and worth keeping. It’s a small layout change that makes Claude Code feel like a real copilot you can <em>watch</em>. This way I feel, I can see more of the session activity with claude code and also, I get more vertical space for basic file operations like read &amp; write comfortable here as well.</p><h4>My first ritual in any new repo:</h4><p>run /init and create CLAUDE.md</p><p>When I drop into a new pipeline or codebase, my first instinct is always the same: <strong>build a mental model before I touch anything</strong>. I want to understand:</p><ul><li>how the application is structured,</li><li>what data modeling choices were made,</li><li>where the business logic lives,</li><li>and how the “raw inputs → transformations → reporting/output” flow actually works.</li></ul><p>And here’s the thing: I’m not doing this only for myself — I’m doing it for <strong>Claude Code</strong> too.</p><p>That’s why one of my earliest commands in a new repo is:</p><blockquote><strong><em>/init</em></strong></blockquote><p>In practice, /init is like a “project onboarding assistant.” It analyzes the repository and generates a starter <strong>CLAUDE.md</strong> file—think of it as a lightweight, persistent briefing document that Claude automatically loads into every new session. It’s meant to capture the basics Claude needs to be consistently useful: project purpose, key directories, how to build/run/test, and the conventions it detects.</p><p>What I really like is how transparent the process feels: Claude explores the codebase, tells you what it’s doing (reading files, searching patterns), and then proposes the CLAUDE.md it wants to write—so you’re not blindly trusting a black box before it edits your repo.</p><h4>Why CLAUDE.md matters (even if you’re just experimenting)</h4><p>Claude describes CLAUDE.md as <strong>persistent project context</strong>—a file it automatically incorporates into conversations so you don’t have to re-explain architecture, workflow, and standards every time. In other words: it turns Claude from “generic assistant” into “assistant that knows <em>this</em> codebase.”</p><p>Once I’ve run /init, I keep the generated CLAUDE.md in the repo and treat it as <strong>living documentation</strong>. If I come back next week and ask Claude to refactor something or debug a test failure, it can start from that shared foundation instead of spending the first 10 minutes re-discovering the basics. And if I’m working with a team, committing CLAUDE.md means everyone benefits from the same baseline context.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*ZlW2O3MUwZiGOInzZG79BQ.png" /><figcaption>snipt of my workflow</figcaption></figure><h4>What I look for after /init</h4><p>/init gives you a strong starting point—but it’s not a finished product. After it generates the file, I usually skim it once and afterwards seek the details from Claude about the pipeline, like:</p><ul><li>the structure of the pipeline</li><li>data modelling</li><li>naming conventions and business logic</li><li>where domain logic <em>really</em> lives</li><li>Structure of an application</li><li>how test are defined (tests, lint, formatting, review steps)</li><li>how the reporting is carried out</li></ul><p>Claude’s own guidance is to treat /init as a starting point and refine it based on your real workflow, removing generic guidance that doesn’t apply.</p><p>Currently my go-to prompt is:</p><pre>Explain this pipeline like I’m onboarding: what it does, how data flows, and how reporting is produced.<br><br>Deliverables:<br>- A one-page narrative of the flow (ingest → transform → report)<br>- A simple ASCII diagram of the dataflow<br>- Snapshot vs continuous reporting: which is it and why (cite evidence)<br>- Top 10 flaws (ranked), each with: impact, likelihood, detection, fix, effort (S/M/L)<br>- 30/60/90-day improvement plan (quick wins, medium work, strategic refactor)<br><br>Use file/module references for every major claim. Label assumptions explicitly.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y6MNgOdzVsMivztuD1hVlg.png" /><figcaption>snipt of my workflow</figcaption></figure><h4>Managing chat sessions (aka “don’t lose the thread”)</h4><p>One thing I didn’t appreciate until I actually started using Claude Code is that it’s <strong>session-based</strong>, not “infinite chat history” like Copilot Chat. In practice, that’s a feature: sessions map nicely to real work (“that pipeline investigation”, “that refactor”, “that PR review”), but it also means you need to learn a couple of session controls early.</p><p><strong>Exiting a session (without drama)</strong></p><p>When I’m done for the moment, I’ll exit the session and drop back to my terminal. In-session, I can type <strong>/exit</strong> to leave the REPL. So far, that feels normal.</p><p>Here’s the gotcha I ran into as a beginner: if I start Claude Code again with just:</p><ul><li>claude</li></ul><p>…it will typically start a <strong>fresh session</strong>. (That’s why it can <em>feel</em> like you lost history — because you’re just in a new session.)The fix is simple once you know it: <strong>resume or continue</strong>.</p><p><strong>Resume vs continue (the mental model that finally clicked)</strong></p><p>Claude Code gives you two main “pick up where I left off” paths:</p><ul><li><strong>Continue the most recent session in this directory:</strong><br> claude -c <br> This is my “I was just here yesterday” option.</li><li><strong>Resume a specific session (by ID or name), or open a picker:</strong><br> claude -r <br> This is my “I want <em>that</em> pipeline chat from last week” option.</li></ul><p>Inside Claude Code, you can also use <strong>/resume [session]</strong> to open the picker or resume by ID/name. When you have more than a couple sessions, IDs become noise. Claude Code supports:</p><ul><li><strong>/rename &lt;name&gt;</strong> — rename the current session so it’s easier to find later.</li></ul><p>I now treat session names like branch names: short, descriptive, and task-oriented.</p><p><strong>Branching the conversation (without overwriting your “main” session)</strong></p><p>Sometimes I want to try a different approach without messing up the original thread. Claude Code supports “forking” when resuming:</p><ul><li>claude --resume &lt;session&gt; --fork-session</li></ul><p>This creates a new session ID while preserving the original session as-is — really useful when you want to explore alternatives. Long sessions get noisy. Claude Code has a few built-ins that help:</p><ul><li><strong>/clear</strong> clears the conversation from the active session view.</li><li><strong>/compact [instructions]</strong> compresses the conversation (handy when context is bloated).</li><li><strong>/rewind</strong> lets you rewind conversation and/or code, or summarize from a point.</li></ul><p>As a beginner, this felt like discovering “git for the conversation.”</p><p>How long are sessions kept? This part matters if you expect to come back weeks later.</p><ul><li>Claude Code can <strong>store sessions locally to enable resumption</strong> (and this behavior is configurable).</li><li>There’s a cleanupPeriodDays setting: <strong>sessions inactive longer than that are deleted at startup</strong> (default 30 days). Setting it to 0 deletes all sessions immediately.</li></ul><p>If you care about keeping long-running “investigation threads,” it’s worth checking that setting.</p><h4>Models and usage</h4><p>One thing I learned quickly: Claude Code feels very different depending on the model you pick<strong> </strong>— not just in quality, but in how fast you burn through your usage budget.</p><p><strong>Discovering what models I can use</strong></p><p>Inside Claude Code, you can pull up the model selector:</p><ul><li>Type <strong>/model</strong> to open an interactive list and switch models instantly.</li><li>If you just want to confirm what you’re currently running, use <strong>/status</strong>.</li></ul><p>In my version, the model menu shows the “big three” I care about most:</p><ul><li><strong>Haiku</strong> (fast, lightweight)</li><li><strong>Sonnet</strong> (my default daily driver)</li><li><strong>Opus</strong> (heavy reasoning / deep problem solving)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/1*5j1ane6rcsMIWx7znCBmNA.png" /><figcaption>models</figcaption></figure><p><strong>How I actually choose (my simple rule)</strong></p><p>I try not to “default to the biggest model” because it’s easy to waste usage on tasks that don’t need it.</p><ul><li><strong>Haiku</strong> → quick questions, small edits, simple explanations, quick grep-style discovery</li><li><strong>Sonnet</strong> → 80% of my daily work: coding tasks, refactors, test fixes, pipeline tweaks</li><li><strong>Opus</strong> → only when I’m stuck or doing deep reasoning: architecture decisions, thorny debugging, multi-step design, subtle logic issues</li></ul><p>Claude Code even supports model aliases (so you don’t have to remember exact version names), and the docs call out an interesting one:</p><ul><li><strong>opusplan</strong> → uses Opus while you’re planning, then switches to Sonnet for execution (a nice “save Opus for thinking” default).</li></ul><p>That alias alone reflects how I’ve started using the tool: <strong>think expensive, execute cheaper</strong>.</p><p><strong>Why Opus “eats limits”</strong></p><p>Claude Code doesn’t give a neat “you have exactly N prompts left” number — because usage isn’t based on prompts, it’s based on how much work gets done in each exchange. Your “conversation budget” is influenced by things like conversation length/complexity, features you use, and the model itself.</p><p>So if I ask Opus to:</p><ul><li>read a lot of files,</li><li>reason deeply,</li><li>produce long output,</li><li>iterate on multiple changes,</li></ul><p>…it can chew through my budget quickly — especially in larger repos.</p><p><strong>The limits model: 5-hour window + weekly cap</strong></p><p>The mental model that matches real life best is:</p><ul><li>You have a <strong>rolling 5-hour usage window</strong>, and</li><li>there’s also a <strong>weekly cap</strong> on top of that.</li></ul><p>Anthropic doesn’t publish a single universal “prompt count,” because it varies so much. But they’ve given ballpark guidance in public discussions: for Pro, an “average” user might see something like ~45 messages per 5 hours in Claude (chat) and a wide range of prompts in Claude Code depending on repo size and behavior.</p><p>In my own experience: Opus hits the ceiling faster than Sonnet/Haiku, so I treat it like a power tool — use it deliberately, not constantly.</p><p><strong>How I track usage (so I don’t get surprised mid-flow)</strong></p><p>Two things help a lot:</p><ul><li>In the UI flow (especially VS Code integration), you can view <strong>plan usage via </strong><strong>/usage</strong>.</li><li>When you do hit a limit, Claude Code tells you <strong>when the limit resets</strong>, which helps you plan your work blocks</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iwpTqk5fFdmDopG77CwIfA.png" /><figcaption>snipt for usage: Usage / reset visibility (helps me decide when to switch models).</figcaption></figure><p><strong>“Extra usage” (what I thought was “topping up”)</strong></p><p>Another thing I didn’t know at first: on paid plans you can enable <strong>Extra usage</strong>, which lets you keep going after you hit your plan limits by switching into <strong>pay-as-you-go</strong> pricing.</p><p>That’s different from “unlimited.” It’s more like:</p><blockquote>When your included budget ends, you can choose to continue — paid — rather than being hard-stopped.</blockquote><p>Next article, I’ll go deeper on <strong>Commands, Context, Tools, and Hooks</strong> (this is where Claude Code starts feeling like an actual engineering system, not just a chat interface).</p><p><em>You can follow me on </em><a href="https://x.com/numustafa_1"><em>X</em></a><em> &amp; on </em><a href="https://www.linkedin.com/in/numustafa/"><em>Linkedin</em></a><em> to get updates regarding my learning journey</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=988a94ee7655" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Options — Greeks]]></title>
            <link>https://numustafa.medium.com/understanding-options-greeks-70bf77b4b8d0?source=rss-86c9b5840c74------2</link>
            <guid isPermaLink="false">https://medium.com/p/70bf77b4b8d0</guid>
            <category><![CDATA[finance]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[energy]]></category>
            <category><![CDATA[risk-management]]></category>
            <category><![CDATA[options]]></category>
            <dc:creator><![CDATA[Naveed Ul Mustafa]]></dc:creator>
            <pubDate>Wed, 11 Feb 2026 22:59:34 GMT</pubDate>
            <atom:updated>2026-02-11T22:59:34.936Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xYaZXfnVCtYP_Vr4nDPW1A.png" /><figcaption>AI generated</figcaption></figure><blockquote>This is my second article on my quest to learn about Options from a perspective of Risk Management. The goal is to build a comprehensive understanding about Greeks, and how they are used as a tool for Risk management in Energy Trading.</blockquote><h3>Why Greeks matter?</h3><p>In energy markets — Brent, TTF and NBP gas, and related spreads — price action is often event‑driven and non‑linear. Headlines (geopolitics, OPEC decisions), infrastructure constraints (outages, pipeline/LNG disruptions), and weather-driven demand can shift both prices and volatility quickly.</p><p>Options are widely used in this environment because they allows trader to define downside, while preserving upside participation, and tailor exposures to realistic scenarios (directional moves, range trading, or volatility shocks). But options behave differently from futures: their value depends not only on where the market is today, but on how uncertain the path to expiry is, and how much time remains.</p><p>To measure and manage this complexity, energy option traders and risk teams rely on <strong>Greeks</strong> — standardized sensitivity measures (named after Greek letters) that translate an option book into a set of risk “dials”. In a risk management context, Greeks are not academic: they are the language used for daily P&amp;L attribution, limit control, scenario stress testing, and capital/margin planning.</p><h3>Options recap — what moves the premium in Energy Markets</h3><p>An option is a contract between a buyer<strong> </strong>and a seller (writer). The buyer pays an upfront premium<strong> </strong>(the option’s market price) for a <em>right</em>; the seller receives that premium in exchange for an <em>obligation</em> if buyer decides to exercised.</p><p>In energy trading, most positions are managed before expiry. Traders often hedge, restructure, or close options as market conditions change, so realized P&amp;L is typically generated from changes in option premium (mark‑to‑market), not from exercising the option. For risk management, that means the “true” exposure is the sensitivity of the premium to market inputs — exactly what Greeks quantify..</p><blockquote>More on <a href="https://medium.com/@numustafa/basics-of-options-abe9e1069690"><strong><em>Options….</em></strong></a></blockquote><p>Traders generally use options for two broad purposes:</p><ul><li><strong>Hedging:</strong> reducing risk in an existing exposure (e.g., protecting a long physical gas position against a price fall, or protecting a consumer against a price spike).</li><li><strong>Speculation:</strong> expressing a market view with defined downside (e.g., a bullish call position, or a range strategy such as a condor).</li></ul><h4>The main drivers of an option’s premium</h4><p>Option premiums are discovered through market bidding, with pricing models (Black 76) used post-trade to quantify risk and manage portfolio Greeks. Option premiums are driven primarily by three forces:</p><ol><li><strong><em>Price of an Underlying:</em></strong> <br>The actual premium of an energy option is determined by order flow. If a massive heatwave is forecasted, everyone rushes to buy TTF/NBP <strong>calls</strong>. This surge in demand drives the price up instantly. This is the most visible driver — especially for directional positions.</li><li><strong><em>Implied volatility (market‑priced uncertainty):</em></strong><br>Options are more expensive when the market expects larger moves (in price magnitude). In energy, implied volatility can jump abruptly around known catalysts (OPEC meetings, storage reports, winter risk) or sudden shocks (outages, geopolitical escalation). A useful mental model:<br><strong><em>Options are like insurance — when the environment is riskier, the “insurance premium” rises.</em></strong></li><li><strong><em>Time to Expiry (time decay):</em></strong><br>Even if the underlying price and implied volatility stay unchanged, the option’s extrinsic value generally declines as time passes. This is the “melting ice cube” effect: less time remaining means fewer opportunities for the option to become valuable.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*dI7vyU9FXoHyWg7E8i2w0g.png" /><figcaption>From <a href="https://www.investopedia.com/trading/getting-to-know-the-greeks/#toc-the-greeks">Investopedia</a>: The effect is especially pronounced for <strong>at‑the‑money (ATM)</strong> options. For an options desk, this means that near expiry, the book can experience large daily P&amp;L swings from carry alone — and those swings often coexist with elevated gamma risk (explained later).</figcaption></figure><p>In addition to these three, Interest rates also impact Option premiums, however, rates are not the dominant driver for short-dated energy options, instead they are more effective for long-dated options.</p><h3>Greeks: The Risk dashboard for Options Book</h3><p>Greeks are the standardized measures that describe how an option’s premium changes when a market input changes. They allow risk to decompose a complex options portfolio into measurable exposures and to explain daily P&amp;L in a structured way.</p><h4>Core Greeks</h4><ul><li><strong>Δ (Delta):</strong> sensitivity of option premium to a change in the underlying futures price.<br> <em>Risk interpretation:</em> “How much directional exposure do we have right now?”<br> Delta is also the most common way to convert an options portfolio into a futures‑equivalent position.</li><li><strong>Γ (Gamma):</strong> sensitivity of delta to a change in the underlying price (how quickly delta changes).<br> <em>Risk interpretation:</em> “If the market moves fast, how quickly does our directional exposure grow or flip?”<br> Gamma is central in energy because abrupt moves and gaps can create unstable hedging needs.</li><li><strong>Θ (Theta):</strong> sensitivity of option premium to the passage of time (time decay / carry).<br> <em>Risk interpretation:</em> “What is the daily carry cost (or carry income) of holding this option position?”<br> As shown in the time‑decay curve, theta becomes more punitive (or more beneficial for sellers) as expiry approaches — especially ATM.</li><li><strong>Ѵ (Vega):</strong> sensitivity of option premium to changes in <strong>implied volatility</strong>.<br> <em>Risk interpretation:</em> “If the market reprices uncertainty (volatility), how much does our book gain or lose?”<br> Longer‑dated options typically carry larger vega exposure, which is particularly relevant for seasonal gas risk (e.g., winter TTF structures).</li><li><strong>Ρ (Rho):</strong> sensitivity of option premium to interest rates.<br> <em>Risk interpretation:</em> “How much are we exposed to rate changes?”<br> Often secondary in short‑dated energy options, but relevant for longer tenors or structured books.</li></ul><p>Greeks are local approximations — they describe sensitivity for small changes “around today.” Because energy markets can jump, risk management complements Greeks with stress scenarios and liquidity/margin analysis.</p><h4>How the same market move impacts calls and puts?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*M4zdxxoJowA1zN7enQIj1A.png" /><figcaption>This is the foundation for understanding why Greeks matter: option value depends on multiple moving parts simultaneously.</figcaption></figure><ul><li>If the underlying price rises, call premiums tend to increase, put premiums tend to decrease.</li><li>If the underlying price falls, call premiums tend to decrease, put premiums tend to increase.</li><li>If implied volatility increases, both calls and puts typically increase<strong> </strong>in value (more uncertainty raises option prices).</li><li>As time passes, both calls and puts typically decrease in value (time decay), all else equal.</li></ul><h4>Why position type changes everything (long vs short)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/1*Y2WuVbnfVAoCNdEdoIntuQ.png" /><figcaption>The same market event can produce opposite outcomes depending on whether the trader has long or short options</figcaption></figure><ul><li><strong>Long calls/ long puts:</strong><br>* Benifits from higher volatility abd more time remaining<br>* Loose value from Time Decay<br>* Profits from the “right” directional moves (calls up, puts down)</li><li><strong>Short calls/ short puts:</strong><br>* Typically benifit from Time-decay (theta carry)<br>* Loose from volatility increases<br>* Face adverse outcomes when the underlying moves strongly against the short position.</li></ul><p>In Energy Trading, this is not just a payoff discussion, instead, its a Risk governance issue. A book that earns steady theta by selling options may also be exposed to “short gamma” and “short vega”, which can produce rapid losses during shocks when liquidity is strained.</p><h3>Understanding Δ (Delta): The First‑Order Risk in Options</h3><p>Delta is the most widely used Greek in risk management because it provides the clearest translation from options into a futures‑equivalent exposure. Conceptually, Delta measures how much the option premium changes when the underlying price changes by one unit, holding other factors constant (time, volatility, rates). In energy trading where deals are “futures”, Delta is interpreted as: <strong>“How much directional risk does this option position represent right now?”</strong></p><p>Delta ranges between <strong>−1.00 and +1.00</strong>, with sign and range depending on option type:</p><ul><li>For <strong>call options</strong>: 0≤Δ≤+1</li><li>For <strong>put options</strong>: −1≤Δ≤0</li></ul><p>A Delta of <strong>0.50</strong> means the option premium should move by approximately <strong>0.50</strong> for a one‑unit move in the underlying price. For example, if a trader is long a call with <strong>Δ = 0.40</strong>, then — on a small move and all else equal — an underlying increase of 1 unit implies the option premium increases by roughly <strong>0.40</strong>.</p><p>From a risk perspective, Delta is also operationally powerful because it allows aggregation across instruments. A portfolio with futures, swaps, and options can be converted into one directional metric — often expressed as <strong>delta‑equivalent lots.</strong></p><h4>Delta as a Probability Proxy: What It Means (and What It Does Not)</h4><p>Delta is often used as a quick proxy for <strong>how “close” an option is to being relevant</strong> — in other words, a market‑implied measure of <strong>moneyness</strong>. The common shorthand is:</p><blockquote><em>∣Δ∣≈</em>rough market‑implied probability of expiring ITM</blockquote><p>So a <strong>0.30 delta call</strong> is often described as having “about a 30% chance of expiring in‑the‑money,” and a <strong>−0.30 delta put</strong> similarly suggests “about a 30% chance of expiring ITM.” This interpretation is not exact mathematics, but it is extremely useful as a communication and governance tool because it standardizes language across changing market levels. Instead of saying “buy the 86 strike,” a trader can say “buy the 25‑delta call,” which remains meaningful even if Brent moves from $80 to $95.</p><p>However, it is essential — especially in oil and gas — to understand what this probability language really represents. Delta‑as‑probability is tied to <strong>risk‑neutral probability</strong>, meaning it reflects the probability implied by option prices that makes the option fairly priced today. It is not a “real‑world forecast” of what will happen; it is a market pricing statement.</p><h4>Delta as a Risk Tool for Strike Selection and Hedge Design</h4><p>The most practical application of Delta‑as‑probability in an energy trading is <strong>strike selection</strong>. Risk managers often ask: “Are we buying protection that behaves like a hedge today, or are we buying tail insurance?” Delta buckets answer that question quickly.</p><p>If a trader is long physical crude or long Brent futures exposure, buying a 50‑delta put (near‑ATM) typically provides strong hedge effectiveness because it responds materially to small price moves — but it is expensive because it contains meaningful intrinsic/time value and is more likely to end ITM. Buying a <strong>25‑delta put</strong> is usually cheaper and acts as a “moderate downside hedge,” only becoming more protective after a move lower. Buying a <strong>10‑delta put</strong> is often categorized as “crash protection”: relatively cheap, but designed to pay off primarily in severe downside scenarios (a market crash scenario).</p><p>This is why Risk Managers adopt a policy language such as: “We hedge with 25‑delta puts,” “We maintain a 10‑delta crash hedge,” or “We only buy 50‑delta protection when volatility is cheap or risk is exceptional.” Delta becomes a <strong>governance framework</strong> — not just a Greek.</p><h4>Why Delta Is Not Enough in calculating Risk alone?</h4><p>Although Delta is the primary risk translation tool, it is just a snapshot of Risk and it is not sufficient on its own — particularly in Energy markets where volatility regimes shift and price moves can creates gap. The reason Delta is insufficient on its own, is that it assumes the market is a smooth, continuous escalator. In reality, energy markets act more like a faulty elevator that skips floors or changes speed without warning. Oil options often exhibit pronounced skew (downside puts rich), gas options can display strong seasonality and event risk (especially winter), and correlations can break during stress (TTF vs LNG, Brent vs products). In these environments, a position that looks manageable on Delta can become unstable because Delta itself is not fixed — it changes as the market moves, and option prices can revalue sharply even without large spot changes.</p><p>This is the point where risk management extends beyond “today’s Delta” and must incorporate second‑order effects (how Delta changes with price), volatility repricing (how premium changes with implied volatility), and scenario stress. The next Greek — Gamma — explains the most important of these second‑order effects.</p><h3>Understanding Γ (Gamma): The Risk Manager’s Greek in Energy Trading</h3><p>Gamma is the Greek that separates basic options awareness from true risk management, because Gamma describes whether your book becomes <strong>more controllable or less controllable</strong> when markets move quickly. Formally, Gamma measures the rate of change of Delta for a one‑unit move in the underlying price:</p><p>Γ=Δ(Δ)/ΔF​</p><p>In practical risk language: <strong>Gamma measures how unstable your directional exposure becomes when the market moves.</strong> Delta tells you where you stand today; Gamma tells you how fast that position transforms as prices change. This is the heart of <strong>convexity risk</strong>.</p><p>Gamma has consistent structural properties that matter directly in energy risk governance. It is generally <strong>positive for long options</strong> and <strong>negative for short options</strong>. It tends to be highest at‑the‑money (ATM) and becomes very small when options are deep ITM or deep OTM. These properties create a recognizable risk pattern in energy books: short‑dated, ATM short option exposure is typically where risk concentrates most sharply.</p><h4>Long Gamma vs Short Gamma: Why Traders Fear the Wrong Side?</h4><p>Gamma is often described as a “friend and enemy,” but that framing becomes sharper in energy markets because shocks are common and liquidity is not guaranteed. <strong>Long gamma</strong> positions (typically long options) gain convexity: as the market moves favorably, the Delta increases in the favorable direction, meaning profits can accelerate. More importantly for risk people, long gamma provides a form of protection in fast markets: the position naturally becomes more hedged‑like as it moves in‑the‑money.</p><p><strong>Short gamma</strong> is where firms get hurt. When you sell options — especially near‑dated, near‑ATM options — you often earn theta carry, but you also take on negative gamma. In a fast Brent rally or a sudden TTF spike, a short gamma book forces the trader into reactive hedging: buying futures as the market rises (or selling as it falls), often at unfavorable levels, with margin requirements increasing at the worst possible time. This is the mechanism behind many option “blow‑ups”: losses do not merely grow linearly with price; they <strong>accelerate</strong>, and liquidity costs compound the problem.</p><h4>Gamma Concentration: Why ATM and Near‑Expiry Matter So Much?</h4><p>From a risk manager’s perspective, the most important operational fact about Gamma is that it <strong>increases as expiry approaches</strong> and concentrates around at‑the‑money strikes. This is why the same position can be “quiet” for weeks and then suddenly become unstable near expiry, even if the trader’s headline view has not changed. In oil, this often shows up around prompt expiries and event windows; in European gas, Gamma risk can become particularly acute around winter months and weather‑sensitive periods where both price and volatility can move rapidly.</p><p>This concentration effect is also why risk teams care about <strong>distribution</strong>, not only totals. A portfolio may have moderate net Gamma in aggregate, but if it is concentrated in a single prompt expiry or a narrow strike region, the book can behave poorly under a shock.</p><h4>Gamma in Spreads: Risk Is Often Reduced, Not Removed</h4><p>Energy traders frequently use spreads to reduce premium cost and to shape outcomes, but from a risk standpoint it is crucial to recognize that spreads typically <strong>transform</strong> gamma rather than eliminate it. A controlled directional spread (such as a bull call spread) often results in <strong>net positive gamma but capped</strong>, which can be appropriate for measured views. Range strategies that rely on selling options (such as condor‑type structures) often embed <strong>short gamma</strong>, meaning they can earn carry in calm markets but become fragile when the market trends or gaps — exactly the regime shift energy markets are known for.</p><p>For risk governance, the professional standard is not to judge a structure by its name (“spread” sounds safe), but to judge it by its Greek profile and stress behavior: <strong>Is the book short gamma into an event window? Is gamma concentrated in the prompt? Does a shock cause delta to jump sharply?</strong> These are the questions that matter in oil and gas.</p><h3>Understanding Vega (Ѵ): Volatility Repricing Risk in Options</h3><p>Formally, Vega measures the change in option premium for a <strong>one vol‑point</strong> (1%) change in implied volatility, holding other factors constant. In practice, risk teams convert this into a firm-wide reporting unit such as EUR per vol point (or USD per vol point) and aggregate it across positions, maturities, and products. This makes Vega highly actionable: if a desk is <strong>long Vega</strong>, it benefits when implied volatility rises; if it is <strong>short Vega</strong>, it loses when implied volatility rises. The sign is tightly linked to whether the desk is <strong>long premium</strong> (buying options) or <strong>short premium</strong> (selling options). This is one reason why short option strategies can look stable in quiet markets but become fragile during stress: volatility typically rises when markets become disorderly, so short Vega losses can materialize rapidly — sometimes even before the full directional move unfolds.</p><p>Let’s look at a hypothetical TTF Natural Gas option:</p><ul><li><strong>Current Option Premium:</strong> €2.50</li><li><strong>Current IV:</strong> 40%</li><li><strong>Vega:</strong> 0.10</li></ul><p>If a heatwave forecast causes the market to expect “larger moves,” and the IV jumps from <strong>40% to 41%</strong> (a 1 vol-point move), the new premium will be:</p><p>€2.50 + €0.10 = €2.60 (€ 2.50 plus € 0.10 equals € 2.60)</p><p>If the IV jumps by <strong>10 points</strong> (from 40% to 50%), the premium increases by:</p><p>€2.50 +10x€0.10 = €2.50 + €1.00 = €3.50 — New Premium</p><p>Energy markets are famous for “Vol Spikes.” While a stock might see its IV move 1 or 2 points in a day, Natural Gas or Power IV can “gap” <strong>20 or 30 vol-points</strong> in a single afternoon if a major supply line is disrupted. For risk management, this is the practical meaning of Vega: <strong>you can lose or gain money due to volatility repricing even when the futures curve barely moves</strong>.</p><p>Vega exposure is not uniform across strikes and expiries. As a broad principle, Vega tends to be <strong>largest for longer‑dated options</strong> and typically <strong>highest around at‑the‑money (ATM)</strong> strikes. This matters because longer-dated energy risk is frequently where firms carry structural exposures: winter gas risk (TTF seasonality), deferred crude hedges, and longer-tenor protection structures linked to physical commitments. In a gas context, this is especially relevant because seasonal uncertainty is not evenly distributed across the year; the market can embed significant risk premium into winter months, and implied volatility for those tenors can reprice quickly as weather forecasts or storage conditions evolve. A risk manager therefore monitors not only the total Vega, but also <strong>where the Vega sits</strong>: which product, which delivery season, which expiry bucket, and whether the exposure is concentrated around a specific event window.</p><p>Another professional nuance is that Vega interacts with the <strong>volatility surface</strong> — its term structure (front month vs back month) and skew (downside puts often richer than calls, especially in oil). This means two portfolios with the same net Vega can behave differently if one is concentrated in a short-dated window with high event risk, while another is distributed across longer tenors. In practice, this is why sophisticated risk teams track Vega in a “ladder”: by <strong>maturity buckets</strong> (prompt, 1–3 months, 3–12 months, &gt;1 year) and by product. They also apply volatility shock scenarios (e.g., <strong>+5 vol points, +10 vol points</strong>) to estimate potential P&amp;L impacts under stress and to ensure that Vega risk remains consistent with the firm’s risk appetite.</p><p>Vega is also the reason an options book can feel “mark‑to‑market dangerous” compared with futures. Futures P&amp;L is dominated by price movement; options P&amp;L is driven by a combination of Delta, Gamma, Theta, and Vega. A trader can be directionally correct — Brent moves higher, TTF drifts lower — but still underperform if implied volatility collapses and compresses option premiums. This is common after large scheduled events: as uncertainty resolves, the market frequently experiences a volatility crush, which harms long Vega positions and benefits short Vega positions. For risk managers, this underscores why monitoring Vega is not optional: Vega represents the component of P&amp;L driven by changes in the market’s fear/uncertainty level, and energy markets are particularly prone to sudden shifts in that fear premium.</p><p>Finally, Vega must be understood in conjunction with Gamma. In many real-world portfolios, long options tend to be <strong>long Vega and long Gamma</strong>, while short options tend to be <strong>short Vega and short Gamma</strong>. That coupling matters in energy crises because price movement and volatility expansion often arrive together. This is the “double-hit” risk: a short premium book can be pressured simultaneously by adverse price moves (Gamma dynamics) and volatility repricing (Vega), at precisely the time liquidity and margins become more challenging. A risk manager’s role is to identify where that coupling exists, quantify it, and ensure it is either intentional, hedged, or sized within tight limits.</p><h3>Understanding Theta (Θ): Carry, Time Decay, and the Economics of Holding Optionality</h3><p>If Vega is the risk of volatility repricing, Theta is the economics of time passing. Theta measures how much an option’s premium changes as one day elapses, holding other factors constant. Because options contain extrinsic value (time value), and that extrinsic value cannot survive beyond expiry, the market steadily removes it as the clock runs down. This is why Theta is often described as the “melting ice cube” effect: time value erodes continuously, and the rate of erosion is not constant. In practical risk language, Theta is the <strong>daily carry</strong> of an options position — the “rent” paid to hold optionality (long options) or the “income” earned for selling optionality (short options).</p><p>For long option positions (long calls or long puts), Theta is typically <strong>negative</strong>: if nothing else changes, the option loses value each day. For short option positions, Theta is typically <strong>positive</strong>: the seller benefits from the passage of time because the option’s extrinsic value decays. This is the underlying economic trade that drives many options strategies. Long premium desks pay carry in exchange for convex protection and upside optionality; short premium desks earn carry in exchange for taking on tail and convexity risk. In an energy trading firm, this carry trade must be controlled explicitly because it can be easy to “hide” risk behind steady theta income.</p><p>Theta is particularly important in energy markets because time decay accelerates as expiry approaches, especially for at‑the‑money options. This creates a well-known risk concentration pattern: near expiry, options often exhibit both <strong>high Theta and high Gamma</strong>. The result is that small movements in price and volatility can create outsized P&amp;L swings in a short window. From a risk perspective, this is why front-month options positions — particularly those near ATM — require closer monitoring, tighter limits, and more conservative sizing. Energy markets frequently experience sudden catalysts (inventory reports, OPEC headlines, short-notice outages, weather updates), and short-dated positions can move from “manageable” to “unmanageable” very quickly when high Gamma and high Theta coexist.</p><p>Theta also explains a common practical outcome: being right on direction is not sufficient if you are long options and the move happens too slowly. A long call can lose money in a slowly rising market if time decay overwhelms delta gains, especially if implied volatility declines at the same time. This is a key risk lesson for energy options: after major events, volatility often compresses, and long option holders can experience a “double headwind” — negative Theta plus Vega losses from vol falling. In risk management terms, long options are often a bet not just on direction, but on <strong>timing and realised volatility</strong>. If the market does not move enough, fast enough, or violently enough, Theta becomes the dominant driver of P&amp;L. On the other side, Theta is the “income engine” for option sellers — but it must be treated with caution. The core risk truth is that theta gains are typically <strong>small and steady</strong>, whereas losses from convexity and shocks can be <strong>large and sudden</strong>. In energy, this asymmetry is particularly pronounced. A short options book may earn carry for weeks, only to lose multiples of that carry on a single shock day when prices gap and implied volatility expands. In European gas markets, where winter risk and supply uncertainty can trigger sharp repricings, this dynamic is not theoretical; it is structural. For that reason, a risk manager does not evaluate Theta in isolation. Theta is always assessed alongside Gamma and Vega, because a position that appears attractive on “carry” may actually be a leveraged short volatility exposure.</p><p>Professionally, Theta is treated as both a P&amp;L driver and a governance metric. Many firms monitor a trader’s <strong>net Theta</strong> as a daily expected carry number — effectively the “budget” being spent (if negative) or earned (if positive). A large negative Theta suggests the desk is paying meaningful premium and must have a clearly articulated rationale (protecting tail risk, positioning around a catalyst, or maintaining convexity). A large positive Theta suggests the desk is monetising time decay and must be controlled through stress limits that capture the downside (gap moves, volatility shocks, liquidity and margin impacts). In this sense, Theta becomes a behavioural indicator: it tells risk whether the desk is predominantly <strong>buying insurance</strong> or <strong>acting as an insurer</strong>.</p><h3>How to turn Greeks into a working Risk Framework?</h3><p>In an energy trading firm, Greeks are not studied for academic interest — they are used because they convert nonlinear, multi-factor option exposures into a language that can be <strong>measured, governed, and explained</strong>. Oil and gas options sit at the intersection of direction, volatility, time, and liquidity. A trader can be “right” on the market narrative and still lose money if the move arrives too slowly (theta bleed), if implied volatility collapses after an event (vega crush), or if a sudden shock forces reactive hedging (short gamma). This is why the risk function’s job is not only to monitor the underlying futures exposure, but to understand <strong>how option value evolves through time</strong> and under different regimes — calm markets, event windows, and crisis conditions.</p><p>Delta remains the starting point because it translates option books into a familiar unit: <strong>futures-equivalent exposure</strong>. It answers the immediate question, “Where are we positioned today?” and it enables aggregation across futures, swaps, and options. But delta is only the first layer of control. Gamma explains the second layer: “If the market gaps or trends sharply, how quickly does that delta change, and how unstable does hedging become?” In energy, gamma is often the real differentiator between a controllable book and one that becomes dangerous when liquidity thins. Vega adds a third layer that is particularly important in European oil and gas: “If the market reprices uncertainty, what happens to our premium?” Volatility in these markets is not constant — it is a traded risk premium that can inflate on geopolitical headlines, supply disruptions, or winter gas shocks, and collapse just as quickly when uncertainty resolves. Theta then completes the picture: it forces discipline around carry. It makes explicit whether the desk is paying for convexity (negative carry) or earning carry by selling optionality (positive carry), and it highlights when a strategy depends on time passing rather than being robust to shocks.</p><p>From a risk manager’s perspective, the most effective governance model uses Greeks to structure both P&amp;L attribution and limits. Daily P&amp;L should be explainable in terms of delta-driven direction, gamma-driven convexity, vega-driven volatility repricing, and theta-driven carry — so the firm can distinguish “good P&amp;L” (consistent with the intended risk) from “accidental P&amp;L” (unintended exposures that happened to work). Limits should be set in the same spirit: delta limits prevent silent accumulation of directional risk; gamma limits control how unstable that risk becomes under large moves; vega limits protect the firm from volatility regime shifts; theta budgets enforce discipline around premium spend or carry collection. Importantly, these Greek limits should never stand alone. In European oil and gas, where gap risk and liquidity stress are structural features, the limits must be reinforced with stress tests (price shocks, volatility shocks, curve shifts) and concentration checks (expiry clustering, strike clustering, and product clustering) to ensure the firm is not unknowingly short convexity into an event window or overly exposed to a single seasonal risk point.</p><p>The practical endpoint of this framework is a risk process that is both <strong>transparent</strong> and <strong>enforceable</strong>. Transparency means the trader and risk team can speak the same language: what risks are being taken, why they are being taken, what is expected to drive returns (carry, direction, volatility), and what conditions would invalidate the strategy. Enforceability means the firm can set clear boundaries — daily and under stress — so that gradual carry losses do not accumulate unnoticed and sudden shock losses do not exceed the organization’s risk appetite. When implemented well, Greeks become more than sensitivity measures: they become a structured approach to running an options book as a controlled business, where performance is attributable, exposures are intentional, and tail risks are visible before they arrive.</p><blockquote>You can follow me on <a href="https://x.com/numustafa_1">X</a> &amp; on <a href="https://www.linkedin.com/in/numustafa/">Linkedin</a> for more insights into Risk management</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=70bf77b4b8d0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Claude Code, Real Workflows: Lessons From My First Migration]]></title>
            <link>https://numustafa.medium.com/claude-code-real-workflows-lessons-from-my-first-migration-1-b4fc1a8b5f16?source=rss-86c9b5840c74------2</link>
            <guid isPermaLink="false">https://medium.com/p/b4fc1a8b5f16</guid>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Naveed Ul Mustafa]]></dc:creator>
            <pubDate>Sun, 08 Feb 2026 12:41:51 GMT</pubDate>
            <atom:updated>2026-02-12T09:44:24.002Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*yHON6kYVaLWzVYUn3CtBWg.png" /></figure><h3>Learnings</h3><p>I enjoy working with <strong>Claude Code</strong>, Anthropic’s agentic coding tool. Until recently, my day-to-day workflow relied heavily on <strong>Codex inside VS Code</strong>. As part of organizational changes at work, I shifted to Claude Code and joined an in-house training session where I got hands-on experience using it against our actual codebase.</p><p>This post is the first in a series where I’ll document what I’m learning — what worked, what didn’t, and the practical patterns I’m adopting to build and maintain robust workflows (especially in risk management–style domains, where correctness and traceability matter).</p><h4>Where I’m coming from</h4><p>Before this transition, Codex in VS Code noticeably improved my productivity. I was able to move faster when:</p><ul><li>drafting and refining data logic,</li><li>turning business requirements into implementation details,</li><li>and shipping changes with more confidence.</li></ul><p>If I had to quantify it, I <em>felt</em> a meaningful step up — something like a ~50% improvement in output on the work that was well-scoped and reviewable. That said, I want to be careful with numbers here: productivity is slippery to measure, and “more code” is not the same as “better outcomes.”</p><p>After switching to Claude Code, I had a second realization: the biggest gains don’t come from the model “being smarter” in isolation — they come from <strong>how well I manage context</strong>. When I keep context tight (problem statement, constraints, existing architecture, tests, and definition of done), Claude Code feels like it can amplify my workflow dramatically. When I don’t, the results look more like fast iteration with hidden costs.</p><p>So, the main theme of this series is simple:</p><blockquote>Context is the multiplier.</blockquote><h3>What is Claude Code?</h3><p>Claude Code is an <strong>agentic coding tool</strong> designed to work directly with your projects. Instead of acting like a chat window that only <em>suggests</em> code, it’s built to collaborate more actively: reading and navigating a repository, editing files, running commands and tests, and helping with Git workflows — while keeping you in control.</p><p>One thing that immediately clicked for me is the <strong>terminal-first mindset</strong>. I’m comfortable in CLI workflows, and I like that Claude Code fits naturally into that style of work. At the same time, it’s not limited to the terminal anymore — you can use it across different “surfaces” (terminal, IDEs, and web), which matters if your workflow spans tools.</p><h3>My first core learning: avoid “vibe coding,” optimize for maintainability</h3><p>When I used Codex, it was easy to slip into what people often call “vibe coding”: quickly generating code that <em>looks</em> plausible, then nudging it until it compiles. That can be fine for prototypes, but in production systems it can quietly create technical debt — especially when the assistant isn’t anchored to architecture decisions, naming conventions, data contracts, and test expectations.</p><p>In my experience, the risk isn’t that the AI writes “bad code.” The risk is that <strong>I</strong> accept output that isn’t properly constrained.</p><p>What I’m learning to do with Claude Code is shift from:</p><ul><li>“Generate me the implementation”<br> to:</li><li>“Here is the spec, the constraints, the file boundaries, the invariants, and the test strategy — now propose a plan, then implement in small, reviewable steps.”</li></ul><p>This approach tends to:</p><ul><li>reduce review churn,</li><li>make diffs easier to reason about,</li><li>and keep the codebase consistent with existing patterns.</li></ul><h3>What this series will cover??</h3><p>Over the next posts, I’ll share practical notes and repeatable workflows on:</p><ol><li><strong>Setting up Claude Code</strong> (installation, authentication, and getting productive quickly)</li><li><strong>Managing sessions and chats</strong> (how I structure work so context doesn’t decay)</li><li><strong>Usage limits and productivity</strong> (how I prioritize tasks so I don’t waste “good context”)</li><li><strong>Context + commands</strong> (building reusable commands for consistent results)</li><li><strong>Spec-driven development</strong> (planning-first workflows for features and refactors)</li><li><strong>MCP servers</strong> (connecting Claude Code to external systems and APIs safely)</li><li><strong>Skills</strong> (codifying project conventions: structure, style, commit formats, etc.)</li><li><strong>Subagents</strong> (delegating specialized work streams without losing coherence)</li><li><strong>Plugins</strong> (packaging commands/skills/config into reusable setups per repo/team)</li><li><strong>Git integration</strong> (PR-ready workflows: reviews, commits, and automation patterns)</li></ol><p>If you’re also adopting Claude Code (or any agentic coding workflow), my hope is that these notes help you avoid the common pitfalls and get to the “reliable compounding gains” faster.</p><blockquote>You can follow me on <a href="https://x.com/numustafa_1">X</a> &amp; on <a href="https://www.linkedin.com/in/numustafa/">Linkedin</a> to get updates regarding my learning journey</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b4fc1a8b5f16" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Basics of Options]]></title>
            <link>https://numustafa.medium.com/basics-of-options-abe9e1069690?source=rss-86c9b5840c74------2</link>
            <guid isPermaLink="false">https://medium.com/p/abe9e1069690</guid>
            <category><![CDATA[finance]]></category>
            <category><![CDATA[risk-management]]></category>
            <category><![CDATA[energy]]></category>
            <category><![CDATA[options-trading]]></category>
            <category><![CDATA[options]]></category>
            <dc:creator><![CDATA[Naveed Ul Mustafa]]></dc:creator>
            <pubDate>Fri, 06 Feb 2026 03:30:31 GMT</pubDate>
            <atom:updated>2026-02-06T03:30:31.144Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*maVAA32CBssfbijYV7zMnw.png" /><figcaption>AI Generated</figcaption></figure><blockquote>This is my quest to learn about Options from a perspective of Risk Management. The goal is to build a comprehensive understanding about Options, and how they are used as a tool for hedging Risk in Energy Trading.</blockquote><p>An Option is a type of financial instrument, that is tied to the underlying security. It gives buyer the right (not obligation) to buy (Call Option) or sell (Put option) given security at a strike price, within a specified period.</p><h3><strong><em>Key Points:</em></strong></h3><h4>There are two types of options:</h4><ul><li>Call Option — Benefits from an increase in the price of underlying Asset</li><li>Put Option — profits from a decline in the underlying Asset’s price</li></ul><h4>Options are categorized into American and European</h4><p>Based on when the holder can exercise the option, energy options are commonly classified as American or European. An American-style option gives the buyer the right to exercise at any time up to expiration, which provides more flexibility in managing physical and market risk. A European-style option can only be exercised on the expiration date, which makes it simpler and typically lower in cost. In general, American options trade at a higher premium than European options because the early exercise feature adds value, especially in commodity markets where timing and cashflow can matter.</p><h4>Greeks — Risk Metrics in Options Trading</h4><ul><li>Δ — (Delta) measuring premium sensitivity due to change in the value of underlying security</li><li>Θ — (Theta) represents Time decay, means how much value option loses each day, as time passes</li><li>Γ — (Gamma) shows delta fluctuation relative to change in the value of underlying security</li><li>Ѵ — (Vega) measuring premium sensitivity due to change in Implied Volatility</li><li>Ρ — (Rho) measuring price sensitivity relative to interest rates.</li></ul><h4>Options Spreads</h4><p>Use combination of buying and selling different options to achieve specific Risk Return profiles, enabling traders to capitalize on various market scenarios, incl volatility and Price movement.</p><h4>Basic Terminology:</h4><ul><li><strong><em>Underlying:</em></strong> The security upon which the option is based on</li><li><strong><em>Strike Price:</em></strong> The price at which underlying can be bought or sold (also known as Exercise Price) and is dictated by the terms of options contract. Different from the market (spot) price of underlying.</li><li><strong><em>Exercise:</em></strong> when an option contract owner uses its right (which is not an obligation) to buy/sell the underlying at the strike price. The seller in this case is said to be “assigned”.</li><li><strong><em>Implied Volatility (IV)</em></strong>: The volatility of the underlying (how <strong>quickly</strong> and <strong>severely</strong> it moves) as revealed by the spot prices</li><li><strong><em>Premium</em></strong><em>:</em> The price paid for an option in the market</li><li><strong><em>At The Money (ATM):</em></strong> strike price = spot price (Δ = 0.5)</li><li><strong><em>In The Money (ITM):</em></strong> An option with Intrinsic value, where strike price is <strong>better</strong> than the spot price (Δ &gt; 0.5) — For Call option: Strike price &lt; Spot price &amp; for Put option: Strike price &gt; Spot price.</li><li><strong><em>Out of The Money (OTM):</em></strong><em> </em>An option with only Extrinsic value (time value), where strike price is worse than sport price of an underlying (Δ &lt; 0.5) — For Call option: Strike price &gt; Spot price &amp; for Put option: Strike price &lt; Spot price.</li></ul><p>Unlike futures, options provide the holder with the <strong>right, but not the obligation</strong>, to buy or sell the underlying (e.g., Brent, WTI, TTF) at a predefined strike price. This flexibility allows traders to gain exposure and manage risk <strong>without locking into a mandatory physical or futures position</strong>, while keeping downside risk more controlled. As a result, options are widely used in energy markets for both <strong>speculation</strong> and <strong>hedging against adverse price and volatility movements</strong>.</p><h3>How Options work?</h3><p>Options are versatile Risk-management instruments widely used in <strong>energy markets</strong> (e.g., Brent, WTI, TTF). An option contract involves two parties: a <strong>buyer</strong> and a <strong>seller (writer)</strong>. The buyer pays an upfront <strong>premium</strong> in exchange for a <em>right</em>, while the writer receives the premium in exchange for taking on an <em>obligation</em> if the buyer of (call/put) option exercise its right. For an energy trader, the premium is best viewed as the <strong>cost of insurance</strong>: it can cap downside risk while still allowing participation in favourable price moves. In exchange-traded energy options, exercising typically results in a <strong>futures position</strong>, although many traders manage risk by <strong>closing or rolling</strong> the option rather than exercising.</p><h4>Call Option — Right to buy</h4><p>A call gives the holder the right to buy the underlying (typically an energy futures contract) at a specified strike price on or before expiration. Calls are used when you want protection against <strong>rising prices</strong> (e.g., an Airline hedging a fuel price spike) or when expressing a bullish view. A <strong>long call</strong> has <strong>limited loss</strong> (the premium paid) and potentially large upside if the underlying settles above the strike. If the underlying spot price is <strong>below the strike at expiry</strong>, exercising would not make economic sense, so the call expires worthless and the loss is limited to the premium.</p><h4>Put Option — Right to Sell</h4><p>A put gives the holder the right to sell the underlying at the strike price on or before expiration. Puts are used to protect against <strong>falling prices</strong> (e.g., a Energy producer hedging revenue or a trader protecting a long inventory/long futures position). A <strong>long put</strong> benefits when the underlying price declines and has a <strong>maximum loss limited to the premium</strong>. This is often a safer way to express downside protection than shorting the underlying directly, because a short futures position can incur large losses if the market rallies, while a long put has a defined worst-case loss.</p><ul><li><strong>Long Put (Speculation):</strong> A bearish position designed to profit from a price drop, with max loss limited to premium paid and profit increasing as prices fall.</li><li><strong>Protective Put (Hedge):</strong> A risk-control strategy where you own the underlying (or hold a long futures exposure) and buy a put as insurance. This protects against a downside move while keeping upside if prices rise. The <strong>max loss</strong> is limited to approximately <strong>(spot − strike) + premium</strong> (i.e., the decline you tolerate down to the strike, plus the insurance cost).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/655/1*r4c7461Uasyhh_3JW-2oaw.png" /><figcaption>The figure’s delta chart also adds an important hedging insight: <strong>put delta becomes more negative as the put moves from OTM to ITM</strong>. Deep <strong>OTM</strong> puts have delta near <strong>0</strong> (cheaper “disaster insurance” that only helps in large sell-offs), while deep <strong>ITM</strong> puts have delta near <strong>−1</strong> (they behave more like a short futures hedge and provide stronger day-to-day protection). This is why strike selection matters in energy hedging: you are choosing between <strong>cost</strong> (OTM cheaper) and <strong>hedge strength</strong> (ITM/ATM stronger).</figcaption></figure><h4>Understand the Options Premiums</h4><p>Option total price (the premium) contains 2 parts:</p><ul><li><strong><em>Intrinsic value</em></strong> — represents the real-world or inherent worth of the option itself, independent of the external factors, like time or volatility. Key characteristics of intrinsic values are <strong>Moneyness</strong> (only ITM options), <strong>always +ve </strong>&amp; <strong>Immediate value</strong> (profit).</li><li><strong><em>Extrinsic Value (Time Value):</em></strong><em> </em>The additional premium paid for the potential of further price movement before expiration. While option approaches its expiration date, its extrinsic value approaches 0, however, leaving the premium consisting entirely of its “intrinsic value”.</li></ul><h3>Spreads</h3><p>Option spreads involve buying and selling multiple options on the same underlying (e.g., Brent, WTI, ICE TTF). Some spreads use <strong>only calls</strong> (e.g., bull call spread) or <strong>only puts</strong> (e.g., bear put spread), while other widely used structures combine <strong>both calls and puts</strong> (e.g., iron condors, collars). In practice, many spreads use the <strong>same expiry date</strong> (especially “vertical” spreads), but spreads can also use <strong>different expiry dates</strong> when the trader’s objective is linked to <strong>time decay, seasonality, or volatility term structure</strong>.</p><h4>Why Spreads are “default tools” in Energy Trading</h4><p>In energy markets, spreads are often the <strong>most practical</strong> way to express a view or hedge a risk because:</p><ol><li><strong><em>Energy Options can be expensive </em></strong>— Implied volatility is often elevated due to event risk and abrupt price shocks, which makes outright calls/puts costly. Spreads reduce premium outlay by <strong>selling one option to finance another</strong>.</li><li><strong><em>Energy market can have sudden jumps</em></strong> — OPEC decisions, geopolitical headlines, refinery outages, pipeline disruptions, weather events (hurricanes, winter freezes), and inventory surprises can drive fast, discontinuous moves. Spreads are attractive because they can be structured with <strong>defined worst-case losses</strong>, which matters when markets gap and liquidity thins.</li><li><strong><em>Energy traders often expect “moderate” moves, not unlimited trends</em></strong> — Many trading decisions are based on a realistic range or a measured directional move. Spreads let traders pay for the part of the move they think is likely and <strong>avoid overpaying for extreme tails</strong> they do not expect to monetize.</li></ol><p>To put it more simply, options spread is a packaged risk profile, which allows trader to determine and shape their Risk and Reward. Instead of buying a single option with potentially high premium, significant time-decay exposure and long volatile profile; one can construct a spread which mimic the market behaviour more appropriately. A well-designed spread can help:</p><ul><li><strong><em>Reduce cost</em></strong> — lower net premiums than premium for a single option</li><li><strong><em>Define Risk</em></strong> — pre-set max loss in many common structures</li><li><strong><em>Target a realistic market view</em></strong></li><li><strong><em>Trade different / multiple scenarios</em></strong> — Bullish, Bearish, Range-bound, High volatility (big moves) and low volatility (quite markets)</li></ul><p>Spreads are built using <strong>vanilla options</strong> — standard calls and puts with fixed strikes and expiries. Conceptually, vanilla options are the “building blocks,” and a spread is the structure build to shape a payoff that matches trader’s risk mandate.</p><h4>Spread Families</h4><p>There are three core families of spread:</p><ol><li><strong><em>Vertical Spreads (same expiry, different strikes)</em></strong> — used when main goal is a directional view (up or down), and need a defined risk at a lower premium than a normal premium for single option.</li><li><strong><em>Calendar / horizontal Spreads (different expiry, same strikes)</em></strong> — used when time-decay and volatility term structure matters which is very common in energy commodities due to seasonality trends. This gives an event risk, or known catalysts.</li><li>Diagonal Spreads (different expiry and different strikes) — More complex in nature, and often used when there is a specific requirement of specific time profile and specific price zone simultaneously.</li></ol><h4>Spreads — Payoff profile vs Greek profile</h4><p>Payoff profile at expiry is very simple and evident, where trader is certain what they made at the end of the day. However, in Energy Trading, the path to expiry aften matters as much as the expiry payouts. This is represented by Greek profile, where P&amp;L can be dominated by volatility repricing, sharp intra-day moves, changes in forward curve and time decay. This is why spreads are frequently chosen to shape Greeks, not just expiry payoff.</p><h4>Examples</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/549/1*f72u0U7wZmYo5UleujTw7Q.png" /><figcaption>Example — 1 (AI generated)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/556/1*-elyTCZVjl-mgIp72P61QA.png" /><figcaption>Example — 2 (AI generated)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*4YN0Itn68ooxZmbjOW30cg.png" /><figcaption>Example 3 — (AI generated)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*31qcHR1RJwWXTz15Y3-w0w.png" /><figcaption>Example 4 — (AI generated)</figcaption></figure><p>Options are foundational risk instruments in energy markets because they convert uncertain price outcomes into <strong>defined, controllable exposures</strong>. A call or put gives the holder a <strong>right, not an obligation</strong>, to transact at a strike price; the premium is the <strong>known cost of protection or optionality</strong>. Unlike futures, which create linear and mandatory exposure, options allow traders to <strong>cap downside</strong> while preserving upside participation — particularly valuable in markets prone to <strong>jumps, volatility shocks, and liquidity gaps</strong>. Option spreads extend this toolkit by combining long and short options to engineer a payoff that matches a realistic market view (directional, range-bound, or volatility-driven) while managing cost and limiting tail outcomes.</p><h3>Professional Risk Takeaways</h3><ul><li>Start with the exposure: <strong>direction (delta), convexity (gamma), volatility (vega), and carry (theta)</strong> — these drive options P&amp;L more than narratives.</li><li>Treat premium as <strong>insurance/carry</strong>: long optionality costs money over time, but protects against discontinuous moves.</li><li>Spreads are <strong>risk packaging</strong>: they reduce premium and define worst-case loss, but often cap gains and may introduce hidden risks via the short leg.</li><li>Always align strikes/expiries to the <strong>risk window</strong> (inventory cycle, OPEC, hurricane season, winter peak demand).</li><li>Avoid uncontrolled short option exposure: in energy, being <strong>short gamma/vega</strong> can deteriorate quickly when markets gap or volatility reprices.</li><li>Use payoff diagrams <em>and</em> scenario stress tests; “limited loss” is still meaningful.</li></ul><blockquote>You can follow me on <a href="https://x.com/numustafa_1">X</a> &amp; on <a href="https://www.linkedin.com/in/numustafa/">Linkedin</a> for more insights into Risk management</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=abe9e1069690" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Breaking Through the Agentic AI Information Overload: Week 1]]></title>
            <link>https://numustafa.medium.com/breaking-through-the-agentic-ai-information-overload-week-1-f39ed4a654b0?source=rss-86c9b5840c74------2</link>
            <guid isPermaLink="false">https://medium.com/p/f39ed4a654b0</guid>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[solutions]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <dc:creator><![CDATA[Naveed Ul Mustafa]]></dc:creator>
            <pubDate>Wed, 11 Jun 2025 22:42:09 GMT</pubDate>
            <atom:updated>2025-06-11T22:42:09.595Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sl5pnqXSPHU2TSrHVfa3_Q.png" /><figcaption>Image generated from SORA</figcaption></figure><blockquote>Part of an 8-week journey to create a fully local, observable, and secure AI agent system with zero cloud dependencies</blockquote><h3>The Foundation: Week 0 Recap</h3><p>Before diving into LLM integration, I established a rock-solid development foundation. Working on a Windows machine with WSL2, I configured Docker Desktop with WSL integration and set up VS Code with a comprehensive dev container environment. The key breakthrough was solving the networking challenge between my dev container and the host-running Ollama service using host.docker.internal:11434. This setup provides complete environment reproducibility while maintaining the flexibility to run LLM inference on the host machine for optimal performance. With Python 3.11, essential tools like uv for dependency management, and a clean .devcontainer configuration, I had a production-ready development environment that eliminates &quot;works on my machine&quot; issues entirely.</p><p><em>Read more about Week 0:</em><a href="https://medium.com/@numustafa/breaking-through-the-agentic-ai-information-overload-week-0-a397a1289388"><strong><em> here</em></strong></a></p><h3>Week 1: The LLM API Mastery Challenge</h3><h4>The Vision Behind Week 1</h4><blockquote>Week 1 represents the critical foundation of my local AI agent system. Before building sophisticated agents, tools, or RAG systems, I needed to master the fundamental layer: <strong>how to reliably and efficiently communicate with local Large Language Models</strong>.</blockquote><p>The logic is straightforward but crucial: every advanced AI capability I’ll build in subsequent weeks depends on rock-solid LLM communication. Whether it’s prompt engineering, tool calling, or agent orchestration, it all comes down to making API requests to my local Ollama server. If this foundation is shaky — with timeouts, inconsistent performance, or poor understanding of model behavior — everything built on top will be equally unreliable.</p><p>My goal wasn’t just to make API calls work, but to understand the <strong>production considerations</strong> that separate amateur hobby projects from professional AI applications. This meant diving deep into performance optimization, reliability engineering, and workflow automation.</p><h4>Starting Point: The Deceptively Simple API Call</h4><p>I began with what seemed like a straightforward task: make HTTP requests to my local Ollama server running Qwen3 (a 4.9GB language model). The initial implementation in hello_llm.py was clean and minimal:</p><pre>import requests<br>import time<br><br>OLLAMA_BASE_URL = &quot;http://host.docker.internal:11434&quot;<br>MODEL = &quot;qwen3:latest&quot;<br><br>def sync_request(prompt: str) -&gt; dict:<br>    start_time = time.perf_counter()<br>    response = requests.post(<br>        f&quot;{OLLAMA_BASE_URL}/api/generate&quot;,<br>        json={<br>            &quot;model&quot;: MODEL,<br>            &quot;prompt&quot;: prompt,<br>            &quot;stream&quot;: False<br>        },<br>        timeout=30<br>    )<br>    elapsed = (time.perf_counter() - start_time) * 1000<br>    return {&quot;latency_ms&quot;: elapsed, &quot;response&quot;: response.json()}</pre><p>This worked perfectly for simple tests. A quick “Hello” prompt returned responses in reasonable time, and I was ready to move on to async programming and concurrent requests. But that’s when reality hit hard.</p><h4>The Performance Wall: When Simple Becomes Complex</h4><p><strong>The Shocking Initial Results: </strong>When I ran my first comprehensive benchmark comparing synchronous, asynchronous, and concurrent request patterns, the results were alarming:</p><pre>🐌 Synchronous requests:<br>  ✅ 18413.2ms: Say hello<br>  ❌ 30025.4ms: What is 2+2? (TIMEOUT)<br>  ❌ 30038.1ms: Explain Python (TIMEOUT)<br><br>Performance Summary:<br>  Sync: 78.48s total, 26158.9ms average<br>  Async: 72.13s total, 24041.1ms average  <br>  Concurrent: 30.22s total, 30166.7ms average<br>  Success Rate: ~33% (67% timeout failures)</pre><p><strong>67% of my requests were timing out.</strong> Average response times exceeded 26 seconds. This wasn’t just poor performance — it was completely unusable for any real application. Imagine building a ChatGPT-like interface where two-thirds of user queries fail with timeouts!</p><h4>The Cold Start Discovery</h4><p>Instead of immediately trying to fix the symptoms (increasing timeouts, retrying failed requests or go with the smaller LLM), I decided to investigate the root cause. This led to one of the most important learning experiences of Week 1: understanding the <strong>fundamental difference between “cold” and “warm” model states</strong>.</p><p>Through careful experimentation documented in hello_llm_explained.py, I discovered that LLMs have two distinct operational phases:</p><p><strong>Cold State:</strong> Model files exist on disk but aren’t loaded into memory</p><ul><li><em>First request triggers loading the entire 4.9GB model from SSD into RAM</em></li><li><em>Loading overhead: 20–30 seconds depending on hardware</em></li><li><em>Generation time: Additional 3–5 seconds for actual text generation</em></li><li><em>Total time: 25–35 seconds for the first request</em></li></ul><p><strong>Warm State:</strong> Model already loaded and active in memory</p><ul><li><em>No loading overhead — model ready for immediate inference</em></li><li><em>Generation time: 1–5 seconds depending on prompt complexity</em></li><li><em>Subsequent requests benefit from this warm state</em></li></ul><p>This was a profound “aha!” moment. My timeout failures weren’t random — they were predictable consequences of not understanding model lifecycle management.</p><h3>Building Educational/ Learning Infrastructure</h3><p>Rather than just fixing my benchmark, I realized this discovery was so fundamental that I needed to build comprehensive educational tools. This led to the creation of hello_llm_explained.py, a 5-step diagnostic system that teaches the concepts interactively:</p><h4><strong>Step 1: Basic Connection Testing</strong></h4><ul><li><em>Validates network connectivity to Ollama</em></li><li><em>Checks service availability and response parsing</em></li><li><em>Establishes baseline communication patterns</em></li></ul><h4><strong>Step 2: Model Availability Analysis</strong></h4><ul><li><em>Queries available models on disk</em></li><li><em>Parses model metadata (size, modification dates)</em></li><li><em>Distinguishes between “available” and “loaded” states</em></li></ul><h4><strong>Step 3: Memory Loading Status Detection</strong></h4><ul><li><em>Real-time query of models currently in RAM</em></li><li><em>Memory usage monitoring and unload scheduling</em></li><li><em>Visual indicators for cold vs warm states</em></li></ul><h4><strong>Step 4: Cold/Warm Concept Education</strong></h4><ul><li><em>Analogies comparing model loading to software startup</em></li><li><em>Performance expectation setting for different scenarios</em></li><li><em>Best practices for production deployment</em></li></ul><h4><strong>Step 5: Live Performance Demonstration</strong></h4><ul><li><em>Real-time timing measurements with user observation</em></li><li><em>Before/after comparisons showing dramatic differences</em></li><li><em>Practical implications for application design</em></li></ul><p>This learning approach proved invaluable. Instead of just memorizing “models can be cold or warm,” I built a deep, experiential understanding of LLM operational characteristics.</p><h3>Specialized Analysis with cold_warm_benchmark.py</h3><p>To complement the educational module, I created cold_warm_benchmark.py for focused performance analysis. This tool explicitly measures the cold start penalty by:</p><ol><li><strong>Current State Assessment:</strong> Testing immediate performance to establish baseline</li><li><strong>Warm State Verification:</strong> Multiple consecutive requests to measure consistent warm performance</li><li><strong>Overhead Calculation:</strong> Quantifying the exact cost of cold starts</li><li><strong>Production Planning:</strong> Providing data for capacity planning and user experience design</li></ol><p>The results were illuminating. With the model already warm, I achieved consistent 1–3 second response times. The 20–30 second delays weren’t inherent to the model’s reasoning capability — they were entirely infrastructure overhead that could be managed with proper system design.</p><h3>The Comprehensive Overhaul: From Amateur to Professional</h3><h4>Recognizing the Need for Systematic Optimization</h4><p>With deep understanding of model behavior, I faced a choice: accept the limitations and work around them, or engineer a comprehensive solution that addressed the root causes. I chose the latter, embarking on what became a complete architectural overhaul of my LLM interaction system.</p><p>The transformation involved three integrated strategies, each addressing a different aspect of production-grade LLM applications.</p><h4>Strategy 1: Intelligent Model State Management</h4><p>I implemented a ModelStateManager class that brings intelligence to model lifecycle awareness:</p><pre>class ModelStateManager:<br>    def __init__(self):<br>        self.is_warm = False<br>        self.warmup_time = None<br>    <br>    def check_model_state(self):<br>        &quot;&quot;&quot;Proactive model state detection with user guidance&quot;&quot;&quot;<br>        response = requests.get(f&quot;{OLLAMA_BASE_URL}/api/ps&quot;)<br>        loaded_models = response.json().get(&quot;models&quot;, [])<br>        self.is_warm = any(model.get(&quot;name&quot;) == MODEL for model in loaded_models)<br>        <br>        if self.is_warm:<br>            console.print(&quot;🟢 Model is WARM (loaded in memory)&quot;, style=&quot;green&quot;)<br>            return &quot;warm&quot;<br>        else:<br>            console.print(&quot;🔴 Model is COLD (not loaded)&quot;, style=&quot;red&quot;)<br>            return self._handle_cold_state()<br>    <br>    def _handle_cold_state(self):<br>        &quot;&quot;&quot;Intelligent cold state handling with user choice&quot;&quot;&quot;<br>        console.print(&quot;\n🔥 Model Warmup Options:&quot;, style=&quot;bold yellow&quot;)<br>        console.print(&quot;  1. Continue with cold start (measure real-world performance)&quot;)<br>        console.print(&quot;  2. Warm up model first (optimize for consistent benchmarking)&quot;)<br>        <br>        choice = input(&quot;Choose 1 or 2 (or press Enter for 1): &quot;).strip() or &quot;1&quot;<br>        return self.warmup_model() if choice == &quot;2&quot; else &quot;cold&quot;</pre><p>This approach transforms blind API calling into intelligent system interaction. Instead of hoping for good performance, the system knows exactly what to expect and can make informed decisions about how to proceed.</p><h4>Strategy 2: Adaptive Timeout Management</h4><p>Static timeouts are the enemy of reliable systems. A 30-second timeout might work for warm requests but fail for cold starts. A 60-second timeout might handle cold starts but unnecessarily delay error detection for simple failures.</p><p>I implemented an AdaptiveTimeoutManager that learns from performance history:</p><pre>class AdaptiveTimeoutManager:<br>    def __init__(self):<br>        self.cold_timeout = 45    # First request with model loading<br>        self.warm_timeout = 15    # Subsequent requests<br>        self.performance_history = []<br>    <br>    def get_timeout(self, is_first_request: bool, model_state: str) -&gt; int:<br>        &quot;&quot;&quot;Context-aware timeout calculation&quot;&quot;&quot;<br>        if model_state == &quot;cold&quot; and is_first_request:<br>            return self.cold_timeout<br>        elif self.performance_history:<br>            # Adaptive based on recent performance<br>            avg_time = sum(self.performance_history) / len(self.performance_history)<br>            return max(int(avg_time * 1.5), self.warm_timeout)<br>        else:<br>            return self.warm_timeout<br>    <br>    def record_success(self, latency_seconds: float):<br>        &quot;&quot;&quot;Performance learning for adaptive optimization&quot;&quot;&quot;<br>        self.performance_history.append(latency_seconds)<br>        # Keep only recent measurements for adaptation<br>        if len(self.performance_history) &gt; 5:<br>            self.performance_history.pop(0)</pre><p>This system eliminates arbitrary timeout failures while maintaining fast error detection. It learns from successful requests to calibrate expectations and adapts to changing system conditions over time.</p><h4>Strategy 3: Development Workflow Orchestration</h4><p>Professional development requires professional tooling. Instead of manually running individual scripts and trying to remember which tool does what, I created dev_workflow.py as a central command hub:</p><pre>def main_menu():<br>    &quot;&quot;&quot;Development workflow orchestration&quot;&quot;&quot;<br>    console.print(Panel(<br>        &quot;🛠️  Week 1 LLM Development Workflow\n&quot;<br>        &quot;Orchestrates your benchmark tools for efficient development&quot;,<br>        title=&quot;Strategy 3: Workflow Orchestration&quot;,<br>        border_style=&quot;bold blue&quot;<br>    ))<br>    <br>    while True:<br>        console.print(&quot;\n📋 Available Tools:&quot;, style=&quot;bold cyan&quot;)<br>        console.print(&quot;  1. quick-test     - Fast connection check (30s)&quot;)<br>        console.print(&quot;  2. basic-bench    - Original hello_llm.py&quot;)  <br>        console.print(&quot;  3. enhanced-bench - Enhanced with strategies 1&amp;2&quot;)<br>        console.print(&quot;  4. explained      - Deep dive learning module&quot;)<br>        console.print(&quot;  5. cold-warm      - Explicit cold vs warm comparison&quot;)<br>        console.print(&quot;  6. compare-all    - Run multiple benchmarks and compare&quot;)<br>        console.print(&quot;  7. system-status  - Check Ollama and model status&quot;)<br>        <br>        choice = input(&quot;\nChoose tool: &quot;).strip().lower()<br>        # Tool execution logic...</pre><p>This orchestration layer provides:</p><ul><li><strong><em>Quick iteration:</em></strong><em> 30-second connectivity tests for rapid development cycles</em></li><li><strong><em>Tool selection:</em></strong><em> Right tool for the right analysis need</em></li><li><strong><em>Progress tracking:</em></strong><em> Visual feedback on what’s working and what needs attention</em></li><li><strong><em>Knowledge preservation:</em></strong><em> Built-in documentation of what each tool provides</em></li></ul><h3>The Dramatic Results: 9.1x Performance Revolution</h3><h4>Before vs After: A Production Transformation</h4><p>The combined impact of all three strategies created results that exceeded my expectations:</p><p><strong>Before Optimization:</strong></p><ul><li><em>Average latency: 26,158ms (26+ seconds per request)</em></li><li><em>Success rate: 33% (67% timeout failures)</em></li><li><em>Total benchmark time: 78.5 seconds</em></li><li><em>User experience: Completely unusable</em></li></ul><p><strong>After Optimization:</strong></p><ul><li><em>Average latency: 2,878ms (2.9 seconds per request)</em></li><li><em>Success rate: 100% (zero timeout failures)</em></li><li><em>Total benchmark time: 8.6 seconds</em></li><li><em>User experience: Professional, responsive, reliable</em></li></ul><h4><strong>The transformation: 9.1x faster performance with 100% reliability.</strong></h4><p><strong>Beyond Speed: Professional Development Capabilities</strong></p><p>The performance improvement, while dramatic, was just one benefit. The real value came from developing production-grade LLM engineering capabilities:</p><p><strong>Model Lifecycle Mastery:</strong> Understanding that LLMs have distinct operational phases with predictable performance characteristics. This knowledge applies to any LLM deployment, from local Ollama to cloud-based inference servers.</p><p><strong>Adaptive System Design:</strong> Building systems that learn from their environment and adapt behavior accordingly. This pattern extends far beyond timeouts to any aspect of system optimization.</p><p><strong>Workflow Engineering:</strong> Creating tools that amplify developer productivity rather than just solving point problems. The dev_workflow.py orchestration approach scales to manage complexity as systems grow.</p><p><strong>Production Readiness:</strong> Implementing reliability patterns (intelligent timeouts, state management, comprehensive error handling) that are essential for any user-facing AI application.</p><h3>Learning Goals and Long-Term Vision</h3><h4>The Local AI Agent System Master Plan</h4><p>Week 1’s LLM API mastery serves a crucial role in my 8-week journey to build a complete local AI agent system. The foundation I’ve established — reliable, fast, well-understood LLM communication — will support every subsequent capability:</p><p><strong>Week 2: Prompt Craft</strong> will build on this foundation to develop sophisticated prompt engineering techniques using Jupyter notebooks, Chain-of-Thought reasoning, and ReAct patterns.</p><p><strong>Week 3: Structured Outputs &amp; Tools</strong> will leverage reliable API communication to implement tool calling and structured data exchange.</p><p><strong>Week 4: Vector RAG</strong> will combine LLM queries with vector database searches for document-aware responses.</p><p><strong>Week 5: Agent v1</strong> will orchestrate multiple components using LangGraph for autonomous task execution.</p><p><strong>Weeks 6–7: Observability &amp; Security</strong> will add production monitoring and safety guardrails.</p><h3>Current Progression Assessment</h3><p><strong>Technical Capabilities Gained:</strong></p><ul><li>✅ <strong>Production LLM Integration:</strong> Reliable, fast, monitored API communication</li><li>✅ <strong>Performance Engineering:</strong> 9.1x optimization through systematic analysis</li><li>✅ <strong>Development Workflow:</strong> Professional tooling for efficient iteration</li><li>✅ <strong>System Understanding:</strong> Deep knowledge of LLM operational characteristics</li></ul><p><strong>Professional Skills Developed:</strong></p><ul><li><strong>Problem Diagnosis:</strong> Moving beyond symptoms to root cause analysis</li><li><strong>Educational Tooling:</strong> Building learning resources that teach concepts comprehensively</li><li><strong>Architectural Thinking:</strong> Designing systems for reliability, not just functionality</li><li><strong>Workflow Automation:</strong> Creating tools that amplify rather than replace developer insight</li></ul><h3>Next Goals: Week 2 and Beyond</h3><p><strong>Immediate Priority: Prompt Engineering Mastery</strong> My next focus shifts from “how to call LLMs” to “how to communicate with them effectively.” Week 2 will involve:</p><ul><li><em>Installing Jupyter and Continue extensions for interactive development</em></li><li><em>Mastering Chain-of-Thought and ReAct prompting patterns</em></li><li><em>Building a reusable prompt library in YAML format</em></li><li><em>Developing techniques for consistent, reliable prompt performance</em></li></ul><p><strong>Medium-Term Objectives:</strong></p><ul><li><strong>Tool Integration:</strong> Building FastAPI microservices that LLMs can call</li><li><strong>Knowledge Management:</strong> Implementing RAG systems for document-aware AI</li><li><strong>Agent Architecture:</strong> Creating autonomous task execution capabilities</li><li><strong>Production Deployment:</strong> Full observability, security, and deployment automation</li></ul><p><strong>Long-Term Vision:</strong> By Week 8, I’ll have a completely local AI agent system that rivals cloud-based solutions in capability while maintaining 100% data privacy and zero ongoing costs. This system will serve as the foundation for any AI project I build going forward, providing a template for production-grade local AI development.</p><h3>Conclusion: From API Calls to AI Engineering</h3><p>Week 1 transformed what began as simple HTTP requests into a comprehensive understanding of production LLM engineering. The journey from 67% timeout failures to 100% reliability with 9.1x performance improvement taught me that the difference between amateur and professional AI development lies not in using fancier models or more complex algorithms, but in understanding the fundamental operational characteristics of the systems we’re building.</p><p>The educational infrastructure I created — hello_llm_explained.py, cold_warm_benchmark.py, and dev_workflow.py—represents more than just problem-solving tools. They embody a philosophy of building understanding alongside capability, ensuring that technical improvements are grounded in deep comprehension rather than trial-and-error optimization.</p><p>As I progress through the remaining weeks of this journey, the solid foundation of Week 1 will enable increasingly sophisticated capabilities while maintaining the reliability and performance standards that separate hobby projects from production systems. The goal isn’t just to build a local AI agent — it’s to master the entire discipline of local AI engineering, creating capabilities that will serve as the foundation for any AI project I undertake in the future.</p><p>The next article will dive into Week 2’s prompt engineering adventures, where I’ll explore how to unlock the full potential of the reliable LLM communication system I’ve now mastered.</p><blockquote>This article is part of my comprehensive documentation of building a production-grade local AI agent system. Follow along as I progress through 8 weeks of intensive AI engineering, sharing detailed insights, code, and lessons learned at each step. You can follow me on <a href="https://x.com/numustafa_1">X</a> and <a href="https://github.com/numustafa/Agentic-AI/tree/main/local_agents">Githuib</a>.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f39ed4a654b0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Breaking Through the Agentic AI Information Overload: Week 0]]></title>
            <link>https://numustafa.medium.com/breaking-through-the-agentic-ai-information-overload-week-0-a397a1289388?source=rss-86c9b5840c74------2</link>
            <guid isPermaLink="false">https://medium.com/p/a397a1289388</guid>
            <category><![CDATA[llm-applications]]></category>
            <category><![CDATA[agents]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[agentic-workflow]]></category>
            <dc:creator><![CDATA[Naveed Ul Mustafa]]></dc:creator>
            <pubDate>Fri, 06 Jun 2025 17:40:41 GMT</pubDate>
            <atom:updated>2025-06-06T17:40:41.937Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yN3s9h58bLleeiNJZRwEow.png" /></figure><h3>The Overwhelm is Real: Why I Started This Journey</h3><p>If you’ve been following the AI space for the past year, you know the feeling. Every morning brings a new breakthrough, another “revolutionary” agentic AI framework, and countless LinkedIn posts about ChatGPT replacing entire industries. The FOMO (Fear of Missing Out) is crushing, especially when you’re a developer who wants to understand and build with these technologies rather than just consume them.</p><p>I fell into this trap hard. For months, I consumed every piece of content about agentic AI I could find. I subscribed to a dozen AI newsletters, bookmarked hundreds of articles, and watched countless YouTube videos explaining how LangChain, AutoGEN, and CrewAI were going to change everything. I attended AI meetups in Berlin, where brilliant minds discussed multi-agent systems and autonomous reasoning capabilities that seemed light-years ahead of anything I could build.</p><p>But here’s the problem with information overconsumption: it creates an illusion of progress while actually preventing real learning. I was drowning in concepts — ReAct frameworks, tool calling, vector databases, embedding models — without understanding how any of it actually worked under the hood. The more I read, the more overwhelming it became. Where do you even start when everyone assumes you already know the basics?</p><p>The turning point came during a particularly intense week where I bookmarked 47 different AI articles and attended two virtual conferences. I realized I had spent more time consuming content about AI than most people spend actually building with it. I was suffering from what I now call “tutorial hell” for the AI era — endless consumption without creation.</p><p>That’s when I made a decision that changed everything: I was going to stop reading and start building. But not just any building — I wanted to create a comprehensive, systematic approach to mastering agentic AI development from the ground up. I needed a plan that would take me from confused consumer to confident creator.</p><h3>The Plan: An 8-Week Systematic Approach to Local AI Mastery</h3><p>After weeks of research paralysis, I developed what I call the “Ship Local Agent” roadmap — an 8-week intensive program designed to build production-ready agentic AI systems without cloud dependencies. The philosophy was simple: if I’m going to learn AI development, I want complete control over my stack, my data, and my deployment environment.</p><h4>Why Local-First AI Development?</h4><p>The decision to go local-first wasn’t just about avoiding cloud costs (though that was a factor). Here’s why I chose this approach:</p><p><strong><em>1. Complete Understanding:</em></strong> When you run everything locally, you can’t hide behind abstraction layers. You have to understand how the pieces fit together.</p><p><strong><em>2. Data Privacy:</em></strong> No external APIs means no data leaving your machine. This is crucial for any future commercial applications.</p><p><strong><em>3. Cost Control:</em></strong><em> </em>Cloud AI services can get expensive quickly. Local development lets you experiment freely without watching a billing meter.</p><p><strong><em>4. Deployment Flexibility:</em></strong> Code that works locally can be deployed anywhere — edge devices, on-premises servers, or cloud infrastructure.</p><p><strong><em>5. Learning Depth:</em></strong> You can’t truly understand agentic AI without understanding the underlying infrastructure that makes it possible.</p><h4>The 8-Week Roadmap Breakdown</h4><p><strong>Loop A (Weeks 0–7): “Ship Local Agent”</strong></p><ul><li><em>Week 0: Environment Setup &amp; LLM Integration</em></li><li><em>Week 1: Raw LLM API Programming</em></li><li><em>Week 2: Prompt Engineering &amp; Techniques</em></li><li><em>Week 3: Structured Outputs &amp; Tool Building</em></li><li><em>Week 4: Vector RAG Implementation</em></li><li><em>Week 5: Agent Architecture with LangGraph</em></li><li><em>Week 6: Observability &amp; Testing</em></li><li><em>Week 7: Security, Guardrails &amp; Release</em></li></ul><p><strong>Loop B (Weeks 8–13): Deep-Dive Sprints</strong> <em>Six focused sprints on advanced topics like async optimization, hybrid search, memory systems, and model routing.</em></p><p><strong>Loop C (Optional): Frontier Exploration</strong> <em>Experimental spikes into edge computing, voice/vision agents, robotics integration, and advanced prompt optimization.</em></p><h4>Learning Goals and Success Metrics</h4><p>My primary learning objectives were:</p><ol><li><strong><em>Master VS Code for AI Development:</em></strong> Become proficient with dev containers, extensions, and integrated debugging workflows</li><li><strong><em>Understand LLM Infrastructure:</em></strong> Learn how to run, optimize, and interface with local language models</li><li><strong><em>Build Production-Ready Systems:</em></strong> Create observable, testable, and secure AI applications</li><li><strong><em>Develop Systematic Thinking:</em></strong><em> </em>Move beyond tutorials to architectural understanding</li><li><strong><em>Establish Sustainable Practices:</em></strong><em> </em>Create workflows that scale from personal projects to enterprise systems</li></ol><p>The success metric was simple: by the end of 8 weeks, I should be able to deploy a complete agentic AI system that can reason, use tools, access knowledge bases, and operate autonomously — all running on my local machine.</p><h3>Week 0: The Foundation That Changes Everything</h3><p>Week 0 was titled “Prep,” but it turned out to be far more significant than basic setup. This week taught me that environment configuration isn’t just a prerequisite — it’s a fundamental skill that determines everything that comes after.</p><h4>The Challenge: Building a Reproducible AI Development Environment</h4><p>The goal seemed straightforward: create a development environment that could run AI workloads consistently across different machines and operating systems. But as anyone who’s worked with Python dependencies, Docker networking, and LLM integrations knows, “straightforward” is often anything but.</p><p>I was working on a Windows machine with WSL2, which added an interesting layer of complexity. The challenge wasn’t just getting things to work — it was getting them to work reliably, reproducibly, and in a way that would scale as my projects grew more complex.</p><h4>Technical Architecture: What I Actually Built</h4><p>The final architecture looked like this:</p><pre>Windows Host Machine<br>├── WSL2 (Ubuntu)<br>│   ├── VS Code Server<br>│   └── Docker Engine<br>├── Ollama Service (running Qwen3-8B)<br>└── VS Code Client (Windows)<br>    └── Dev Container (Python 3.11 + Node.js + Git + UV)<br>        └── Connected to Ollama via host.docker.internal:11434</pre><h4>This setup provides several crucial advantages:</h4><ol><li><strong><em>Isolation:</em></strong><em> All development happens in containers, eliminating “works on my machine” problems</em></li><li><strong><em>Reproducibility:</em></strong><em> Anyone can clone my repository and get an identical environment</em></li><li><strong><em>Flexibility:</em></strong><em> Easy to swap between different Python versions, dependencies, or even entire stacks</em><strong><em>.</em></strong></li><li><strong><em>Performance:</em></strong><em> Local LLM inference with direct hardware access</em><strong><em>.</em></strong></li><li><strong><em>Integration:</em></strong><em> Seamless connection between containerized development and host-based AI services</em></li></ol><h4>The Learning Curve: What Actually Happened</h4><p>What I thought would be a 2-hour setup turned into a 2-day deep dive into container networking, Docker internals, and LLM service management. Here’s what I learned:</p><p><strong>Docker Networking Mysteries</strong></p><p>The biggest challenge was getting my dev container to communicate with Ollama running on the host machine. This seems simple until you realize that container networking creates multiple layers of abstraction:</p><ul><li>localhost inside a container refers to the container itself, not the host</li><li>Standard Docker bridge networks create IP isolation</li><li>Windows/WSL adds additional networking complexity</li></ul><p>The solution — using host.docker.internal:11434—seems obvious in retrospect, but discovering it required understanding how Docker Desktop handles host communication on different platforms.</p><p><strong>LLM Service Management</strong></p><p>Running Ollama locally taught me about LLM lifecycle management:</p><ul><li>Models are large (8GB for Qwen3) and take time to load</li><li>Services can auto-start when running interactive sessions</li><li>API servers need to be accessible but secure</li><li>Resource usage (CPU, memory) needs monitoring and optimization</li></ul><p><strong>VS Code Dev Container Magic</strong></p><p>The most transformative discovery was how powerful VS Code dev containers can be for AI development:</p><ul><li>Extensions automatically install and configure in containers</li><li>Port forwarding works seamlessly</li><li>Debugging works across container boundaries</li><li>The integrated terminal provides direct container access</li></ul><h4>Performance Insights: Running 8B Models on Consumer Hardware</h4><p>One of the most interesting aspects of Week 0 was testing local LLM performance on consumer hardware. My setup (AMD Ryzen 5 6550U, 32GB RAM, no GPU) provided fascinating insights into what’s possible without enterprise-grade equipment:</p><p><strong><em>Model Loading:</em></strong><em> The Qwen3–8B model takes approximately 45–60 seconds to load into memory on first request. Subsequent requests are much faster since the model stays resident.</em></p><p><strong><em>Inference Speed:</em></strong><em> CPU-only inference delivers 2–5 tokens per second, which is adequate for development and testing but highlights why GPU acceleration is valuable for production workloads.</em></p><p><strong><em>Memory Usage:</em></strong><em> The quantized model uses approximately 6–8GB of RAM, leaving plenty of headroom for development tools and other applications.</em></p><p><strong><em>Thermal Management:</em></strong><em> Extended inference sessions cause CPU temperatures to rise, but modern thermal management keeps everything stable.</em></p><p>These metrics proved that serious AI development is absolutely possible on consumer hardware, especially for learning, prototyping, and small-scale applications.</p><h4>Unexpected Discoveries and Insights</h4><p>Week 0 revealed several insights that weren’t obvious from tutorials or documentation:</p><p><strong>Container-First Development is Superior for AI: </strong>Traditional Python virtual environments feel primitive compared to full container isolation. Containers provide dependency isolation, service integration, and deployment consistency that virtual environments can’t match.</p><p><strong>Local LLMs Change Development Workflow: </strong>Having an LLM running locally changes how you think about AI integration. Instead of treating AI as an external service, it becomes part of your development stack — like a database or cache.</p><p><strong>Network Configuration is Critical: </strong>The difference between a working and non-working AI development environment often comes down to network configuration. Understanding container networking isn’t optional — it’s fundamental.</p><p><strong>Resource Management Matters: </strong>Running LLMs locally forces you to think about resource usage in ways that cloud APIs abstract away. This understanding becomes crucial when optimizing for production deployments.</p><h3>Current Progress and Next Steps</h3><h4>What I’ve Mastered</h4><p>After completing Week 0, I have:</p><ul><li>A fully functional, reproducible AI development environment</li><li>Working integration between containerized development and local LLM services</li><li>Understanding of Docker networking and VS Code dev container workflows</li><li>Performance baseline for local LLM inference on consumer hardware</li><li>Foundation for building more complex AI applications</li></ul><h4>Immediate Next Steps: Week 1 Goals</h4><p>Week 1 focuses on “Raw LLM API” programming, where I’ll:</p><ol><li><strong><em>Build Async HTTP Clients:</em></strong><em> Use </em><em>httpx to create efficient, non-blocking LLM API clients</em></li><li><strong><em>Implement Benchmarking:</em></strong><em> Create systematic latency and throughput measurements</em></li><li><strong><em>Develop Error Handling:</em></strong><em> Build robust retry logic and failure recovery</em></li><li><strong><em>Create the </em></strong><strong><em>hello_llm.py Foundation:</em></strong><em> Establish the codebase that will grow into a full agent system</em></li></ol><h4>Medium-Term Objectives (Weeks 2–7)</h4><p>The remaining weeks of Loop A will progressively build complexity:</p><ul><li><strong><em>Week 2:</em></strong><em> Master prompt engineering techniques and save reusable templates</em></li><li><strong><em>Week 3:</em></strong><em> Build structured outputs using Pydantic and create the first tool (weather service)</em></li><li><strong><em>Week 4:</em></strong><em> Implement vector RAG with pgvector and LangChain</em></li><li><strong><em>Week 5:</em></strong><em> Create the first complete agent using LangGraph</em></li><li><strong><em>Week 6:</em></strong><em> Add comprehensive observability with OpenTelemetry and Jaeger</em></li><li><strong><em>Week 7:</em></strong><em> Implement security guardrails and package for deployment</em></li></ul><h4>Long-Term Vision</h4><p>By the end of this journey, I aim to have:</p><ol><li><strong><em>A Production-Ready Agent System:</em></strong><em> Complete with observability, security, and deployment automation</em></li><li><strong><em>Deep Technical Understanding:</em></strong><em> Not just how to use AI tools, but how they work internally</em></li><li><strong><em>Systematic Development Process:</em></strong><em> Reproducible workflows for building AI applications</em></li><li><strong><em>Community Contribution:</em></strong><em> Documentation and code that helps others avoid the information overwhelm I experienced</em></li></ol><h3>The Broader Implications: Why This Approach Matters</h3><p>Week 0 taught me that the current state of AI education has a fundamental problem: there’s too much focus on using existing tools and not enough on understanding underlying systems. Most tutorials show you how to call an API or use a framework, but they don’t teach you how to build robust, production-ready systems from first principles.</p><p>The local-first, container-based approach I’m taking addresses several industry needs:</p><p><strong><em>1. Skills Gap:</em></strong><em> There’s a huge gap between AI researchers and practical AI engineers. This approach builds both theoretical understanding and practical skills.</em></p><p><strong><em>2. Vendor Independence:</em></strong><em> Too many AI applications depend on external APIs that can change pricing, availability, or functionality without notice.</em></p><p><strong><em>3. Data Security:</em></strong><em> Many organizations can’t or won’t send sensitive data to external AI services.</em></p><p><strong><em>4. Cost Predictability:</em></strong><em> Cloud AI costs can scale unpredictably. Local inference provides cost certainty.</em></p><p><strong><em>5. Deployment Flexibility:</em></strong><em> Applications that work locally can be deployed anywhere, from edge devices to enterprise data centers.</em></p><h3>Conclusion: From Information Consumer to AI Builder</h3><p>Week 0 represented more than just environment setup — it was a mindset shift from consuming information about AI to actively building AI systems. The technical challenges I solved (container networking, LLM integration, development workflow optimization) taught me that the path to AI mastery isn’t through reading more articles — it’s through hands-on building and systematic learning.</p><p>The 47 bookmarked articles I accumulated during my information consumption phase are still sitting in my browser, mostly unread. But the single week I spent actually building taught me more about practical AI development than months of passive consumption.</p><p>For anyone feeling overwhelmed by the AI information flood, my advice is simple: stop reading and start building. Pick a systematic approach, commit to a timeline, and focus on creating rather than consuming. The industry needs more builders and fewer consumers.</p><p>My Week 0 foundation is solid, my Week 1 goals are clear, and for the first time in months, I feel like I’m making real progress rather than just staying informed. The journey from AI consumer to AI builder starts with a single docker run command and the commitment to build something real.</p><p>The future of AI development isn’t just about having access to better models — it’s about understanding how to build robust, observable, and secure systems that can adapt and scale. Week 0 taught me that this future is accessible to anyone willing to move beyond consumption and embrace systematic building.</p><p>Next week, I’ll be diving into async HTTP programming and LLM benchmarking. The foundation is solid, and the real building begins now.</p><blockquote><strong>Invitation</strong>:<br>“If you’re curious about developing with AI, give some focus on learning underlying concepts, and keep a production-first approach! Feel free to reach out with questions or show off your own local LLM experiments. It’s amazing how far you can go without ever leaving your machine.”</blockquote><p>This is a first article in my quest of developing with AI. My primary learning resource is my schedule and topics related to achievable objects. You can follow me on <a href="https://x.com/numustafa_1">X</a> and <a href="https://github.com/numustafa/Agentic-AI/tree/main/local_agents">Githuib</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a397a1289388" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unplugging the Cloud: My Journey Running LLMs Locally with Ollama]]></title>
            <link>https://numustafa.medium.com/unplugging-the-cloud-my-journey-running-llms-locally-with-ollama-faacd75d17e7?source=rss-86c9b5840c74------2</link>
            <guid isPermaLink="false">https://medium.com/p/faacd75d17e7</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[llmops]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Naveed Ul Mustafa]]></dc:creator>
            <pubDate>Mon, 17 Feb 2025 21:24:22 GMT</pubDate>
            <atom:updated>2025-02-17T21:24:22.897Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i0NDxiPzKT32sn8bkAQZ6A.png" /><figcaption><strong>DALL-E prompt:</strong> A friendly llama wearing a small headset, sitting at a desk, intently focused on a black laptop screen. The laptop screen , displays a progress bar and an ‘Ollama’ logo, indicating a large language model is being downloaded. The setting should be lighthearted and slightly cartoonish, with soft, warm lighting. The llama appears determined, as if learning or working on a project. Detailed fur texture, neutral background with subtle tech elements in the surroundings., wide aspect ratio</figcaption></figure><blockquote>When I first heard I could download and run a large language model right on my own Windows machine — no expensive GPU required — I was both skeptical and thrilled. Could this really replace my reliance on cloud APIs? Meet <strong>Ollama</strong>, a tool that changed how I think about local AI inference!</blockquote><h3>What Is Ollama?</h3><p><strong>Ollama</strong> is an open-source tool built on top of llama.cpp, specifically designed for <strong>local LLM model management</strong>. It handles everything from downloading models to serving them on your machine. Think of it as your personal gateway to powerful language models — without having to hand over your data or your wallet to cloud providers.</p><p>I first stumbled upon Ollama while taking a <a href="https://www.youtube.com/watch?v=nJ25yl34Uqw&amp;t=5s">GenAI </a>course from FCC, where we were exploring alternatives to cloud-based solutions. Tools like <strong>LangChain</strong> and <strong>Hugging Face</strong> are powerful, but they can feel heavy for local experimentation or come with hidden cloud costs and data privacy concerns. Enter Ollama, which:</p><ul><li><strong>Automates</strong> the process of finding, downloading, and updating model files.</li><li><strong>Abstracts</strong> away different model formats (GGML, Safetensors, etc.) — just say “use Llama 2,” and it pulls everything needed.</li><li><strong>Provides</strong> local inference via the command line or a simple API endpoint on your own infrastructure.</li></ul><h3>My Environment Setup</h3><p>I’m running a <strong>Windows machine</strong> with:</p><ul><li><strong>32 GB RAM</strong></li><li><strong>2.70 GHz AMD Ryzen 7 PRO processor (8 cores, 16 logical processors)</strong></li><li><strong>Integrated graphics</strong> (so, practically no fancy GPU for heavy AI tasks)</li></ul><p>Because Ollama can run quantized models, I didn’t need a high-end GPU. Here’s how I set things up:</p><ul><li>I installed the Windows version of Ollama (available for Mac &amp; Linux too), then used <strong>Windows Powershell </strong>to access it. This is because its a counsole on and doesnt have any interface. This makes things much easier to integrate.</li></ul><p><strong>VS Code + WSL</strong></p><ul><li>I rely on Visual Studio Code with the Remote — <a href="https://www.youtube.com/watch?v=bRW5r7TK6KM&amp;t=1s">WSL extension</a>. This way, I can edit scripts in VS Code but run them in my Linux environment under WSL. It’s a smooth workflow, the best of both worlds! This setup lets me keep my Windows environment for other tasks while still enjoying the Linux command-line tooling.</li></ul><h3>Getting Ollama Running</h3><h4>Step 1: Download Ollama</h4><p>Go to the <a href="https://ollama.com/">Ollama</a> website(or GitHub) and grab the <strong>setup file</strong> for your platform (macOS, Windows, or Linux). Since I’m on Windows, I installed the Windows build. It’s a console-based utility with no graphical interface, which actually keeps it lightweight.</p><pre>ollama</pre><h4>Step 2: Choose a Model</h4><p>Ollama supports a range of LLMs. I chose <strong>Deepseek r1 (1.5B parameters)</strong> — one of the smaller models — to ensure smooth performance on my CPU. A handful of other models I considered (though some are heavier) include Qwen, Llama3.2-vision, Gemma, Mistral, etc.</p><blockquote><strong>Personal Note</strong>:<br>“I was excited to see so many open-source models available. But remember, bigger isn’t always better — sometimes you want a model that can run seamlessly on your hardware without crashes or delays.”</blockquote><pre>ollama run deepseek-r1:1.5b</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b8dh0zdTfBcx8-W6X_6qiw.png" /><figcaption>snip of a model download</figcaption></figure><p>Additionally, I choose to deploy a vision model which was quite heavy on my machine, however, it develops a perspective on how to interact with the model locally. The model I used was <strong>llama3.2-vision 11b</strong>, which was 7.8 GB, much higher threshold for my machine. Later, when used the models during simple code execution, each (simple) quarry took more than 10 seconds for Deepseek model and took more than 20 second for llama3.2-vision model.</p><pre>ollama pull llama3.2-vision</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cal5j0EBA8_KL7zl_tRKww.png" /><figcaption>snip of a model download</figcaption></figure><h3>Integration with VS Code + WSL</h3><p>Since I’m a heavy VS Code user:</p><ol><li><strong>Remote — WSL Extension: </strong>I opened my WSL folder in VS Code and wrote Python scripts to query the local Ollama endpoint.</li><li><strong>Debug &amp; Iterate: </strong>I could quickly test different prompts or parameter settings (like temperature, top_p, etc.) in my Python code without leaving the editor.</li></ol><blockquote><strong>Personal Tip</strong>:<br>“Having everything in one place — my code in VS Code, the model running via WSL — felt like a supercharged local dev environment. No more bouncing between a web UI or an external API console.”</blockquote><p>This is a code for chat.py, which is using a deepseek model on a local system.</p><pre>import os<br>import ollama<br><br>print(&quot;Hello, Ollama!&quot;)<br>print(&quot;Current directory files:&quot;, os.listdir(&#39;.&#39;))<br><br>try:<br>    response = ollama.chat(<br>        model=&#39;deepseek-r1:1.5b&#39;,<br>        messages=[{<br>            &#39;role&#39;: &#39;user&#39;,<br>            &#39;content&#39;: &#39;What is in the name of last Ottoman King?&#39;<br>        }]<br>    )<br>    print(&quot;Response received:&quot;)<br>    print(response)<br>except Exception as e:<br>    print(&quot;Error during ollama.chat:&quot;, e)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2_rfPsG4QFakFqZID7s5AQ.png" /><figcaption>snip of a chat.py response</figcaption></figure><p>This is a code for image.py, which is using llama3.2-vision model.</p><pre>import os<br>import ollama<br><br>print(&quot;Hello, Ollama!&quot;)<br>print(&quot;Current directory files:&quot;, os.listdir(&#39;.&#39;))<br><br>try:<br>    response = ollama.chat(<br>        model=&#39;llama3.2-vision&#39;,<br>        messages=[{<br>            &#39;role&#39;: &#39;user&#39;,<br>            &#39;content&#39;: &#39;What is in this image?&#39;,<br>            &#39;images&#39;: [&#39;image.jpg&#39;]  # Make sure this file exists<br>        }]<br>    )<br>    print(&quot;Response received:&quot;)<br>    print(response)<br>except Exception as e:<br>    print(&quot;Error during ollama.chat:&quot;, e)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_VAhUSGVy39MxPAZnVrayA.png" /><figcaption>snip of image.py</figcaption></figure><h3>The “Wow” Factor: Hands-On Interactions</h3><ul><li><strong>Performance Surprise</strong>: Even on integrated graphics, the quantized model performed decently, generating coherent text at a reasonable speed.</li><li><strong>Data Privacy</strong>: I realized mid-prompt how satisfying it is that all my queries stay local. If I want to feed it sensitive text — like internal docs — I can do so without second thoughts.</li><li><strong>No Cloud Costs</strong>: No more worrying about racking up bills on paid inference APIs.</li></ul><h3><strong>Potential Use Cases &amp; Next Steps</strong></h3><p>Now that I’ve experienced the convenience and security of running an LLM locally, I can’t help but imagine all the practical applications Ollama could unlock. At the simplest level, you could spin up a <strong>local chatbot or assistant</strong> — perhaps for internal IT troubleshooting or employee FAQs — where every query remains safely on your own infrastructure. If you often deal with large text files, consider building a <strong>document summarization tool</strong> that ingests PDFs, Word docs, or text dumps and returns concise bullet points, all without sending content to any external server.</p><p>For more technical users, there’s the option of a <strong>developer assistant</strong>, where Ollama can generate boilerplate code or provide refactoring suggestions directly in your IDE. Meanwhile, if your organization’s knowledge is scattered across wikis, databases, and PDFs, a <strong>Knowledge Base Q&amp;A</strong> system powered by a local LLM could streamline search and retrieval, keeping proprietary information off the cloud. On the creative side, you could craft an <strong>AI-powered writing assistant</strong> to help your marketing team draft blog posts, newsletters, or social media copy — again, all behind your own firewall. And lastly, for those in customer-facing roles, a <strong>customer support chatbot</strong> that integrates with CRM systems locally could handle basic inquiries, schedule appointments, or provide FAQ responses while adhering to strict data-protection regulations.</p><p>What excites me most is how all these ideas can be deployed on your own terms — no monthly inference fees, no third-party storing of your data, and the flexibility to tweak or replace the underlying models whenever you want. It’s a refreshing departure from the typical “hosted AI” paradigm, making Ollama an intriguing option for small businesses, hobbyists, or even larger organizations looking to keep critical data strictly on-premises.</p><h3><strong>Lessons Learned &amp; Tips</strong></h3><p>Throughout my local LLM journey, I learned a handful of best practices that can make or break your experience. First off, <strong>hardware considerations</strong> are crucial: even though Ollama leverages quantized models to reduce memory usage, you still want a decent CPU and sufficient RAM to avoid slowdowns or crashes — bigger models demand bigger resources. Next, <strong>prompt engineering</strong> emerged as a game-changer; how you frame your queries often determines whether the output is mediocre or spot-on. I found it helpful to version-control prompts, adjusting them over time for improved consistency. While Ollama doesn’t natively support fine-tuning, <strong>prompt tuning</strong> can still achieve specialized results by incorporating domain-specific context into your queries or system prompts. On the <strong>security and privacy</strong> front, I appreciated that all data stays in-house, but I still took care to secure my local endpoint — especially if exposing it to a local network. Meanwhile, <strong>monitoring and logging</strong> are key if you’re running experiments at scale; tracking response times, CPU usage, and prompt patterns can reveal bottlenecks or highlight prompt improvements. Finally, for those planning to deploy Ollama beyond a personal workstation, <strong>containerization</strong> (like Docker or Kubernetes) can simplify scaling and updates, ensuring that your local LLM ecosystem remains stable, consistent, and easy to maintain.</p><h3>Conclusion &amp; Invitation</h3><p><strong>Final Thoughts</strong></p><ul><li><strong>Simplicity</strong>: Ollama’s centralized model download and serving make local LLM usage surprisingly smooth.</li><li><strong>Flexibility</strong>: Whether it’s Llama 2, Deepseek, or Qwen, you choose your model — no one-size-fits-all approach.</li><li><strong>Data Control &amp; Cost</strong>: By running locally, you keep data private and avoid cloud API costs.</li></ul><blockquote><strong>Invitation</strong>:<br>“If you’re curious about harnessing AI on your own turf, give Ollama a spin! Feel free to reach out with questions or show off your own local LLM experiments. It’s amazing how far you can go without ever leaving your machine.”</blockquote><blockquote>This is a first article in my quest of getting to know more about GenAI. My primary learning resource is <a href="https://www.youtube.com/watch?v=nJ25yl34Uqw&amp;t=5s">FreeCodeCamp</a>. You can follow me on <a href="https://x.com/numustafa_1">X</a> and <a href="https://github.com/numustafa">Githuib</a>.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=faacd75d17e7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding the Basics of Deep Learning]]></title>
            <link>https://numustafa.medium.com/understanding-the-basics-of-deep-learning-b6ed740d1756?source=rss-86c9b5840c74------2</link>
            <guid isPermaLink="false">https://medium.com/p/b6ed740d1756</guid>
            <category><![CDATA[books]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[concept]]></category>
            <dc:creator><![CDATA[Naveed Ul Mustafa]]></dc:creator>
            <pubDate>Tue, 06 Aug 2024 10:59:59 GMT</pubDate>
            <atom:updated>2024-10-12T15:09:17.566Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k-tnSBPf2xMdYSv5pC-Vhw.png" /><figcaption>from ChatGPT</figcaption></figure><h3>Background</h3><p>Artificial Intelligence (AI) is a rapidly growing field with significant developments occurring in various sectors. Recent advancements, such as ChatGPT models, have made large language models (LLMs) a part of everyday discussions. Similarly, applications like DALLE, based on diffusion models, demonstrate the progress in AI capabilities. The 21st century has seen remarkable evolution in AI, with intelligent software performing tasks that were previously challenging for humans, including understanding speech, recognizing images, and making medical diagnoses.</p><p>Earlier AI systems relied on hard-coded software rules to solve specific tasks that were difficult for humans, such as performing monotonous tasks accurately, following complex mathematical rules without interruption, and minimizing errors. However, modern AI systems are designed to solve tasks that come naturally to humans but are hard to formalize, such as recognizing spoken words and understanding images and videos.</p><h3>Hierarchy of Concepts</h3><p>Modern AI systems need to learn from experiences and understand tasks objectively in a “<em>hierarchy of concepts</em>.” Unlike earlier AI systems that required extensive human intervention to hard-code rules, today’s AI systems can autonomously gather knowledge and learn from it by extracting patterns from raw data. The “hierarchy of concepts” approach allows AI systems to learn complex ideas by building a conceptual map, where each idea is defined through its relation to simpler concepts. This depth of understanding is why we refer to this approach as “<em>deep learning</em>.”</p><h3>From Machine Learning to Deep Learning</h3><p>Machine learning is the broader concept of learning from patterns, and deep learning is a more sophisticated version of it. Deep learning algorithms handle complex data, sort it, and devise patterns. For instance, while simple machine learning algorithms like regression models can easily handle tabular data, more abstract data, such as images, require deep learning approaches.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*1r52Pd3ktkV5UdoV_Ls9JA.png" /><figcaption>source: <a href="https://www.deeplearningbook.org/contents/intro.html">Deep Learning</a></figcaption></figure><h4><strong><em>Challenges in Feature Engineering</em></strong></h4><p>One major challenge in AI is designing appropriate features for learning algorithms to aid in pattern recognition. Some AI tasks can be solved by creating precise features that help the algorithm make accurate predictions. For example, in speech recognition, defining features related to the speaker’s vocal tract can help the algorithm predict whether the speaker is a child, man, or woman. However, defining features for tasks like identifying a car in a picture is more complex, as the features (e.g., wheels, doors) can vary greatly in appearance.</p><h4><strong><em>Representation Learning</em></strong></h4><p>To improve prediction accuracy and avoid the hassle of defining appropriate features, learning algorithms can be designed to learn the representation of features themselves and map these representations to the output. This approach is known as “<em>representation learning</em>.” Unlike traditional learning algorithms, representation learning algorithms not only learn patterns from features but also discover a good set of features, making this approach more robust and efficient.</p><h3>Neural Networks</h3><p>When designing a representation learning algorithm, the objective is to separate the sources of influence (factors of variation) from the data. In speech recognition, factors of variation might include the speaker’s age, sex, and dialect, while in image recognition, they might include the position, color, or reflection intensity of an object.</p><p>Neural networks, or multilayer perceptrons (MLPs), are advanced approaches that overcome the limitations of traditional representation learning algorithms. A neural network is a mathematical function composed of many simpler functions, mimicking the concept of the “<em>hierarchy of concepts</em>.” As the depth of the network grows, so does its efficiency, as it offers sequential interactions and self-improvement capacity. Each iteration enhances the network’s ability to make more holistic predictions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*iJOUyISkdRhQXHjnvfKxvQ.png" /><figcaption>Flowchart represents comparison of different AI disciplines. source: <a href="https://www.deeplearningbook.org/contents/intro.html">Deep Learning</a></figcaption></figure><h3>Conclusion</h3><p>Deep learning is an advanced approach in AI, drawing inspiration from the human brain, applied mathematics, and statistics. It enables AI systems to learn from experiences, build a hierarchy of concepts, and autonomously improve over time. As AI continues to evolve, deep learning will play a crucial role in developing intelligent systems capable of performing complex tasks with minimal human intervention.</p><blockquote>This is a first article in my quest of getting to know more about deep learning. My primary literature is <a href="https://www.deeplearningbook.org/">Deep Learning by Ian Goodfellow</a>. You can follow me on <a href="https://x.com/numustafa_1">X</a> and <a href="https://github.com/numustafa">Githuib</a>.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b6ed740d1756" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>