<?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 Taha Boussaden on Medium]]></title>
        <description><![CDATA[Stories by Taha Boussaden on Medium]]></description>
        <link>https://medium.com/@tahaboussaden?source=rss-b5f0ce4a47bd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*kE76aO-L08WOJdp30HbfPQ.jpeg</url>
            <title>Stories by Taha Boussaden on Medium</title>
            <link>https://medium.com/@tahaboussaden?source=rss-b5f0ce4a47bd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 14:01:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tahaboussaden/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[Why Context Windows Won’t Solve AI Memory]]></title>
            <link>https://medium.com/@tahaboussaden/why-context-windows-wont-solve-ai-memory-38bfb056417f?source=rss-b5f0ce4a47bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/38bfb056417f</guid>
            <category><![CDATA[memories]]></category>
            <category><![CDATA[context-window]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Taha Boussaden]]></dc:creator>
            <pubDate>Mon, 31 Aug 2026 10:14:16 GMT</pubDate>
            <atom:updated>2026-08-31T10:14:16.456Z</atom:updated>
            <content:encoded><![CDATA[<p>A larger context window gives an AI model more information to work with. It doesn’t give the model a memory system.</p><h3>Introduction</h3><p>AI models have gone from relatively small context windows to hundreds of thousands, and in some cases millions, of tokens.</p><p>That raises an obvious question:</p><p><strong>If we can fit an enormous amount of information into a model’s context, do we still need AI memory?</strong></p><p>The short answer is <strong>yes</strong>, and the reason is simple because context is what the model can access now and memory is what the system decides to preserve for later. So these are related, but they are not the same thing.</p><h3>Context Is a Workspace</h3><p>A context window is the model’s current workspace:</p><pre>Instructions<br>Conversation<br>Retrieved data<br>Tool results<br>       ↓<br>     Context<br>       ↓<br>      LLM</pre><p>Increasing its size allows more information to be processed at once. But it doesn’t decide:</p><ul><li>what matters</li><li>what should persist</li><li>what should be retrieved</li><li>what should be updated</li><li>what should be forgotten</li></ul><p>That’s a memory problem.</p><h3>Why “Just Put Everything in Context” Doesn’t Scale</h3><p>Putting the entire history into every request seems straightforward, but three problems appear quickly:</p><ul><li><strong>Cost:</strong> More context means more tokens processed.</li><li><strong>Latency:</strong> Larger inputs increase inference overhead.</li><li><strong>Noise:</strong> Old decisions, abandoned approaches, and irrelevant information compete with what actually matters.</li></ul><p>The goal isn’t to give the model <strong>more</strong> informations, but to give it the <strong>right</strong> ones.</p><p>A million-token context also doesn’t mean a model will use every token equally effectively. Long-context systems can exhibit phenomena such as <strong>“lost in the middle”</strong>, where information buried inside a large context is harder to retrieve.</p><pre>more context ≠ better memory</pre><p>A larger window gives the model a bigger workspace, however it doesn’t improve the system’s ability to manage information.</p><h3>Context Is Not Persistent Memory</h3><p>Context is temporary.</p><p>If information isn’t stored outside the current interaction, it doesn’t automatically become available to the next one.</p><pre>Conversation 1 → Context → LLM</pre><pre>Conversation 2 → New Context → LLM<br>                         ↑<br>                    Memory Store</pre><p>Memory provides persistence and retrieval across multiple interactions, and this distinction becomes critical for long running systems.</p><h3>Memory Is More Than Storage</h3><p>Calling a vector database “memory” is also an oversimplification.</p><p>Storing information is only one part of the problem. A useful memory system needs to determine what is worth keeping, how it should be represented, when it should be retrieved, whether it is still valid, and when it should be discarded.</p><p>Consider:</p><pre>&quot;the project might use MongoDB.&quot;</pre><pre>&quot;the project officially uses PostgreSQL.&quot;</pre><p>Both can exist in storage, but only one may represent the current state.</p><p>Memory therefore involves <strong>information management over time</strong>, not simply persistence and this is also why raw conversation history is often a poor long-term representation.</p><pre>experience<br>    ↓<br>raw history<br>    ↓<br>important facts / decisions / lessons<br>    ↓<br>compact memory</pre><p>The objective isn’t to remember everything.</p><p>It’s to preserve what remains useful.</p><h3>RAG Isn’t Memory</h3><p><a href="https://tahaboussaden.me/blog/rag-complete-practical-guide">RAG</a> retrieves external information and puts it into the model’s context.</p><pre>Query → Retrieval → Relevant data → Context → LLM</pre><p>Memory can use the same retrieval mechanisms, but introduces another layer of reasoning:</p><blockquote><em>What should have been remembered in the first place?</em></blockquote><p>An agent might extract an architectural decision from an interaction, store it, and retrieve it months later.</p><p>RAG can therefore be part of a memory system, but retrieval alone isn’t memory.</p><h3>Why This Matters for Agents</h3><p>An <a href="https://tahaboussaden.me/blog/agents">agent</a> doesn’t just answer a request. It plans, uses tools, observes results, updates state, and continues operating across tasks.</p><pre>Agent<br>        ┌──────┼──────┐<br>        ↓      ↓      ↓<br>      Tools  Memory  State<br>        └──────┼──────┘<br>               ↓<br>            Context<br>               ↓<br>              LLM</pre><p>A large context helps an agent reason about the <strong>current task</strong>.</p><p>Memory gives it <strong>continuity across tasks</strong>.</p><h3>The Real Problem</h3><p>As context windows grow, the question changes.</p><p>We started with:</p><blockquote><strong><em>How much information can we fit into the context?</em></strong></blockquote><p>Now we need to ask:</p><blockquote><strong><em>Which information belongs in the context?</em></strong></blockquote><p>And eventually:</p><blockquote><strong><em>What information should the system remember?</em></strong></blockquote><p>That’s the real memory problem. Bigger context gives AI a bigger workspace but a better memory will give it continuity.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=38bfb056417f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Git History Contains More Intelligence Than We Use: Building GitIntel]]></title>
            <link>https://medium.com/@tahaboussaden/why-git-history-contains-more-intelligence-than-we-use-building-gitintel-978c6ce4a31e?source=rss-b5f0ce4a47bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/978c6ce4a31e</guid>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[gitintel]]></category>
            <category><![CDATA[cli]]></category>
            <dc:creator><![CDATA[Taha Boussaden]]></dc:creator>
            <pubDate>Tue, 18 Aug 2026 08:54:20 GMT</pubDate>
            <atom:updated>2026-08-18T08:54:20.623Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6dDWs_8LpaHQNx50P_jLsA.jpeg" /><figcaption>GitIntel’s logo</figcaption></figure><h3>Why Git History Contains More Intelligence Than We Use</h3><p>Every software project has a story.</p><p>Not just the story written in documentation or tickets, but the story hidden inside thousands of commits:</p><ul><li>Which parts of the codebase change the most?</li><li>Which developers understand specific areas of the system?</li><li>Where are the risky files accumulating complexity?</li><li>How has the architecture evolved over time?</li><li>What patterns appear when looking beyond individual commits?</li></ul><p>Most developers interact with Git every day, but usually only through a small set of commands:</p><pre>git status<br>git add<br>git commit<br>git log<br>git diff</pre><p>These commands are extremely powerful, but they mostly answer one question:</p><blockquote><em>“What happened?”</em></blockquote><p>I wanted to explore a different question:</p><blockquote><em>“What can we learn from everything that happened?”</em></blockquote><p>That idea became <strong>GitIntel</strong>.</p><p>GitIntel is a developer tool that analyzes Git repositories and extracts engineering intelligence from repository history, contributors, ownership, and code evolution patterns.</p><p>The goal is simple:</p><p>Turn raw Git history into useful insights.</p><h3>The Problem: Git Stores Data, But Developers Rarely Analyze It</h3><p>Git repositories contain an incredible amount of information.</p><p>Every commit contains:</p><ul><li>who made a change</li><li>when it happened</li><li>which files were modified</li><li>how much code changed</li><li>how the project evolved over time</li></ul><p>Over months or years, this creates a detailed historical record of the project.</p><p>The problem is that this information is difficult to explore manually.</p><p>Running:</p><pre>git log</pre><p>on a large repository can show thousands of commits.</p><p>Running:</p><pre>git diff</pre><p>shows changes, but not the bigger picture.</p><p>Traditional Git tools are excellent for version control, but they are not designed for repository intelligence.</p><p>They help answer:</p><blockquote><em>“What changed in this commit?”</em></blockquote><p>But engineering teams often need answers like:</p><ul><li>“Which files are becoming unstable?”</li><li>“Who owns critical parts of the system?”</li><li>“Where is most development happening?”</li><li>“Which areas deserve more attention?”</li><li>“How has the codebase evolved?”</li></ul><p>This is where GitIntel comes in.</p><h3>Introducing GitIntel</h3><p>GitIntel is a Git repository intelligence tool designed to analyze software evolution.</p><p>Instead of looking at commits individually, it studies the repository as a system.</p><p>The idea is:</p><pre>Git repository<br>       |<br>       v<br>Repository analysis engine<br>       |<br>       v<br>Engineering insights<br>       |<br>       v<br>Reports and visual summaries</pre><p>GitIntel helps developers understand:</p><ul><li>repository evolution</li><li>contributor activity</li><li>code ownership</li><li>modification patterns</li><li>development hotspots</li></ul><p>It is built for developers who want deeper visibility into their projects.</p><p>Possible users include:</p><ul><li>software engineers joining existing projects</li><li>maintainers of open-source repositories</li><li>engineering teams analyzing large codebases</li><li>developers interested in software archaeology</li></ul><h3>How GitIntel Works</h3><p>At a high level, GitIntel follows a simple workflow:</p><pre>Repository<br>    |<br>    |<br>    v<br>Git analysis layer<br>    |<br>    |<br>    +--&gt; Commit history<br>    |<br>    +--&gt; Contributors<br>    |<br>    +--&gt; File changes<br>    |<br>    +--&gt; Ownership information<br>    |<br>    v<br>Analysis engine<br>    |<br>    v<br>Reports</pre><h3>Repository Analysis</h3><p>The first step is understanding the repository itself.</p><p>GitIntel inspects:</p><ul><li>Git metadata</li><li>commit history</li><li>file changes</li><li>contributor information</li></ul><p>This creates the foundation for deeper analysis.</p><h3>Commit History Parsing</h3><p>Commits are the building blocks of repository evolution.</p><p>GitIntel analyzes:</p><ul><li>commit frequency</li><li>changed files</li><li>modification size</li><li>contributor activity</li></ul><p>Instead of treating commits as isolated events, it looks for patterns.</p><p>For example:</p><p>A file modified hundreds of times by many contributors may indicate:</p><ul><li>an important system component</li><li>architectural instability</li><li>a potential refactoring opportunity</li></ul><h3>Contributor Intelligence</h3><p>Git repositories naturally contain information about developer involvement.</p><p>GitIntel analyzes contributor activity to understand:</p><ul><li>who contributes most frequently</li><li>which areas developers modify</li><li>how knowledge is distributed</li></ul><p>This can help answer questions like:</p><blockquote><em>“Who has the most context about this part of the codebase?”</em></blockquote><h3>Code Ownership Insights</h3><p>Ownership is not always documented.</p><p>A repository may not have a clear ownership file, but history reveals patterns.</p><p>By analyzing modifications, GitIntel can estimate:</p><ul><li>primary contributors for files</li><li>areas of expertise</li><li>ownership distribution</li></ul><p>This can be useful during:</p><ul><li>onboarding</li><li>code reviews</li><li>maintenance planning</li></ul><h3>Code Change Patterns</h3><p>Not all changes have the same meaning.</p><p>GitIntel looks at repository evolution to identify patterns such as:</p><ul><li>frequently modified files</li><li>active development areas</li><li>historical hotspots</li></ul><p>This provides a different perspective than simply reading the current code.</p><h3>Technical Implementation</h3><p>GitIntel is built with Python and designed as a developer-first CLI tool.</p><p>The main goals were:</p><ul><li>simple installation</li><li>clear terminal output</li><li>modular architecture</li><li>future extensibility</li></ul><p>The architecture is organized around separate responsibilities:</p><pre>gitintel<br>│<br>├── git<br>│   ├── repository handling<br>│   ├── commits<br>│   └── diffs<br>│<br>├── analysis<br>│   ├── contributors<br>│   ├── ownership<br>│   └── hotspots<br>│<br>├── reports<br>│   ├── terminal output<br>│   └── markdown reports<br>│<br>└── cli<br>    └── commands</pre><h3>Design Decisions</h3><h3>Using Git Data Instead of External Tracking Systems</h3><p>Many engineering analytics tools require:</p><ul><li>integrations</li><li>dashboards</li><li>external databases</li></ul><p>GitIntel starts from the source of truth:</p><p>The repository itself.</p><p>The repository already contains valuable historical information.</p><h3>Modular Analysis System</h3><p>Each analysis component is independent.</p><p>For example:</p><ul><li>contributor analysis</li><li>ownership analysis</li><li>change analysis</li></ul><p>can evolve separately.</p><p>This makes it easier to add future capabilities.</p><h3>Developer-Friendly CLI</h3><p>A developer tool should be enjoyable to use.</p><p>GitIntel focuses on:</p><ul><li>readable output</li><li>clear commands</li><li>useful summaries</li></ul><p>Example:</p><pre>gitintel analyze .</pre><p>should provide meaningful information without requiring complicated configuration.</p><h3>Key Features</h3><h3>Repository Analysis</h3><h3>What it does</h3><p>Analyzes repository history and extracts development information.</p><h3>Why it matters</h3><p>Large repositories often contain years of hidden knowledge.</p><p>GitIntel helps reveal that knowledge.</p><h3>Contributor Analysis</h3><h3>What it does</h3><p>Examines developer activity across repository history.</p><h3>Example use case</h3><p>A new engineer joins a project and wants to understand:</p><ul><li>who works on authentication</li><li>who maintains the API layer</li><li>who knows the database code</li></ul><h3>Ownership Insights</h3><h3>What it does</h3><p>Determines which contributors are strongly associated with different parts of the codebase.</p><h3>Example use case</h3><p>Before changing a critical module:</p><p>“Who should review this change?”</p><h3>Change Analysis</h3><h3>What it does</h3><p>Tracks how code evolves over time.</p><h3>Example use case</h3><p>Finding files that constantly change and may require redesign.</p><h3>Example Usage</h3><h3>Installation</h3><pre>pip install gitintel</pre><h3>Analyze a Repository</h3><p>Navigate to a Git repository:</p><pre>cd my-project</pre><p>Run:</p><pre>gitintel analyze .</pre><p>Example output:</p><pre>╭──────────────────────────────────────────────────────────────────────────────────────── GitIntel Analysis ─────────────────────────────────────────────────────────────────────────────────────────╮<br>│ Repository: GitIntel                                                                                                                                                                               │<br>│ Owner: ThePhoenix77                                                                                                                                                                                │<br>│ Branch: main                                                                                                                                                                                       │<br>│ Path: /Users/taha/me/t/GitIntel                                                                                                                                                                    │<br>│ Source: GitHub                                                                                                                                                                                     │<br>│ Remote: git@github.com:ThePhoenix77/GitIntel.git                                                                                                                                                   │<br>╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯<br>         Repository Summary         <br>┏━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓<br>┃ Metric        ┃ Value            ┃<br>┡━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩<br>│ Commits       │ 16               │<br>│ Contributors  │ 2                │<br>│ Files Changed │ 92               │<br>│ Last Commit   │ 2026-08-17 01:16 │<br>└───────────────┴──────────────────┘<br>              Top Contributors              <br>┏━━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━┳━━━━━━━┓<br>┃ Contributor    ┃ Commits ┃ Files ┃ Share ┃<br>┡━━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━╇━━━━━━━┩<br>│ Boussaden Taha │ 11      │ 60    │ 68.8% │<br>│ ThePhoenix77   │ 5       │ 85    │ 31.2% │<br>└────────────────┴─────────┴───────┴───────┘<br>                Most Changed Files                 <br>┏━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━┓<br>┃ File                  ┃ Changes ┃ Lines Changed ┃<br>┡━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━┩<br>│ README.md             │ 5       │ 188           │<br>│ mkdocs.yml            │ 4       │ 304           │<br>│ docs/assets/logo.png  │ 3       │ 0             │<br>│ .gitignore            │ 3       │ 110           │<br>│ CHANGELOG.md          │ 3       │ 22            │<br>│ CONTRIBUTING.md       │ 3       │ 82            │<br>│ docs/DOCUMENTATION.md │ 3       │ 114           │<br>│ docs/NOTES.md         │ 3       │ 0             │<br>│ pyproject.toml        │ 3       │ 91            │<br>│ .github/docs.yml      │ 2       │ 130           │<br>└───────────────────────┴─────────┴───────────────┘<br>               Repository Health               <br>┏━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┓<br>┃ Area        ┃ Status ┃ Details              ┃<br>┡━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━┩<br>│ Activity    │ [OK]   │ Low change frequency │<br>│ Ownership   │ [OK]   │ 2 contributors       │<br>│ Maintenance │ [OK]   │ Recently updated     │<br>└─────────────┴────────┴──────────────────────┘</pre><p>The goal is not to replace Git.</p><p>It is to reveal information hidden inside Git.</p><h3>What I Learned Building GitIntel</h3><p>Building GitIntel changed the way I think about repositories.</p><p>A repository is not just a collection of files.</p><p>It is a historical system.</p><p>Every commit represents:</p><ul><li>a decision</li><li>a collaboration</li><li>a problem solved</li><li>an architectural change</li></ul><p>Some interesting engineering challenges were:</p><h3>Turning Raw Data Into Useful Information</h3><p>Git provides a lot of information, but raw data is not intelligence.</p><p>The difficult part is deciding:</p><p>“What insights are actually useful for developers?”</p><h3>Designing Useful Metrics</h3><p>Not every metric matters.</p><p>A good developer tool should avoid overwhelming users.</p><p>The challenge is finding the balance between:</p><ul><li>depth</li><li>simplicity</li><li>actionable results</li></ul><h3>Developer Onboarding Assistant</h3><p>Helping new developers understand unfamiliar codebases faster.</p><p>Example:</p><p>“Give me an overview of this repository and the important modules.”</p><h3>Advanced Code Ownership Intelligence</h3><p>Improving ownership analysis with:</p><ul><li>expertise scoring</li><li>knowledge distribution</li><li>review recommendations</li></ul><h3>Engineering Analytics</h3><p>Providing deeper insights into:</p><ul><li>development patterns</li><li>repository health</li><li>code evolution</li></ul><h3>Explore GitIntel</h3><p>Interested in exploring repository intelligence or contributing to the project?</p><p>Here are the main resources:</p><ul><li><strong>PyPI Package:</strong></li></ul><p><a href="https://pypi.org/project/gitintel/">https://pypi.org/project/gitintel/</a></p><ul><li><strong>GitHub Repository:</strong></li></ul><p>Explore the source code, report issues, and contribute:<br><a href="https://github.com/ThePhoenix77/GitIntel">https://github.com/ThePhoenix77/GitIntel</a></p><ul><li><strong>Documentation:</strong></li></ul><p>Learn how GitIntel works, explore guides, and find usage examples:<br><a href="https://thephoenix77.github.io/GitIntel/">https://ThePhoenix77.github.io/GitIntel/</a></p><p>Feedback, ideas, and contributions are always welcome.</p><h3>Conclusion</h3><p>Git repositories contain much more information than most developers use.</p><p>They are not only storage systems for code.</p><p>They are historical records of engineering decisions.</p><p>GitIntel explores that hidden layer by transforming repository history into useful intelligence.</p><p>The goal is not to replace the developers understanding of their codebase.</p><p>It is to help them understand it faster.</p><p>If you are interested in developer tools, Git internals, software engineering analytics, or open-source projects, I would love for you to try GitIntel, explore the ideas behind it, and contribute.</p><p>The future of software development will not only depend on writing code faster.</p><p>It will also depend on understanding the code we already have.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=978c6ce4a31e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Model Weights]]></title>
            <link>https://medium.com/@tahaboussaden/model-weights-d774d934f609?source=rss-b5f0ce4a47bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/d774d934f609</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[model-weights]]></category>
            <dc:creator><![CDATA[Taha Boussaden]]></dc:creator>
            <pubDate>Mon, 27 Jul 2026 07:28:13 GMT</pubDate>
            <atom:updated>2026-07-27T07:28:13.582Z</atom:updated>
            <content:encoded><![CDATA[<p>They’re just numbers, until they aren’t.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*adgUNDO2BsDDx-0AYhF8Tw.png" /></figure><h3>Introduction</h3><p>When people discuss modern AI models, terms like <em>weights</em>, <em>parameters</em>, and <em>billions of parameters</em> appear constantly. A model might be described as having 7 billion, 70 billion, or even hundreds of billions of parameters, yet many explanations stop at saying that these are simply “numbers learned during training.” While technically correct, that definition does little to explain what those numbers actually represent or why they are responsible for everything a model knows.</p><p>In this article, I’ll be explaining briefly what model weights are, how they are learned, and why they are the foundation of every modern neural network.</p><h3>What Are Model Weights?</h3><p>A model weight is a learnable numerical value associated with the connection between neurons. Its purpose is to determine how strongly one piece of information influences another during computation.</p><p>For example, suppose a neuron receives two inputs:</p><pre>Temperature = 36<br>Humidity = 88<br>weight₁ = 0.9<br>weight₂ = 0.3</pre><p>Although both inputs reach the neuron, the temperature contributes much more to the final output because its weight is larger. If the weights were reversed, the neuron’s behavior would also change.</p><p>This illustrates an important idea: weights control the influence of information flowing through the network. Every prediction made by a neural network is ultimately determined by the combined effect of millions or billions of these weighted connections.</p><h3>Architecture vs Weights</h3><p>A neural network consists of two fundamental components:</p><p>The architecture, which defines how information flows through the network. And the model weights, which define what the network has learned.</p><p>The architecture is designed by engineers before training begins. It specifies the layers, attention mechanisms, activation functions, and mathematical operations that the model will perform. However, the architecture itself contains no knowledge.</p><p>Imagine downloading the source code of a language model while deleting all of its weights. The model would still execute the same mathematical operations, but it would no longer understand language, recognize patterns, or generate meaningful responses. The architecture defines how the model processes information, while the weights determine what it knows.</p><h3>How Are Weights Learned?</h3><p>A newly created neural network begins with randomly initialized weights. At this stage, the model has not learned anything and its predictions are effectively random.</p><p>Training gradually improves these weights through an iterative optimization process:</p><pre>The model receives an input.<br>    │<br>    ▼<br>It produces a prediction.<br>    │<br>    ▼<br>A loss function measures the prediction error.<br>    │<br>    ▼<br>Backpropagation computes how each weight contributed to that error.<br>    │<br>    ▼<br>An optimizer, such as Gradient Descent or Adam, updates the weights to reduce future errors.</pre><p>This process is repeated millions or billions of times so the neural network continuously adjusts its weights until they encode statistical patterns that allow it to make increasingly accurate predictions.</p><h3>How Are Model Weights Stored?</h3><p>Weights are typically stored as floating point numbers such as FP32, FP16, or BF16. Since every weight occupies memory, model size grows almost linearly with the number of parameters.</p><p>For example, a model with 7 billion FP32 weights requires approximately 28 GB of storage because each FP32 value occupies four bytes.</p><p>When downloading a model in formats such as SafeTensors, GGUF, or PyTorch checkpoints, most of the file consists of these learned numerical values, along with a small amount of metadata describing the model.</p><p>Techniques such as quantization reduce the precision of these weights to decrease memory usage and accelerate inference while preserving most of the model’s accuracy.</p><h3>Conclusion</h3><p>Model weights are the learned numerical values that encode the knowledge of a neural network. While the architecture defines how information is processed, the weights determine how the model responds to every input.</p><p>Every capability of a modern AI system, from language understanding and image recognition to reasoning and code generation, ultimately emerges from billions of learned weights that have been optimized through training. Individually, a weight is simply a number. Collectively, these numbers form the knowledge that transforms a mathematical architecture into an intelligent model.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d774d934f609" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tokens]]></title>
            <link>https://medium.com/@tahaboussaden/tokens-c0a3a787a36a?source=rss-b5f0ce4a47bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0a3a787a36a</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[tokenization]]></category>
            <category><![CDATA[token]]></category>
            <dc:creator><![CDATA[Taha Boussaden]]></dc:creator>
            <pubDate>Fri, 10 Jul 2026 16:26:12 GMT</pubDate>
            <atom:updated>2026-07-10T16:28:30.708Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e9-WsWXYyhSTW8BrAmulgA.png" /></figure><h3>Introduction</h3><p>Although we interact with LLMs using natural language, these models never processes raw text directly. Before a prompt reaches the model, it is converted into a sequence of <strong>tokens</strong>, the fundamental units that the model understands.</p><p>Tokenization is one of the earliest stages of the inference pipeline and influences everything from context windows and API pricing to latency and memory usage.</p><h3>What Is a Token?</h3><p>A <strong>token</strong> is the smallest unit of text processed by a language model, it is <strong>not</strong> necessarily a word. Depending on the tokenizer, a token may represent:</p><ul><li>an entire word</li><li>part of a word</li><li>punctuation</li><li>whitespace</li><li>numbers</li><li>symbols</li><li>emojis</li></ul><p>Different models use different tokenizers, so the same text may be split differently depending on the model.</p><h3>Why Tokens?</h3><p>Simply because language models operate on numbers, not text. Before the transformer can perform any computation, the input must be converted into a numerical representation.</p><p>The preprocessing pipeline looks like this:</p><pre>Raw Text<br>    │<br>    ▼<br>Tokenizer<br>    │<br>    ▼<br>Tokens<br>    │<br>    ▼<br>Token IDs<br>    │<br>    ▼<br>Embedding Layer<br>    │<br>    ▼<br>Embedding Vectors<br>    │<br>    ▼<br>Transformer</pre><p>The tokenizer splits the input into tokens and each token is then mapped to a unique integer called a <strong>token ID</strong>, which are passed through the model’s embedding layer, which converts them into dense vectors that become the actual input to the transformer.</p><h3>A Real Example</h3><p>Instead of using hypothetical examples, let’s look at how OpenAI’s tokenizer processes text.</p><p>Input:</p><pre>I have no enemies.</pre><p>OpenAI tokenizes it to:</p><pre>[&quot;I&quot;, &quot; have&quot;, &quot; no&quot;, &quot; enemies&quot;, &quot;.&quot;]</pre><p>with the following token IDs:</p><pre>[40, 679, 860, 33974, 13]</pre><p>that have been generated by OpenAI Tokenizer for the “GPT-5.x &amp; O1/3” models.</p><p>The transformer never sees the original sentence, it only receives the corresponding sequence of token IDs.</p><h3>Token IDs</h3><p>After tokenization, every token is replaced with an integer.</p><p>Conceptually:</p><pre>&quot; have&quot;        → 679<br>&quot; no&quot;          → 860<br>&quot; enemies&quot;     → 33974</pre><p>The exact numbers differ between models because each tokenizer has its own vocabulary, as these integers are <strong>not</strong> meaningful by themselves, they simply act as indices into the model’s embedding table.</p><h3>From Tokens to Predictions</h3><p>Once converted into embeddings, the transformer begins inference.</p><p>At each generation step, the model predicts the probability distribution of the <strong>next token</strong>.</p><p>The predicted token is appended to the existing sequence, and the process repeats until a stopping condition is reached.</p><pre>Prompt<br>   │<br>   ▼<br>Tokenizer<br>   │<br>   ▼<br>Token IDs<br>   │<br>   ▼<br>Embeddings<br>   │<br>   ▼<br>Transformer<br>   │<br>   ▼<br>Predict Next Token<br>   │<br>   ▼<br>Append Token<br>   │<br>   └──────────────┐<br>                  ▼<br>              Repeat</pre><p>This autoregressive loop is how every modern decoder-only LLM generates text.</p><h3>Try It Yourself</h3><blockquote><strong><em>OpenAI Tokenizer:</em></strong><em> </em><a href="https://platform.openai.com/tokenizer"><em>https://platform.openai.com/tokenizer</em></a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0a3a787a36a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Embeddings Magic]]></title>
            <link>https://medium.com/@tahaboussaden/embeddings-magic-d14cf366f5a9?source=rss-b5f0ce4a47bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/d14cf366f5a9</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[vector-database]]></category>
            <category><![CDATA[vector-embeddings]]></category>
            <dc:creator><![CDATA[Taha Boussaden]]></dc:creator>
            <pubDate>Sat, 27 Jun 2026 10:40:35 GMT</pubDate>
            <atom:updated>2026-06-27T10:40:35.049Z</atom:updated>
            <content:encoded><![CDATA[<p>Transforming language into geometry.</p><h3>Introduction</h3><p>Embeddings are one of the most important building blocks of modern AI applications, yet they’re often treated as a black box.</p><p>In this article, I’ll demystify embeddings by exploring what they are, how they are created, and why they make semantic search possible.</p><h3>The Problem With Traditional Search</h3><p>Imagine searching for the phrase:</p><blockquote><em>“How do I reset my password?”</em></blockquote><p>A traditional keyword search looks for exact or similar words. If a document instead says:</p><blockquote><em>“Steps to recover your account credentials”</em></blockquote><p>the search may fail because the wording is completely different.</p><p>Humans immediately recognize that both sentences describe the same intent, but computers on the other hand need a different way to represent meaning, and this is where embeddings come in.</p><h3>What Is an Embedding?</h3><p>An embedding is a dense vector, a list of numbers that represents the semantic meaning of a piece of text. In a more simple way, an array of numerical values usually floating point numbers where almost every position holds meaningful information.</p><p>Instead of treating text as a sequence of characters or words, an embedding model maps it into a high dimensional vector space.</p><p>For example:</p><pre>&quot;cat&quot;<br>↓<br>[0.18, -0.42, 0.91, ...]</pre><p>The numbers themselves have no intuitive meaning.</p><p>What matters is <strong>where</strong> the vector is <strong>located relative</strong> to <strong>other vectors</strong>.</p><h3>Meaning Comes From Position</h3><p>Imagine a map where cities that are geographically close tend to share borders, climates, and transportation links.</p><p>Well embeddings work similarly, texts with similar meanings are placed near one another in vector space.</p><p>For example:</p><pre>Dog<br>      ●<br>Cat<br>      ●<br>Puppy<br>       ●<br><br>Car                         ●<br><br>Engine                       ●<br><br>Truck                          ●</pre><p>The actual space may have hundreds or thousands of dimensions instead of two, but the intuition remains the same, so we conclude that the distance represents semantic similarity.</p><h3>Similar Meaning, Different Words</h3><p>This is where we can see embeddings stenght.</p><p>In these sentences below:</p><ul><li>“Reset my password”</li><li>“Recover my account”</li><li>“Can’t log in”</li><li>“Forgot my credentials”</li></ul><p>They share very few keywords, yet an embedding model places them close together because they express similar ideas.</p><p>This enables semantic search, where results are retrieved based on meaning rather than exact wording.</p><h3>How Similarity Is Measured</h3><p>Once text has been converted into vectors, we need a way to compare them and the most common metric is <a href="https://en.wikipedia.org/wiki/Cosine_similarity">cosine similarity</a>.</p><p>Rather than comparing the individual numbers, cosine similarity measures the angle between two vectors.</p><ul><li>Small angle → highly similar</li><li>Large angle → less similar</li></ul><p>This works surprisingly well because embedding models are trained to organize semantically related content in nearby regions of the vector space.</p><h3>Why Embeddings Matter for RAG</h3><p>Retrieval Augmented Generation (RAG) depends heavily on embeddings, where a typical pipeline looks like this:</p><pre>Documents<br>    │<br>    ▼<br>Embedding Model<br>    │<br>    ▼<br>Vectors Stored in a Vector Database<br>    │<br>    ▼<br>User Query<br>    │<br>    ▼<br>Query Embedding<br>    │<br>    ▼<br>Similarity Search<br>    │<br>    ▼<br>Relevant Documents<br>    │<br>    ▼<br>LLM</pre><p>Notice something important:</p><p>The LLM never searches your documents directly. Instead, it searches the embedding space for documents whose vectors are closest to the query.</p><h3>Conclusion</h3><p>Now that I scratched the surface on how these “numerical representations of text” work. Understanding embeddings is essential for anyone building LLM applications because they power everything from document retrieval to recommendation systems.</p><p>Embeddings real power is not in storing vectors but in organizing them, and that what makes them so effective.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d14cf366f5a9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Habsburg Effect in AI]]></title>
            <link>https://medium.com/@tahaboussaden/the-habsburg-effect-in-ai-a9989143e035?source=rss-b5f0ce4a47bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/a9989143e035</guid>
            <category><![CDATA[habsburg]]></category>
            <category><![CDATA[ai-news]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Taha Boussaden]]></dc:creator>
            <pubDate>Tue, 09 Jun 2026 19:48:46 GMT</pubDate>
            <atom:updated>2026-06-11T22:28:58.021Z</atom:updated>
            <content:encoded><![CDATA[<p>What happens when models learn from models?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*SyQ6ii3w1Oxx9E7zgh1K0w.png" /><figcaption>Charles II d’Espagne (Charles II of Spain)</figcaption></figure><p>Every day, AI is getting better and better at an astonishing pace. Models now are able to write code, summarize research papers and generate art, increasingly contributing to the very internet future models will learn from.</p><p>At first glance this sounds like a progress, but hidden beneath the acceleration lies a subtle and uncomfortable question:</p><blockquote><em>What happens when AI starts learning mostly from AI generated content?</em></blockquote><p>History may offer an unusual but powerful metaphor: the Habsburg dynasty.</p><p>No, this is not an argument that AI is literally becoming “genetically inbred.” Rather, it is a way to think about a dangerous pattern of recursive self reinforcement, a system that increasingly feeds on its own outputs until diversity and originality begin to weaken.</p><p>Welcome to what we might call:</p><blockquote><em>The Habsburg Effect in AI.</em></blockquote><h3>A Brief History of the Habsburg Problem</h3><p>The House of Habsburg became one of Europe’s most powerful royal dynasties, controlling territories across Spain, Austria, and the Holy Roman Empire.</p><p>Their problem was not a lack of power but too much concentration.</p><p>To preserve political alliances, wealth, and bloodlines, generations of intermarriage gradually narrowed genetic diversity. Over time, inherited weaknesses accumulated, adaptability decreased, and the dynasty famously suffered from severe health and developmental problems.</p><p>The most cited symbol of this decline was Charles II of Spain, whose lineage became a case study in the risks of excessive genetic narrowing.</p><p>The lesson was not simply about biology.</p><p>It was about systems:</p><blockquote><em>When diversity shrinks and self reinforcement dominates, fragility grows.</em></blockquote><p>And that idea may matter more to AI than we think.</p><p>Imagine this cycle:</p><pre>Human knowledge<br>      ↓<br>AI model training<br>      ↓<br>AI-generated content floods the web<br>      ↓<br>Future models train on that content<br>      ↓<br>Patterns become reinforced<br>      ↓<br>Novelty and diversity shrink<br>      ↓<br>Quality gradually degrades</pre><p>This is the core idea behind the Habsburg Effect in AI.</p><p>In machine learning, there is already a related concern known as model collapse, where recursively training models on generated outputs can gradually reduce diversity and distort probability distributions. Instead of learning from rich human variation, models may begin learning from compressed approximations of reality. Like photocopying a photocopy where each generation may still look fine, but subtle details disappear.</p><h3>Final Thoughts</h3><p>The Habsburg dynasty decline didn’t happen overnight but was gradual. With small compromises accumulated across generations until fragility became unavoidable. And AI may face a similar challenge. As models increasingly learn from themselves, we may accidentally compress the diversity that made intelligence powerful in the first place.</p><p>And perhaps the most important question to ask is:</p><blockquote><em>How much human diversity can we preserve?</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a9989143e035" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Agents]]></title>
            <link>https://medium.com/@tahaboussaden/agents-d6c56ad8302a?source=rss-b5f0ce4a47bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/d6c56ad8302a</guid>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[llm-agent]]></category>
            <dc:creator><![CDATA[Taha Boussaden]]></dc:creator>
            <pubDate>Sun, 03 May 2026 01:34:28 GMT</pubDate>
            <atom:updated>2026-05-11T10:57:06.278Z</atom:updated>
            <content:encoded><![CDATA[<p>A deterministic system wrapped around a probabilistic core.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yu-lRArHZP40nzvHl0Mj8g.jpeg" /><figcaption>Agent <a href="https://fr.wikipedia.org/wiki/Agent_Smith">Smith</a> from the <a href="https://www.imdb.com/fr/title/tt0242653/">Matrix</a> movie</figcaption></figure><h3>Introduction</h3><p>This article is my point of view on agents with a technical deep dive on them. I’ll be sharing my journey of what I learned on AI agents while building a learning side project, a working AI agent from scratch, decomposing every major component and discussing it all along.</p><p>My goal is to make this agents system more explicit.</p><h3>Defining an AI Agent</h3><p>Before building anything, we need to draw hard boundaries between three commonly conflated systems, which are scripts, chatbots and finally agents.</p><h4>Assumptions</h4><p>You should be comfortable with JavaScript (async/await, APIs), Basic HTTP concepts and JSON data structures.</p><h4>Scripts (Deterministic Program)</h4><p>A script is a just fixed mapping:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/67/0*m_C0WygzrxUH3jo8.png" /></figure><p>- Same input → same output</p><p>- No adaptation</p><p>- No internal state beyond execution context</p><p>for example:</p><pre>function classify(input){<br>  if(input.includes(&quot;error&quot;)) return &quot;bug&quot;;<br>  return &quot;general&quot;;<br>}</pre><p>With no notion of iteration, decision under uncertainty or external tool usage.</p><h4>Chatbots (Single-Step LLM System)</h4><p>A chatbot introduces probabilistic behavior:</p><pre>y ∼ p(y∣x)</pre><p>The output is generated from a probability distribution, so still just a single step with no iterative reasoning loop and no explicit action execution.</p><p>for example:</p><pre>const response = await llm(&quot;Explain recursion simply&quot;);</pre><p>Even with conversation history, this remains a mapping, not a system, with no persistent goal tracking and no structured interaction with the environment.</p><h4>Agent (Iterative, Stateful System)</h4><p>An agent is fundamentally different:</p><pre>at ∼ π(a∣st),<br>st+1=f(st,at,rt)</pre><pre>| Mathematical Term |         Meaning         | Code Representation |<br>| - - - - - - - - - | - - - - - - - - - - - - | - - - - - - - - - - |<br>| ( st )            | Current state           | `state` object      |<br>| ( at )            | Chosen action           | `action` JSON       |<br>| ( rt )            | Tool execution result   | `result`            |<br>| ( \pi )           | Policy (decision model) | `llm()` function    |<br>| ( f )             | State transition        | `updateState()`     |</pre><pre>async function step(state, memory){<br>  const action = await policy(state, memory); // at<br>  const result = await execute(action); // rt<br>  const nextState = updateState(state, result); // s_{t+1}<br>  return { nextState, action, result };<br>}</pre><p>It’s iterative with multi-step execution, stateful maintaining memory across steps and action oriented interacting with tools/environment</p><p>for example:</p><pre>while(!done){<br>  const action = decide(state);<br>  const result = act(action);<br>  state = update(state, result);<br>}</pre><p>This loop is the defining feature, without it you just have a wrapper around an API.</p><h3>Overview</h3><p>I myself, just began learning about AI agents, and this is my very first small one, <a href="https://github.com/ThePhoenix77/tinybot">tinybot</a>:</p><pre>import { groq } from &#39;@ai-sdk/groq&#39;;<br>import { generateText } from &#39;ai&#39;;<br><br>const model = groq(&#39;llama-3.3–70b-versatile&#39;, {<br>  apiKey: &#39;groq api key goes here&#39;,<br>});<br><br>const { text } = await generateText({<br>  model: model,<br>  system: &#39;Answer everything in exactly 3 words.&#39;,<br>  prompt: &#39;What is the meaning of life?&#39;,<br>});<br>console.log(text);</pre><p>tinybot response was:</p><pre>taha@192 tinybot % node tinybot.js<br>Find True Happiness</pre><h4>Why Most AI Agent Tutorials Fall Short</h4><p>For me, I think most tutorials treat AI agents as black boxes, thus creating an over abstraction because of the reliance on frameworks that hide core mechanics.</p><p>Like this:</p><pre>const agent = new Agent({…});<br>await agent.run();</pre><p>And as a result many or some cannot debug failures, extend functionality and reason about performance.</p><h4>A More Precise View</h4><p>At its core, an AI agent can be modeled as a discrete-time control system.</p><p>At each time step t, the agent:</p><p>- Observes a state st</p><p>- Chooses an action at​</p><p>- Receives a result rt</p><p>- Transitions to a new state st+1</p><p>We can express this formally:</p><pre>st+1 = f(st,at,rt)</pre><p>Where:</p><p>- st = current state (input + memory)</p><p>- at = action chosen by the agent</p><p>- rt = result of executing the action</p><p>- f = state transition function</p><h4>State Representation (st)</h4><p>State is the most underexplained part of agent system. Formally, it is everything the agent conditions on:</p><pre>st = (x,mt,ht)</pre><p>Where:</p><p>- x = current input</p><p>- mt= memory (retrieved knowledge)</p><p>- ht= interaction history</p><p>example:</p><pre>const state = {<br>  input: &quot;Find a good fishing rod under $1000&quot;,<br>  memory: […retrievedDocs],<br>  history: […previousSteps]<br>};</pre><p>Key insight:</p><p>- The LLM never “sees” your system, only the serialized state you provide; meaning `Bad state design = bad decisions.`</p><h4>Deterministic System, Probabilistic Core</h4><p>An important distinction is that an agent system (loop, tools, memory) is deterministic and the policy (LLM) is probabilistic.</p><p>We can think of the full system as:</p><pre>Deterministic Runtime + Probabilistic Policy = AI Agent</pre><p>Or more formally:</p><pre>Agent = Runtime(π,T,M)</pre><p>Where:</p><p>- π = policy (LLM)</p><p>- T = set of tools</p><p>- M = memory system</p><h4>Why This Matters</h4><p>This framing is not academic, it just impacts how you build systems, for example if you don’t control st, the agent behaves unpredictably, if you don’t constrain at, the agent may hallucinate actions, and if f is poorly designed, the system becomes unstable.</p><h4>Stateless vs Stateful Systems</h4><p>Stateless, means each decision is independent:</p><pre>at ∼ π(a∣x)</pre><p>- No memory</p><p>- No accumulation of knowledge</p><p>- Limited reasoning depth</p><p>On the other hand in the stateful system decisions depend on history:</p><pre>at ∼ π(a∣st)</pre><p>- Enables multi-step reasoning</p><p>- Allows correction and refinement</p><p>- Introduces complexity (memory growth, noise)</p><p><strong>Code Comparison:</strong></p><p>- Stateless:</p><pre>await llm(&quot;Summarize this article&quot;);</pre><p>- Stateful:</p><pre>await llm(buildPrompt({<br>  input,<br>  history,<br>  retrievedMemory<br>}));</pre><h4>From Theory to Execution: Full Step Trace</h4><p>Let’s walk one iteration concretely:</p><p>Step 1: Initial state</p><pre>state = {<br>  input: &quot;Find a good fishing rod under $1000&quot;,<br>  history: [],<br>  memory: []<br>};</pre><p>Step 2: Policy decision</p><pre>{<br>  &quot;action&quot;: &quot;search_products&quot;,<br>  &quot;args&quot;: { &quot;query&quot;: &quot;fishing rod under 1500&quot; }<br>}</pre><p>Step 3: Tool execution</p><pre>result = [<br>  { name: &quot;Rod 1&quot;, price: 800 },<br>  { name: &quot;Rod 2&quot;, price: 650 }<br>];</pre><p>Step 4: Policy decision</p><pre>{<br>  &quot;action&quot;: &quot;search_products&quot;,<br>  &quot;args&quot;: { &quot;query&quot;: &quot;fishing rod under 1000&quot; }<br>}</pre><p>Step 5: State transition</p><pre>state = {<br>  …state,<br>  history: [<br>    {<br>      action: &quot;search_products&quot;,<br>      result<br>    }<br>  ]<br>};</pre><h4>Key Takeaways</h4><p>- An agent is defined by its loop, not its model</p><p>- State design directly determines decision quality</p><p>- The LLM is just a policy function, not the system itself</p><p>- Determinism is a configuration choice, not a default</p><h3>Core Architecture</h3><p>After defining what an agent, we need to see the structure of this system. The questions we need to answer is</p><p>how do we decompose an agent into components that are modular, testable, and maybe scalable?</p><p>The answer is that an agent can be represented as a composition of interacting modules:</p><pre>Agent = (π,M,T,E)</pre><p>Where:</p><p>- π = policy (LLM decision function)</p><p>- M = memory system</p><p>- T = toolset</p><p>- E = execution runtime (loop + orchestration)</p><h4>Conceptual Architecture</h4><pre>User Input<br>  ↓<br>State Builder (input + memory + history)<br>  ↓<br>Policy (LLM)<br>  ↓<br>Action (JSON)<br>  ↓<br>Tool Executor<br>  ↓<br>Result<br>  ↓<br>Memory Update<br>  ↓<br>Loop (repeat or terminate)</pre><p>How I see it is this conceptual architecture you see above is that its more of a feedback system than a pipeline.</p><h4>Data Flow</h4><p>- State → Policy : Serialize state into a prompt</p><p>- Policy → Action : LLM outputs structured decision</p><p>- Action → Tool : System executes external function</p><p>- Tool → Result : Returns data to agent</p><p>- Result → State Update : Incorporated into next iteration</p><p>Concrete representation:</p><pre>async function agentStep(state, memory){<br>  const prompt = buildPrompt(state, memory);<br>  const action = await llm(prompt); // π(st)<br>  const parsed = parseAction(action); // structured at<br>  const result = await execute(parsed); // T(at)<br>  const nextState = updateState(state, parsed, result); // f(…)<br>  return { nextState, parsed, result };<br>}</pre><h4>Serialization Boundary</h4><p>A serialization boundary is the checkpoint, as for an agent to “packs its bags” to travel across a network or wait in storage it needs to take a formal format, like a JSON, YAML and TOON formats.</p><p>AT the end, the keypoint to remember is that the LLM cannot operate on objects, it operates on text.</p><p>So we define a serialization function:</p><pre>function buildPrompt(state){<br>  return `<br>    You are an agent.<br>    User goal:<br>      ${state.input}<br>    History:<br>      ${JSON.stringify(state.history)}<br>    Available tools:<br>      ${JSON.stringify(toolSchemas)}<br>  `;<br>}</pre><p>Final Verdict: The serialization function is the encoding half of the process and the decoding half happens inside the LLM’s “brain” when it parses your prompt to understand the context.</p><h3>Memory Systems</h3><p>Without memory, the agent reduces to just a stateless function, as it turns an agent from a reactive loop into a system capable of contextual reasoning and personalization.</p><h4>Short Term Memory</h4><p>Short term memory is what you pass directly into the model.</p><p><strong>Implementation:</strong></p><pre>const history = [<br>  {<br>    action: { name: &quot;search_products&quot;, args: { query: &quot;fishing rod&quot; } },<br>    result: [{ name: &quot;Rod 1&quot;, price: 850 }]<br>  }<br>];</pre><p><strong>Injecting into prompt:</strong></p><pre>function buildPrompt(state){<br>  return `<br>    User goal:<br>      ${state.input}<br>    History:<br>      ${JSON.stringify(state.history, null, 2)}<br>  `;<br>}</pre><h4>Long Term Memory</h4><p>Short term memory is insufficient for the agent to remember large documents, user preferences and cross session knowledge; well here persistent memory is introduced.</p><p><strong>Storage Options:</strong></p><p>- Database (PostgreSQL, MongoDB)</p><p>- Vector database (for semantic search)</p><p>- File based storage (simple file systems)</p><p>for example:</p><pre>await db.insert({<br>  userId: &quot;123&quot;,<br>  text: &quot;User prefers Scorpion fishing rods&quot;,<br>  createdAt: Date.now()<br>});</pre><h3>Tooling and Action Execution</h3><p>Memory allows an agent to think with context but tools allow an agent to act on the world.</p><p>With tools, it becomes an interactive system capable of retrieving data, triggering workflows, and producing side effects; and without these tools, an agent is limited to text generation.</p><h4>What Makes a “Tool”</h4><p>A tool is any callable function that:</p><p>- Accepts structured input</p><p>- Performs an operation (internal or external)</p><p>- Returns a result to the agent</p><h4>Examples of Tools</h4><p>- API calls (weather, search, payments)</p><p>- File system operations</p><p>- Computation utilities</p><p>for example:</p><pre>const tools = {<br>    getWeather: async ({ city }) =&gt; {<br>    const res = await fetch(`https://api.weather.com/${city}`);<br>    return res.json();<br>  }<br>};</pre><p>Bare in mind that in tools scope, timeouts matter a lot as without constraints, latency can go endlessly.</p><p>One slow tool can block the entire agent loop.</p><h3>Core Runtime</h3><p>The center of the entire system is the agent loop. Everything we’ve built so far, from policy, memory to tools, only becomes meaningful when orchestrated through a controlled execution loop</p><h4>Minimal loop</h4><pre>async function runAgent(input) {<br>  let state = {<br>    input,<br>    history: [],<br>    memory: []<br>  };<br>  for (let step = 0; step &lt; 10; step++) {<br>    const action = await policy(state);<br>    const result = await execute(action);<br>    state = updateState(state, action, result);<br>    if (isDone(state, action)) break;<br>  }<br>  return state.output;<br>}</pre><h4>Termination Conditions</h4><p>Without termination logic, the loop is unbounded.</p><p><strong>Practical Conditions:</strong></p><p>1. Explicit Final Action</p><pre>if (action.type === &quot;final&quot;){<br>  return action.output;<br>}</pre><p>2. Max Step Limit</p><pre>if (step &gt;= MAX_STEPS){<br>  throw new Error(&quot;Max steps exceeded&quot;);<br>}</pre><p>3. Heuristic Completion</p><pre>function isDone(state){<br>  return state.history.length &gt; 0 &amp;&amp;<br>  state.history[state.history.length - 1].action.type === &quot;final&quot;;<br>}</pre><h4>Why This Matters</h4><p>Without termination, we will have:</p><p>- Infinite loops</p><p>- Unbounded cost</p><p>- API rate issues</p><h3>Conclusion</h3><p>This article walked through what an AI agent actually looks like under the hood, from the control loop to memory and tools with small minimal JavaScript implementation. Keep in mind that this is not a deep or complete system just a minimal, educational implementation, basically just what I learned while exploring AI agents and there’s still a lot missing.</p><p>If you’re trying to learn this too, my advice is don’t start with frameworks, just try to build a small agent yourself; even a basic version will force you to understand a lot and that’s where the real learning happens.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d6c56ad8302a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Socket.IO for real time multiplayer games]]></title>
            <link>https://medium.com/@tahaboussaden/socket-io-for-real-time-multiplayer-games-60d43cc55c33?source=rss-b5f0ce4a47bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/60d43cc55c33</guid>
            <category><![CDATA[sockets]]></category>
            <category><![CDATA[online-games]]></category>
            <category><![CDATA[multiplayer-game]]></category>
            <category><![CDATA[socketio]]></category>
            <category><![CDATA[game-development]]></category>
            <dc:creator><![CDATA[Taha Boussaden]]></dc:creator>
            <pubDate>Mon, 09 Feb 2026 17:23:28 GMT</pubDate>
            <atom:updated>2026-04-28T22:02:50.593Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LsGz3gCzgy_i9mMiE-qf7A.png" /></figure><p>Real time applications require instant communications between clients and servers. In multiplayer games, even a delay of a few milliseconds can affect gameplay fairness and UX.</p><p>So while building my three in one Ping Pong game(<a href="https://github.com/ThePhoenix77/trans-ping-pongy">trans-ping-pongy</a>) supporting bot, local and remote modes.</p><p>In remote mode, I needed a reliable way to handle:</p><ul><li>players movements synchronization</li><li>ball and score updates broadcasting</li><li>reconnections handling</li><li>room management</li><li>keeping latency as low as possible</li></ul><p>For this, comes the job of Socket.IO. And in this article, I’ll be explaining how Socket.IO works and how I implemented it to power the gameplay.</p><h3><strong>Why Socket.IO?</strong></h3><p>Socket.IO is a library that enables bidirectional communication between the client and the server.</p><p>Instead of sending classic HTTP requests like:</p><pre>client → request → server → response</pre><p>we keep a persistent connection open, allowing both sides to send messages anytime, making it perfect for games.</p><h3>My Architecture Overview</h3><p>My game followed this model:</p><p><strong>Client responsibilities</strong></p><ul><li>capture keyboard input</li><li>send movement updates</li><li>render the game</li><li>display score and status</li></ul><p><strong>Server responsibilities</strong></p><ul><li>maintain the source of truth</li><li>update ball physics</li><li>detect collisions</li><li>broadcast the new state to players</li></ul><h3>Connection Flow</h3><p>When a user joins a match:</p><ol><li>client connects to the socket server</li><li>player joins a room</li><li>server waits until two players are present</li><li>match starts</li><li>server begins broadcasting the game state</li></ol><h3>Example of creating a client Connection</h3><pre>const socket = io(API_BASE_URL, {<br>  withCredentials: true,<br>});</pre><p>Once connected, the client can emit or listen to events.</p><h3>Listening &amp; Emitting Events</h3><p>Socket.IO works like a messaging system.</p><p><strong>Emit → send informatio</strong></p><p><strong>On → receive information</strong></p><p>Example:</p><pre>socket.emit(&quot;movePaddle&quot;, { y });</pre><pre>socket.on(&quot;gameState&quot;, (state) =&gt; {<br>  renderGame(state);<br>});</pre><p>This pattern is the core of the real time interaction.</p><h3>Room Management</h3><p>Each match had its own room.</p><p>This allowed the server to broadcast updates only to the two players involved instead of everyone online.</p><pre>socket.join(roomId);<br>io.to(roomId).emit(&quot;gameState&quot;, updatedState);</pre><p>Without rooms, scaling multiplayer would be impossible.</p><h3>Reconnection Logic</h3><p>The reconnection system I implemented allows players to rejoin an ongoing game if they disconnect (network issues, page refresh, etc.). Here’s how it works:</p><ol><li><strong>Data Structures for Tracking Disconnection</strong></li></ol><pre>export interface Player {<br>  id: string;<br>  socketId: string;<br>  username?: string;<br>  userId?: number;<br>  disconnectionTime?: number; // timestamp when player disconnected (in ms)<br>}<br><br>export interface Room {<br>  id: string;<br>  players: Player[];<br>  running: boolean;<br>  ended?: boolean;<br>  reconnectTimeout?: NodeJS.Timeout | null; // timeout for reconnection<br>  // ... other game state<br>}</pre><p><strong>2. Marking a Player as Disconnected</strong></p><p>When a player disconnects, instead of immediately removing them, they are marked as disconnected:</p><pre>export function markPlayerDisconnected(socketId: string): { roomId?: string; playerIndex?: number } {<br>  const roomId = socketRoom.get(socketId);<br>  const room = rooms.get(roomId);<br>  const player = room.players.find(p =&gt; p.socketId === socketId);<br><br>  // Mark with timestamp instead of removing<br>  player.disconnectionTime = Date.now();<br><br>  // If ALL players disconnect, end the room immediately<br>  if (room.players.length &gt; 0 &amp;&amp; room.players.every(p =&gt; p.disconnectionTime)) {<br>    endRoomDueToDisconnect(roomId);<br>  }<br><br>  return { roomId, playerIndex: player.index };<br>}</pre><p><strong>3. Handling Disconnect on Backend Socket</strong></p><p>When a socket disconnects during an active game:</p><pre>socket.on(&quot;disconnect&quot;, () =&gt; {<br>  const roomId = [...socket.rooms].find((r) =&gt; r !== socket.id);<br>  const room = getRoom(roomId);<br>  const player = room.players.find((p) =&gt; p.id === socket.id);<br><br>  // If game is running with 2 players, mark as disconnected but keep game running<br>  if (!room.ended &amp;&amp; room.running &amp;&amp; room.players.length === 2) {<br>    const { playerIndex } = markPlayerDisconnected(socket.id);<br><br>    // Notify other player<br>    gameNamespace.to(roomId).emit(&quot;player_disconnected&quot;, {<br>      playerIndex,<br>      username: player.username,<br>      message: `${player.username} disconnected. Waiting for reconnection...`<br>    });<br><br>    // Set a 60-second timeout to end the game if player doesn&#39;t reconnect<br>    const RECONNECT_TIMEOUT = 60000;<br>    room.reconnectTimeout = setTimeout(() =&gt; {<br>      const opponentIndex = playerIndex === 0 ? 1 : 0;<br>      stopGame(gameNamespace, room, opponentIndex); // opponent wins<br>      endRoomDueToDisconnect(roomId);<br>      gameNamespace.to(roomId).emit(&quot;player_abandoned&quot;, {<br>        message: `${player.username} failed to reconnect. Game ended.`<br>      });<br>    }, RECONNECT_TIMEOUT);<br>  }<br>});</pre><p><strong>4. Reconnecting a Player</strong></p><p>When a player tries to rejoin, the system matches them to their disconnected slot:</p><pre>export function reconnectPlayer(<br>  roomId: string, <br>  userId: number, <br>  newSocketId: string, <br>  username?: string<br>): { success: boolean; message?: string; playerIndex?: number } {<br>  const room = rooms.get(roomId);<br>  if (!room || room.ended) return { success: false, message: &quot;Room not found or ended&quot; };<br><br>  // Find disconnected player by userId or username<br>  let disconnectedPlayer = room.players.find(p =&gt;<br>    p.disconnectionTime &amp;&amp; (p.userId === userId || p.username === username)<br>  );<br><br>  // Fallback: take the first disconnected slot<br>  if (!disconnectedPlayer) {<br>    disconnectedPlayer = room.players.find(p =&gt; p.disconnectionTime);<br>  }<br><br>  if (!disconnectedPlayer) {<br>    return { success: false, message: &quot;No disconnected slot found&quot; };<br>  }<br><br>  // Clear disconnection tracking<br>  delete disconnectedPlayer.disconnectionTime;<br><br>  // Update socket IDs to the new connection<br>  const oldSocketId = disconnectedPlayer.socketId;<br>  socketRoom.delete(oldSocketId);<br>  disconnectedPlayer.socketId = newSocketId;<br>  disconnectedPlayer.id = newSocketId;<br>  socketRoom.set(newSocketId, roomId);<br><br>  return { success: true, playerIndex: disconnectedPlayer.index };<br>}</pre><p><strong>5. Handling Reconnection on Join</strong></p><p>At the beginning of the join event I check if there is any reconnection attempts:</p><pre>socket.on(&quot;join&quot;, ({ roomId, username }, callback) =&gt; {<br>  const room = getRoom(roomId);<br><br>  // Check if this is a reconnection attempt<br>  if (room &amp;&amp; userId &amp;&amp; room.players.length &gt; 0) {<br>    const disconnectedPlayer = room.players.find(p =&gt;<br>      p.disconnectionTime &amp;&amp; (p.userId === userId || p.username === username)<br>    );<br><br>    if (disconnectedPlayer) {<br>      const reconnectResult = reconnectPlayer(roomId, userId, socket.id, username);<br><br>      if (reconnectResult.success) {<br>        socket.join(roomId);<br><br>        // Cancel the abandonment timeout<br>        if (room.reconnectTimeout) {<br>          clearTimeout(room.reconnectTimeout);<br>          room.reconnectTimeout = null;<br>        }<br><br>        // Let client know they can control again<br>        socket.emit(&quot;ready&quot;, { message: room.running ? &quot;Game already started&quot; : &quot;Game resuming&quot; });<br><br>        // Notify all players about reconnection<br>        gameNamespace.to(roomId).emit(&quot;player_reconnected&quot;, {<br>          playerIndex: reconnectResult.playerIndex,<br>          username: username,<br>          message: `${username} reconnected! Game continues...`<br>        });<br><br>        return; // Skip normal join flow<br>      }<br>    }<br>  }<br><br>  // ... normal join logic<br>});</pre><p><strong>6. Frontend Handling (optional)</strong></p><pre>// Handle player disconnection notification<br>socket.on(&quot;player_disconnected&quot;, (payload: any) =&gt; {<br>  setInfo(`${payload.username || &quot;Player&quot;} disconnected. Game continues...`);<br>});<br><br>// Handle successful reconnection<br>socket.on(&quot;player_reconnected&quot;, (payload: any) =&gt; {<br>  setReady(true); // Allow input immediately<br>  setInfo(`${payload.username || &quot;Player&quot;} reconnected! Game continues...`);<br>});<br><br>// Handle abandonment (failed to reconnect in time)<br>socket.on(&quot;player_abandoned&quot;, (payload: any) =&gt; {<br>  setInfo(payload.message || &quot;Opponent failed to reconnect. You win!&quot;);<br>  setReady(false);<br>});</pre><h3>Performance Considerations</h3><p>To keep the game smooth:</p><ul><li>updates were sent at a fixed tick rate</li><li>payload size was minimized</li><li>unnecessary emissions were avoided</li></ul><p>Small optimizations make a big difference in real-time systems.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60d43cc55c33" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Technical Deep-Dive of Building a Free Serverless AI Powered Twitter Bot]]></title>
            <link>https://medium.com/@tahaboussaden/building-a-free-serverless-ai-powered-twitter-bot-a-complete-technical-deep-dive-1bce83d308f4?source=rss-b5f0ce4a47bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/1bce83d308f4</guid>
            <category><![CDATA[bots]]></category>
            <category><![CDATA[tweepy]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[twitter]]></category>
            <dc:creator><![CDATA[Taha Boussaden]]></dc:creator>
            <pubDate>Thu, 11 Dec 2025 23:54:43 GMT</pubDate>
            <atom:updated>2026-05-03T16:33:45.663Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SW2zhr6FNaIjGwJloX3wvA.png" /></figure><p>Over the last few days, I built something I’ve always wanted to experiment with a completely<strong> serverless, </strong>fully<strong> automated, AI-powered </strong>Twitter (X)<strong> bot </strong>that runs <em>forever</em>, tweets on a customizable schedule, summarizes news using AI, manages its own history, and costs <strong>literally $0</strong> to operate.</p><p>This article explains <strong>every boring technical detail</strong> of how it works, how it’s structured, and how the workflow stays stable without a server.</p><p>If you’re interested in automation, AI pipelines, APIs, GitHub Actions, or simply want to build your own bot, this is a full blueprint you can follow.</p><h3>Demo</h3><iframe src="https://cdn.embedly.com/widgets/media.html?type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=twitter&amp;url=https%3A//x.com/seabasszealot/status/2014882483553153368&amp;image=" width="500" height="281" frameborder="0" scrolling="no"><a href="https://medium.com/media/c29e67a130f2a0bdd2fb06ef4aee6396/href">https://medium.com/media/c29e67a130f2a0bdd2fb06ef4aee6396/href</a></iframe><h3>Overview</h3><p>This project does 5 core things:</p><h4>1. Fetches real-time news articles</h4><p>Using a News API + keywords of the user’s choice.</p><h4>2. Summarizes these articles using AI</h4><p>A lightweight LLM condenses the info into one tweet-sized message.</p><h4>3. Tweets automatically on a schedule</h4><p>User can choose its own defined cron schedule, for the tweets to be tweeted.</p><h4>4. Prevents duplicate tweets</h4><p>The bot keeps track of what it tweeted today and what it has tweeted historically so that there is no chances for duplicated tweets.</p><h4>5. Runs entirely using GitHub Actions</h4><p>No server.<br>No VPS.<br>No cloud hosting.<br>No cron on your machine.<br>No cent spent.</p><p>GitHub becomes the “server”, executing the bot on a schedule and committing updated data back to the repository.</p><h3>Project Architecture &amp; Structure</h3><p>Here’s the final architecture of the bot:</p><pre>[Scheduler/manual run]<br>          |<br>          v<br>main.py ─▶ fetcher.fetch_news() ─▶ summarizer.summarize_article()<br>          |                                     |<br>          |                                     └─▶ score_summary()<br>          └─▶ storage.save_daily_tweets()<br>                    │<br>                    ├─▶ storage.filter_duplicates()    └─▶ storage.save_tweets_to_history()<br>                    │<br>                    └─▶ tweeter.tweet_daily()</pre><pre>ai-twitter-bot/<br>├── architecture.txt          # Textual architecture overview<br>├── config/<br>│   └── config.py             # Keyword and limit configuration<br>├── data/<br>│   ├── daily_tweets.txt      # Current cycle’s tweets<br>│   └── tweets.txt            # Long-term tweet history<br>├── fetcher.py                # NewsAPI client<br>├── helper.py                 # Debug print helpers<br>├── main.py                   # Orchestrates the end-to-end workflow<br>├── requirements.txt          # Python dependencies<br>├── storage.py                # Disk persistence and deduplication helpers<br>├── summarizer.py             # Hugging Face summarisation pipeline<br>├── tweeter.py                # X/Twitter posting utilities<br>└── README.md</pre><p>Each part has its job. Let’s dive into how every component works.</p><h3>Credentials &amp; Environment Setup</h3><p>Before anything runs, the bot loads:</p><ul><li>X_API_KEY</li><li>X_API_KEY_SECRET</li><li>ACCESS_TOKEN</li><li>ACCESS_TOKEN_SECRET</li><li>NEWS_API_KEY</li></ul><p>Which they need to be inputed into the GitHub repo environment.</p><h3>News Fetching System</h3><p>(File: fetcher.py)</p><p>This module hits a News API endpoint based on specified topics (e.g., AI, technology, business), these topics need to be inputed in the NICHE_KEYWORDS list located in the config.py file.</p><p>For example:</p><pre>url = f&quot;https://newsapi.org/v2/top-headlines?q=AI&amp;apiKey={key}&quot;</pre><p>It extracts:</p><ul><li>article titles</li><li>content</li><li>url</li></ul><h3>AI Summarization Engine</h3><p>(File: summarize.py)</p><p>Once the news articles are fetched, an AI model takes over.</p><h4>What the summary prompt does:</h4><ul><li>condenses article into 1 tweet-sized sentence</li><li>keeps factual correctness</li><li>avoids hashtags and emojis unless user wants them</li><li>removes repeated words or irrelevant details</li><li>includes the main takeaway of the article</li></ul><p>Each summary looks like:</p><blockquote><em>“Meta unveils a new AI model designed to assist developers in building multimodal applications more efficiently.”</em></blockquote><p>These summaries are then filtered, cleaned, and stored into a top_summaries list for the user to choose in which ones to tweet.</p><h3>Tweet Queue System</h3><p>The bot uses <strong>two files</strong> to manage tweet flow:</p><h4>1. daily_tweet.txt</h4><p>Stores the tweet sent <em>today</em>.<br>Prevents sending the same tweet again in the same run or same day.</p><h4>2. tweets.txt</h4><p>Permanent archive of everything that has ever been tweeted by the bot.</p><p>This ensures:</p><ul><li>Historical tracking</li><li>Predictable behavior</li><li>Debuggability</li></ul><h3>Twitter (X) API Integration</h3><p>(File: tweeter.py)</p><p>This bot uses: Twitter API v2, specifically client.create_tweet()</p><h4>Why v2?</h4><p>Because free tier <strong>no longer allows v1.1 posting</strong>, but v2 posting works perfectly with a valid app.</p><p>Example request:</p><pre>response = client.create_tweet(text=tweet)</pre><p>If posting fails, the bot logs the error and stops — no corrupted data.</p><h3>Core Pipeline Execution</h3><p>(File: main.py)</p><p>The pipeline is simple but robust:</p><ol><li>Fetch news</li><li>Generate summaries</li><li>Scoring summaries</li><li>Storing the top summaries</li><li>Post tweets based on the history of tweeted tweets</li><li>Update:</li></ol><ul><li>daily_tweet.txt</li><li>tweets.txt</li></ul><p>This ensures the data stays consistent across runs.</p><h3>Commit &amp; Push Logic (Serverless Persistence)</h3><p>Because GitHub Actions runs in a temporary environment,<br> <strong>data needs to be committed back to the repo</strong> after each tweet.</p><p>Final workflow:</p><pre>- name: Commit updated data files<br>  run: |<br>    git add data/<br>    git commit -m &quot;Auto-update tweet history&quot; || echo &quot;No changes&quot;</pre><p>Then:</p><pre>- name: Push changes<br>  run: git push</pre><p>This is what makes the bot <strong>stateful</strong> despite having no server.</p><h3>Scheduling with GitHub Actions</h3><p>(File: .github/workflows/tweet.yml)</p><p>Here is my core scheduler, so it triggers the GitHub workflow every hour to the whole process, and tweet:</p><pre>on:<br>  schedule:<br>    - cron: &quot;0 * * * *&quot;</pre><p>Meaning:</p><ul><li>run every hour</li><li>and user can customize to any cron pattern</li><li>no server required</li><li>no hosting costs</li></ul><p>GitHub Actions essentially becomes a <strong>free server</strong> that never sleeps.</p><h3>Testing &amp; Debugging Strategy</h3><h4>Local testing:</h4><p>You can test by running:</p><pre>python3.11 main.py</pre><h4>Remote testing:</h4><p>Using:</p><pre>workflow_dispatch:</pre><p>Or you can just trigger the bot manually from GitHub.</p><h4>Error Logging:</h4><p>The bot prints clear error messages for:</p><ul><li>API failures</li><li>missing env variables</li><li>invalid credentials</li><li>duplicated tweets attempts</li></ul><h3>Cost Breakdown</h3><p>This entire system costs:</p><h4>$0 per month</h4><p>Because:</p><ul><li>Twitter API v2 posting is free</li><li>GitHub Actions gives 2,000 minutes/mo for free</li><li>News API has a free tier</li><li>AI summarization uses a small and cheap model or free API</li><li>No servers, no VPS, no cron jobs</li></ul><h3>What I Learned</h3><p>Building this project taught me is designing an end-to-end AI pipeline.</p><p>I learnt how to use Twitter API v2, including OAuth credentials, App authentication, posting, and errors troubleshooting. Also automating full workflows with GitHub Actions (Cron jobs, environment variables, caching, committing from Actions). I also learned to write clean Python architecture (modularization) and credentials &amp; secrets management, applying best practices with .env and GitHub Secrets.</p><h3>Conclusion</h3><p>This project started as a random idea…<br> “What if I could automate the whole twitting process with a bot that writes for me and completely free <strong>(I’m still a student, so no income; idk if I should cry or laugh)</strong>?”</p><p>Turns out: <strong>Yes.</strong></p><p>The system is:</p><ul><li>scalable</li><li>customizable</li><li>free</li><li>fully automated</li><li>permanently running</li></ul><p>Anyone can use this architecture to build bots for:</p><ul><li>AI tweeting</li><li>content generation</li><li>news updates</li><li>personal branding</li><li>daily atomic notes</li><li>community building</li></ul><p>If you want to check the full code, here is the repo:</p><p>↳ <a href="https://github.com/ThePhoenix77/ai-twitter-bot"><strong>https://github.com/ThePhoenix77/ai-twitter-bot</strong></a></p><p>Feel free to fork it, improve it, or message me. I love meeting other builders.</p><p>I’ll be happy to connect, enjoy ;)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1bce83d308f4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Walkthrough of a Convolutional Neural Network]]></title>
            <link>https://medium.com/@tahaboussaden/walkthrough-of-a-convolutional-neural-network-e6814bf9b9fc?source=rss-b5f0ce4a47bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/e6814bf9b9fc</guid>
            <category><![CDATA[convolution]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[cnn-model]]></category>
            <category><![CDATA[convolutional-neural-net]]></category>
            <dc:creator><![CDATA[Taha Boussaden]]></dc:creator>
            <pubDate>Tue, 02 Dec 2025 14:16:45 GMT</pubDate>
            <atom:updated>2026-04-28T20:59:25.310Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*REW6QUjMQPeCp-DNAFRsLA.png" /></figure><p>Convolutional Neural Networks (CNNs) are the undisputed workhorses of modern Computer Vision. From identifying faces in your photo gallery to helping autonomous vehicles navigate busy streets, CNNs are the powerful subset of Deep Learning that makes “seeing” possible for machines.</p><p>While the math under the hood can get intense, the architectural logic of a CNN is surprisingly elegant. It essentially boils down to three mandatory, yet simple, steps.</p><h3>I — The Three Mandatory Steps of a CNN</h3><p>All CNNs are built upon a foundation of three distinct types of layers:</p><h4>1. The Convolutional Layer</h4><p>This is the “eyes” of the network, where feature extraction happens.</p><ul><li><strong>The Input:</strong> For a standard color image, the input has three dimensions: width, height, and depth (the RGB color channels).</li><li><strong>The Process (Convolution):</strong> The layer uses a <strong>filter</strong> (or kernel), which acts like a sliding window. This filter moves across the input image, performing calculations to detect specific features, like the sharp line of a cat’s whisker or the curve of its ear.</li><li><strong>The Result:</strong> This process produces an <strong>activation map</strong> (or feature map), which highlights exactly where those specific features are located in the image.</li></ul><h4>2. The Pooling Layer (Max-Pooling)</h4><p>Raw feature maps can be massive. Pooling layers reduce complexity and increase computational efficiency by shrinking the spatial size of the map. This also helps prevent <strong>overfitting</strong> (where the model memorizes training data rather than learning to generalize).</p><p>In <strong>Max-Pooling</strong>, we slide a window (e.g., 2x2) over the feature map and select only the pixel with the maximum value. This preserves the “strongest signals” while discarding the noise.</p><h4>3. The Fully Connected (FC) Layer</h4><p>Once the features are extracted and simplified, they are passed to a traditional neural network structure.</p><ul><li><strong>Structure:</strong> This layer is “dense,” meaning every node (neuron) is connected to every node in the previous layer.</li><li><strong>Classification:</strong> It leverages an activation function (like Sigmoid) to produce the final output. For example, an output of <strong>0.95</strong> indicates a 95% probability that the image is a cat.</li></ul><h3>II — Essential Mathematics: Functions for Learning</h3><p>To transform raw data into intelligence, we use specific mathematical functions.</p><h4>1. Activation Functions</h4><p>These introduce non-linearity, allowing the network to learn complex relationships rather than just simple linear patterns.</p><ul><li><strong>Sigmoid Function:</strong> Think of this as a “soft switch” that squashes values between 0 and 1.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/147/0*aPUezlEYGK-fil4k.png" /></figure><ul><li><em>Derivative:</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/175/0*Sv_9K9yaM7tKEkY6.png" /></figure><ul><li><strong>ReLU (Rectified Linear Unit):</strong> The most popular choice for hidden layers. It’s simple: if the input is positive, it stays; if it’s negative, it becomes zero.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/133/0*qXG1_9iTX5010Hgf.png" /></figure><ul><li><em>Derivative:</em> <br>if (x &gt; 0)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/71/0*jJx0Pd5rRYspMSQF.png" /></figure><p>otherwise it’s 0.</p><h4>2. Loss Function (Binary Cross-Entropy)</h4><p>The Loss Function measures the gap between the predicted value (hat{y}) and the true label (y). For binary tasks (like Cat vs. Not-Cat), we use <strong>Binary Cross-Entropy (BCE)</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/335/0*MzvpkA0x9ZTVFB5D.png" /></figure><h3>III — The Training Loop: Backpropagation &amp; Gradient Descent</h3><p>How does the network actually “learn” from its mistakes? It uses <strong>Backpropagation</strong>.</p><p>By calculating the <strong>gradients</strong> (derivatives) of the loss with respect to the weights and biases, the network determines the direction and magnitude of change needed to reduce the error.</p><p>To perform the update, we use <strong>Gradient Descent</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/121/0*q0gorLX53ydEVkGB.png" /></figure><p>Where:</p><ul><li>θ: represents the weights or biases.</li><li>φ: is the <strong>learning rate</strong> (how big of a step we take).</li><li>σL∕σθ: is the gradient.</li></ul><h3>IV — Putting it All Together: A Real-World Architecture</h3><p>To illustrate this, here is the specific architecture I used for my <a href="https://github.com/ThePhoenix77/cat-cnn">cat-cnn</a> project, implemented from scratch:</p><ol><li><strong>Input:</strong> 64×64 grayscale image.</li><li><strong>Conv 1:</strong> 3×3 kernel → 62×62 feature map.</li><li><strong>Max-Pool 1:</strong> 2×2 window → 31×31 map.</li><li><strong>Conv 2:</strong> 3×3 kernel → 29×29 map.</li><li><strong>Max-Pool 2:</strong> 2×2 window → 14×14 map.</li><li><strong>Flatten:</strong> Converts the 2D map into a 1D vector of <strong>196</strong> elements.</li><li><strong>Dense Layer:</strong> 196 inputs → 1 output node.</li><li><strong>Output:</strong> Sigmoid activation → Final Probability.</li></ol><h3>Final Thoughts</h3><p>Building a CNN from scratch is one of the best thing I did to actually fully understand how models predict outcome based on images, which was this question that lead me to implementing this project and start maybe a journey in deep learning.</p><p>If you want to dive deeper into the code and see how these layers are implemented, check out the full project <a href="https://github.com/ThePhoenix77/cat-cnn">here</a>.</p><p><em>Thanks for reading! And I hope you found this article helpful.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e6814bf9b9fc" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>