<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: MatIntellect</title>
    <description>The latest articles on DEV Community by MatIntellect (@matintellect).</description>
    <link>https://dev.to/matintellect</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4161338%2F16c9ae2e-dce0-4561-90f2-f7a6d1931328.jpg</url>
      <title>DEV Community: MatIntellect</title>
      <link>https://dev.to/matintellect</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/matintellect"/>
    <language>en</language>
    <item>
      <title>AI video budgets: calculate the cost of usable clips</title>
      <dc:creator>MatIntellect</dc:creator>
      <pubDate>Fri, 13 Nov 2026 00:59:48 +0000</pubDate>
      <link>https://dev.to/matintellect/ai-video-budgets-calculate-the-cost-of-usable-clips-269p</link>
      <guid>https://dev.to/matintellect/ai-video-budgets-calculate-the-cost-of-usable-clips-269p</guid>
      <description>&lt;p&gt;A video API can return a successful job and still give you a clip you cannot use. If you only record the price of the final render, you miss the experiments and failed takes that got you there. For a developer comparing generation workflows, the useful output is the cost per accepted clip alongside a record of what was judged acceptable.&lt;/p&gt;

&lt;p&gt;The example below uses Python's standard library to calculate that number from a small fictional batch. It does not call a video API, measure model quality or reproduce a production pipeline. You need Python 3; the example was checked with Python 3.14.9. No API key, video file or external package is required.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0t0866rodgzntf0gvz8p.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0t0866rodgzntf0gvz8p.jpg" alt="Mat's cover image for a discussion of AI video budget and quality" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Decide what a usable clip means
&lt;/h2&gt;

&lt;p&gt;Before sending a request, write down the destination, target duration and aspect ratio. For a talking avatar, acceptance might depend on an understandable voice, recognizable likeness and acceptable lip sync. For a scene without dialogue, the relevant checks might be subject continuity and camera motion instead. Agree on those checks before looking at the outputs, so that the comparison does not shift with each model.&lt;/p&gt;

&lt;p&gt;Give each test the same brief and review the actual result. A common prompt is a useful starting point, although different providers may interpret the same words or settings differently. Record the model and version where available, duration, input assets, prompt, output identifier and whether a reviewer accepted the clip. Keep the underlying assets private if they contain a person's face or voice, and get consent before creating a likeness or copying a voice.&lt;/p&gt;

&lt;p&gt;My article on &lt;a href="https://matintellect.com/en/posts/how-to-make-ai-video-budget-and-quality" rel="noopener noreferrer"&gt;AI video budget and quality&lt;/a&gt; covers the production choices behind these checks, including the difference between a single video and a repeatable workflow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Count attempts, not just the final clip
&lt;/h2&gt;

&lt;p&gt;An experiment has inputs, processing and outputs. The input is a set of attempts with the amounts actually charged and a review decision for each. The processing adds all attempt charges and counts accepted clips. The output is total spend divided by that count. Include failed or discarded attempts if they were billed; a failed request that incurred no charge contributes zero. If voice, storage or editing is billed separately, track that cost too and state whether it is included in the figure you report.&lt;/p&gt;

&lt;p&gt;Run this example in a Python interpreter. The amounts and acceptance count are invented solely to demonstrate the calculation; they are not provider prices:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;decimal&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Decimal&lt;/span&gt;

&lt;span class="n"&gt;attempts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;Decimal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'0.40'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Decimal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'0.40'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Decimal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'0.40'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Decimal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'0.40'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;accepted&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;

&lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;attempts&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s1"&gt;'total=${total:.2f}; cost_per_accepted=${total / accepted:.2f}'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output is &lt;code&gt;total=$1.60; cost_per_accepted=$0.80&lt;/code&gt;. Decimal arithmetic avoids the usual binary floating point surprises when adding monetary values. In a real ledger, use the billing currency and the actual units charged. A credit balance is not automatically a dollar amount: convert it only when the applicable terms make the conversion clear.&lt;/p&gt;

&lt;p&gt;If no clip is accepted, cost per accepted clip is undefined. Report the total spent and zero accepted clips instead of dividing by zero or reporting the average attempt cost as an equivalent result. Likewise, a successful job status says the provider completed a request; it does not mean that a reviewer accepted its content.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimages.pexels.com%2Fphotos%2F29505140%2Fpexels-photo-29505140.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimages.pexels.com%2Fphotos%2F29505140%2Fpexels-photo-29505140.jpeg" alt="A video editing timeline with multiple tracks and controls" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The timeline is where a per-clip calculation meets the final edit. A usable shot can still need trimming, captions or sound work. Keep those costs separate until you can attribute them consistently, then include them when estimating a finished video. If a single accepted shot appears in several final cuts, explain how its cost is allocated; otherwise comparisons between projects can be misleading.&lt;/p&gt;

&lt;h2&gt;
  
  
  Handle timeouts without hiding the bill
&lt;/h2&gt;

&lt;p&gt;A client timeout tells you that the client stopped waiting. It does not prove that the remote job stopped or that it was not billed. Preserve the provider's job identifier when available and check its status before submitting another request. Follow the provider's documentation for idempotency, polling intervals, cancellation and billing; these capabilities differ, and the Python calculation above implements none of them.&lt;/p&gt;

&lt;p&gt;For each attempt, keep a local status such as submitted, completed, failed or unknown. Record the provider response and any known charge. If the outcome remains unknown, mark the cost as unresolved rather than assuming zero. A retry can create another charge, so set a retry limit and a total spending limit before automating repeated submissions.&lt;/p&gt;

&lt;p&gt;When comparing two workflows, use the same evaluation rules and keep the sample sizes visible. A few clips can reveal obvious problems, but they do not establish a reliable acceptance rate for every scene. Look at discarded outputs as well: a low price per request can become expensive when many attempts are unusable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Separate generation from post-production
&lt;/h2&gt;

&lt;p&gt;In my automatic subtitles project, I built the assistant in 1 day, and a finished subtitled video takes about 2 minutes rather than half an hour of manual work. Those figures describe processing an existing video, not the speed or price of generating an AI video. The workflow takes a video from Google Drive, transcribes speech with word timing, uses AI to proofread the text and uses ffmpeg to put subtitles on the video. The result goes back to Drive, with a report sent through Telegram.&lt;/p&gt;

&lt;p&gt;The project has a useful failure boundary: if proofreading fails, it still produces a video using the original transcript. That keeps one optional processing step from blocking the whole output, although the resulting subtitles still need review. The project also reuses transcription when reprocessing a video. For an AI video workflow, an equivalent design question is which paid intermediate results can be retained safely when a later step fails. The answer depends on the provider's terms and your data retention requirements.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimages.pexels.com%2Fphotos%2F11063289%2Fpexels-photo-11063289.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimages.pexels.com%2Fphotos%2F11063289%2Fpexels-photo-11063289.jpeg" alt="A computer and laptop at a video editing workstation" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Reproduce the check on your own material
&lt;/h2&gt;

&lt;p&gt;Start with a short representative scene and a fixed spending cap. Save each attempt's prompt and settings, actual charge, job status and review decision. Run the calculation on the resulting ledger, then inspect the accepted clips on the device and in the layout where the finished video will appear. Check subtitles with the sound off and listen for names or words that the voice gets wrong.&lt;/p&gt;

&lt;p&gt;Repeat the comparison when the brief or model version changes. Keep unresolved charges visible and include the cost of rejected clips. The result is a record you can use to decide whether to change the model, change the brief or stop testing, rather than a price quoted for one successful render.&lt;/p&gt;

&lt;p&gt;Photo credits: Abdulkadir Emiroğlu and Amar Preciado / Pexels.&lt;/p&gt;

&lt;p&gt;Tags: #ai #video #python #machinelearning&lt;/p&gt;

&lt;p&gt;This article was created with the help of AI.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>automation</category>
      <category>productivity</category>
    </item>
    <item>
      <title>AI SEO: check crawler access and search eligibility before chasing citations</title>
      <dc:creator>MatIntellect</dc:creator>
      <pubDate>Thu, 12 Nov 2026 11:25:57 +0000</pubDate>
      <link>https://dev.to/matintellect/ai-seo-check-crawler-access-and-search-eligibility-before-chasing-citations-23cd</link>
      <guid>https://dev.to/matintellect/ai-seo-check-crawler-access-and-search-eligibility-before-chasing-citations-23cd</guid>
      <description>&lt;p&gt;People find information in both search engines and AI answers. I account for both when working on my site. For a developer, that starts with a narrower problem: can the relevant crawler reach a page, and is that page eligible to appear in search?&lt;/p&gt;

&lt;p&gt;This walkthrough uses public HTTP endpoints, Python's standard library and Google Search Console. The example checks a real robots.txt; the later inspection steps need access to your own Search Console property. It does not test a model's choice of sources or guarantee an AI citation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fe3lwv8lqwvnmadnvlk5c.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fe3lwv8lqwvnmadnvlk5c.jpg" alt="AI search and website visibility" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Start with the states you can observe
&lt;/h2&gt;

&lt;p&gt;A URL moves through several separate stages. A search engine needs to discover it, retrieve its content and decide whether to index it. Google says a page must also be eligible for a search snippet to be considered as a supporting link in its AI Overviews and AI Mode. Even then, eligibility is not a promise that the page will be selected. The conditions are described in &lt;a href="https://developers.google.com/search/docs/appearance/ai-features" rel="noopener noreferrer"&gt;Google's documentation for AI features&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;GEO, or generative engine optimization, and AEO, or answer engine optimization, are names used for work on visibility in generated answers. For Google's AI features, the documented starting point is ordinary SEO: accessible content, internal links and pages that meet the search technical requirements. There is no separate mandatory AI markup in that guidance.&lt;/p&gt;

&lt;p&gt;My own project gives two different measurements: Google's index grew from zero to 117 pages, and a list of 167 search queries guides topic selection. The first is an index figure; the second is an input to planning. Neither measures enquiries or proves that an AI answer cited the site.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check the crawler policy
&lt;/h2&gt;

&lt;p&gt;OpenAI documents separate user agents for search and training. OAI-SearchBot is used to surface sites in ChatGPT search, while GPTBot crawls content that may be used to train foundation models. The permissions can be set independently. OpenAI's &lt;a href="https://developers.openai.com/api/docs/bots" rel="noopener noreferrer"&gt;crawler reference&lt;/a&gt; also describes ChatGPT-User, which makes requests on behalf of users and is not the automatic search crawler.&lt;/p&gt;

&lt;p&gt;The public robots.txt on my site explicitly allows OAI-SearchBot and GPTBot. You can check the rules for a URL with Python 3 and its standard library. Enter the full page URL when prompted. No package install or credentials are needed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;urllib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;parse&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;urllib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;robotparser&lt;/span&gt;

&lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Page URL: "&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;robots_url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;urllib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;urljoin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"/robots.txt"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;robots&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;urllib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;robotparser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;RobotFileParser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;robots_url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;robots&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;bot&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"OAI-SearchBot"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"GPTBot"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{bot}: {robots.can_fetch(bot, url)}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For the live file checked while preparing this article, the output was:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;OAI-SearchBot: True
GPTBot: True
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This checks the parser's interpretation of the retrieved rules for that particular path. Change the URL to the page you want to examine: a policy may permit the homepage and restrict a subdirectory. A later change to robots.txt can also change the result. A &lt;code&gt;True&lt;/code&gt; value does not prove that the crawler has visited the page, that the server served it successfully, or that the page was used in an answer.&lt;/p&gt;

&lt;p&gt;The example reads a public site only. For production monitoring, add an explicit request timeout and record HTTP errors separately from a policy decision. A timeout, redirect problem or inaccessible robots.txt should be investigated; don't turn a network failure into a claim that a crawler is allowed or blocked.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjnbea8bj5oi1rlmqfadw.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjnbea8bj5oi1rlmqfadw.jpeg" alt="Notebook used to plan a technical check, photo by Leeloo The First on Pexels" width="799" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Inspect the page as a separate request
&lt;/h2&gt;

&lt;p&gt;Open the target page without a login and inspect the response as well as what the browser renders. A successful robots.txt check says nothing about whether a CDN, authentication wall or server error prevents a crawler from receiving the page. Check the final URL after redirects, and make sure the content that answers the query is available as text.&lt;/p&gt;

&lt;p&gt;Look at both HTML meta robots directives and HTTP &lt;code&gt;X-Robots-Tag&lt;/code&gt; headers. A &lt;code&gt;noindex&lt;/code&gt; directive asks a compliant search engine not to index the page. Snippet restrictions such as &lt;code&gt;nosnippet&lt;/code&gt; can affect whether it is eligible to appear with a snippet. Google's AI feature documentation lists the relevant controls; verify the actual policy for your site before changing them. A page intentionally excluded from search should not be opened up merely to improve an SEO check.&lt;/p&gt;

&lt;p&gt;Use URL Inspection in Search Console for the exact URL. Compare the indexed state with the live test and the HTML Google received. They answer different questions: a live test can show what is reachable now, while the indexed version reflects what Google has already processed. If you change a directive or redirect, allow time for a recrawl and inspect again. A request for indexing is a request, not confirmation that indexing happened.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check discovery without treating the sitemap as an index
&lt;/h2&gt;

&lt;p&gt;My site's sitemap endpoint returns XML, and its address is listed in robots.txt. A sitemap provides discoverable URLs; it does not make every URL eligible for indexing. Check that a target URL is the preferred live address and that pages elsewhere on the site link to it. When a page moves, test the redirect from the old address and update internal links.&lt;/p&gt;

&lt;p&gt;For a bilingual site, inspect the English and Russian URLs independently. A working page in one language does not establish that its counterpart is reachable, indexed or linked correctly. Keep the language and final URL in your notes so a change to one version is not mistaken for a result on the other.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F91o88scu7vllgusnyho0.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F91o88scu7vllgusnyho0.jpeg" alt="Laptop and glasses on a desk, photo by Daniil Komov on Pexels" width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep search and answer observations apart
&lt;/h2&gt;

&lt;p&gt;In Search Console, track the page's impressions, clicks and queries. Google includes traffic from its AI search features in the overall Web search reporting, so do not assume the normal report gives you a separate count of citations in AI answers. Check enquiries separately if that is a business outcome you measure.&lt;/p&gt;

&lt;p&gt;For a repeatable manual observation, save the exact question, date, AI product and whether a link to the page appeared. Repeat the same question later and record the result again. Responses can vary, and a missing link in one answer is not proof of a crawling fault. If the page is absent, first check access, indexing and whether its content answers the question, then revisit the observation.&lt;/p&gt;

&lt;p&gt;The broader context for these checks is in my article on &lt;a href="https://matintellect.com/en/posts/ai-seo-search-and-ai-answers" rel="noopener noreferrer"&gt;AI SEO, GEO and AEO&lt;/a&gt;. The useful output of a diagnostic run is a set of distinct states: crawler permission, page response, index status and observed search performance. Keep the unknowns visible instead of collapsing all of them into a single "AI ready" flag.&lt;/p&gt;

&lt;p&gt;This article was created with the help of AI.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>automation</category>
      <category>productivity</category>
    </item>
    <item>
      <title>AI employee: how to check a news-processing workflow before publication</title>
      <dc:creator>MatIntellect</dc:creator>
      <pubDate>Thu, 12 Nov 2026 02:49:33 +0000</pubDate>
      <link>https://dev.to/matintellect/ai-employee-how-to-check-a-news-processing-workflow-before-publication-3ch2</link>
      <guid>https://dev.to/matintellect/ai-employee-how-to-check-a-news-processing-workflow-before-publication-3ch2</guid>
      <description>&lt;p&gt;A content workflow has several distinct failure points: receiving a source, deciding whether it is a duplicate, producing a draft and authorizing publication. This article lays out checks for those boundaries using my content factory as context. The checks are proposed test scenarios, not results from an executed test suite&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbwxq40dl2nehzb88rye7.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbwxq40dl2nehzb88rye7.jpg" alt="Gradual delegation in an AI employee workflow" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The factory is a team of AI agents in Telegram. It receives material from 13 news sources, filters repeated items, highlights topics, prepares posts in the author's voice, checks facts and adds an image. A person reviews the preview; my approval is required before publication. Telegram is the known interaction surface here. I am not specifying unverified package versions, queue technology or deployment details&lt;/p&gt;

&lt;h2&gt;
  
  
  Define a boundary before testing it
&lt;/h2&gt;

&lt;p&gt;Start with a single stage. For source intake, the input is news material from the specified sources. The output is material available for the next stage, with enough context to find the original. The observable question is whether the reviewer can trace an item back to the correct source&lt;/p&gt;

&lt;p&gt;A useful test set includes a normal item, an item missing a number and an unavailable source. These are hypothetical inputs for a reader to construct, not events I am claiming happened in my system. Expected behavior should distinguish missing data from a factual value. If a source is unavailable, a reviewer should not be told that the source was successfully checked&lt;/p&gt;

&lt;p&gt;Do not infer that a missing item was filtered as a duplicate until intake is known to have received it. A failure earlier in the chain and a decision later in the chain can have the same visible result: an item does not appear in the preview. Separate observations at the two boundaries make diagnosis possible&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1ai3g80mtspvvye5p98q.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1ai3g80mtspvvye5p98q.jpeg" alt="Checking source notes" width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Test filtering with counterexamples
&lt;/h2&gt;

&lt;p&gt;A duplicate filter has two kinds of error to consider. It can leave two reports of the same event in the result, or it can remove a distinct event because the wording looks similar. The latter can be missed if the reviewer looks only at retained items&lt;/p&gt;

&lt;p&gt;Construct two pairs for a local review: the same event described with different headlines, and different events using similar terms. Compare the retained and rejected material with the source text. The expected result is one representative of the repeated event and both distinct events retained. This is a proposed check; no classifier accuracy is asserted&lt;/p&gt;

&lt;p&gt;When changing a rule, repeat the earlier checks too. A rule tuned to catch a missed duplicate may start suppressing distinct news. Recording the source and the reason for a decision gives a human reviewer something to inspect when that happens. It does not require revealing private credentials or production data&lt;/p&gt;

&lt;h2&gt;
  
  
  Treat a draft as an intermediate artifact
&lt;/h2&gt;

&lt;p&gt;The drafting stage turns a selected topic into text in the author's voice. Fact checking and image selection add further review requirements. A polished paragraph can still turn a forecast into an observed event, or carry over an incorrect number. Review the actual claim against the source, not only whether the paragraph reads fluently&lt;/p&gt;

&lt;p&gt;For a manual test, pick a sentence with a number and find that number in the input. Pick a sentence describing a future event and check whether the draft preserves that status. If an input lacks a figure, the draft should not fill the gap with a plausible-looking estimate. These checks are examples for a reader to run on their own material&lt;/p&gt;

&lt;p&gt;An image needs review too. The existence of a file does not establish that it depicts the topic or is appropriate to use. In my workflow, the preview presents the text and image for review before publication&lt;/p&gt;

&lt;h2&gt;
  
  
  Make approval a separate state
&lt;/h2&gt;

&lt;p&gt;The system prepares a preview, and I can request changes. The post is published only after my yes. The factory has published 84 posts, none without my approval. The specific boundary is between preparing the material and authorizing an external action&lt;/p&gt;

&lt;p&gt;For a design review, explicitly consider a preview with no approval, one that was rejected for changes, and one approved by its owner. The first two must not be treated as publication authorization. The last can move forward only under the actual application's rules. These are desired scenarios for testing, not claims that a particular state machine or test suite is implemented&lt;/p&gt;

&lt;p&gt;If a process times out after attempting an external action, an unknown result is not proof of failure. Check the target before retrying; otherwise a second attempt may duplicate the action. This is a general operational recommendation, not a description of a measured incident in the factory&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fycfjydpm18t1b8x0llbj.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fycfjydpm18t1b8x0llbj.jpeg" alt="Human review of work documents" width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep corrections reviewable
&lt;/h2&gt;

&lt;p&gt;Since October 28, the factory has compared my edits with channel rules and added to those rules to avoid repeating mistakes. A changed rule can improve a later draft, but it does not replace review of the actual result. Keep the original error and a counterexample when evaluating a change so that the correction does not silently break a case that previously worked&lt;/p&gt;

&lt;p&gt;In my process, preparing a post went from about an hour to roughly 5 minutes to a finished preview. That is not a latency guarantee for another stack. It is also not proof that each intermediate stage is error-free&lt;/p&gt;

&lt;p&gt;For a broader explanation of why I separate preparation from human decisions, see &lt;a href="https://matintellect.com/en/posts/ai-employee-what-tasks-should-i-automate" rel="noopener noreferrer"&gt;what tasks an AI employee can take on&lt;/a&gt;. For your own implementation, choose one boundary, define its input and expected output, construct a counterexample and inspect the result before adding another autonomous action&lt;/p&gt;

&lt;p&gt;This article was created with the help of AI.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>automation</category>
      <category>productivity</category>
    </item>
    <item>
      <title>AI agents for marketing: validate a report before generating a summary</title>
      <dc:creator>MatIntellect</dc:creator>
      <pubDate>Wed, 11 Nov 2026 01:55:11 +0000</pubDate>
      <link>https://dev.to/matintellect/ai-agents-for-marketing-validate-a-report-before-generating-a-summary-1och</link>
      <guid>https://dev.to/matintellect/ai-agents-for-marketing-validate-a-report-before-generating-a-summary-1och</guid>
      <description>&lt;p&gt;A marketing report can look complete even when one day of the underlying data is missing. If the code converts that gap to zero and gives the result to a language model, the model may produce a fluent explanation of a change that never happened. The boundary between collected data and generated text deserves an explicit check&lt;/p&gt;

&lt;p&gt;This walkthrough is for developers building reporting workflows. It uses Python's standard library and local example data. It does not connect to an analytics API, infer causation, or make campaign decisions. I ran the example with Python 3.14.9; the data and dates are fictional&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx8qaykwf5olvr01lsp4r.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx8qaykwf5olvr01lsp4r.jpg" alt="A human navigator choosing direction in an observatory" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The contract before the model
&lt;/h2&gt;

&lt;p&gt;The example expects one row per calendar day, each with an ISO date and a non-negative integer count of visits. It checks the requested inclusive period and rejects duplicate, out-of-range or invalid rows. If any expected day is absent, the total is &lt;code&gt;None&lt;/code&gt; and the missing dates are returned separately&lt;/p&gt;

&lt;p&gt;That distinction is deliberate. A recorded zero is a value. An absent row may mean the source was unavailable, a filter excluded a day, or an export failed. The example does not know which explanation is correct. It prevents the incomplete period from looking like a complete total&lt;/p&gt;

&lt;p&gt;A production collector would need to retain source identity, time zone, retrieval time and the definition of a visit as well. It should distinguish an API error from an empty successful response. Those parts depend on the source and are outside this small example&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ffslr0vbab71m36pzf4xn.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ffslr0vbab71m36pzf4xn.jpeg" alt="A laptop displaying analytics charts" width="800" height="530"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  A runnable check
&lt;/h2&gt;

&lt;p&gt;Save the following as &lt;code&gt;check.py&lt;/code&gt; and run &lt;code&gt;python3 check.py&lt;/code&gt;. It uses no network, credentials or external packages&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;timedelta&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;summarize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;end&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;expected&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;day&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;start&lt;/span&gt;
    &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="n"&gt;day&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;end&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;expected&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isoformat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;day&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nf"&gt;timedelta&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;days&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;found&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;day&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'day'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'visits'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;day&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;expected&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;day&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;found&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;count&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'invalid or duplicate row'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;found&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;count&lt;/span&gt;
    &lt;span class="n"&gt;missing&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;sorted&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;expected&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;found&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s1"&gt;'total'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;found&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;values&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;missing&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'missing'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;missing&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s1"&gt;'__main__'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;end&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2026&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2026&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s1"&gt;'day'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'2026-01-01'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'visits'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s1"&gt;'day'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'2026-01-03'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'visits'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;summarize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;end&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s1"&gt;'day'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'2026-01-02'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'visits'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;summarize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;end&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;summarize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;end&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;exc&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;exc&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s1"&gt;': '&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;exc&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The local run returned the following. The second line includes a real zero in the supplied data; the first has an absent day&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{'total': None, 'missing': ['2026-01-02']}
{'total': 5, 'missing': []}
ValueError: invalid or duplicate row
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Where this fits in an agent workflow
&lt;/h2&gt;

&lt;p&gt;A collector obtains authorized data. A deterministic validation step checks structure, coverage and the definitions required by the report. A model then receives the validated values together with any gaps and source information. A person reviews the output before making a consequential decision&lt;/p&gt;

&lt;p&gt;The division between data collection and human judgment is also useful when deciding &lt;a href="https://matintellect.com/en/posts/ai-marketing-agent-tasks-strategy" rel="noopener noreferrer"&gt;which marketing tasks an AI agent can take on&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My own team's marketing-agent instructions separate analytical work from writing final posts and publication. That is a statement about the configured role, not evidence that every live report is correct. The validation example here is a separate teaching example; it is not a claim that this code runs in the team's production system&lt;/p&gt;

&lt;p&gt;A model can summarize the supplied figures, identify questions and draft a briefing. It cannot determine from visit counts alone whether a campaign produced qualified customers. The later stages require their own definitions and authorized sources. If the necessary records are absent, the correct output is a limitation, not an invented conversion rate&lt;/p&gt;

&lt;h2&gt;
  
  
  Failure modes this example does not cover
&lt;/h2&gt;

&lt;p&gt;The function assumes well-formed dictionaries with &lt;code&gt;day&lt;/code&gt; and &lt;code&gt;visits&lt;/code&gt; keys. Missing keys raise &lt;code&gt;KeyError&lt;/code&gt;. It does not validate &lt;code&gt;start &amp;lt;= end&lt;/code&gt;, handle time zones or distinguish source outages from legitimate exclusions. It treats a duplicate as an error rather than trying to reconcile it. An actual integration needs source-specific rules for those cases and tests for them&lt;/p&gt;

&lt;p&gt;Calendar days should be assigned in the source's intended time zone before they reach this function. Comparing two reports built on different day boundaries can mislead even if both have a row for every date. Record the period and zone in the output, and do not silently combine incompatible definitions&lt;/p&gt;

&lt;p&gt;Retries also need a boundary. Retrying a read after a transient timeout may be reasonable, with limits and backoff. Retrying a request that changes a budget or sends a message is a different operation: first establish whether it already succeeded. This demo performs no such writes&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frkkzg452svo4z244t2m4.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frkkzg452svo4z244t2m4.jpeg" alt="Colleagues review printed charts" width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is how it works in my own setup. A separate program collects 20 live questions people ask AI and 10 topics every morning, and the marketer agent adds what worked yesterday and suggests what to post today. Over three months that produced 80 daily briefs and 94 images, and I made the decision at every step: the agent never publishes or spends anything on its own&lt;/p&gt;

&lt;p&gt;The useful outcome is not a perfectly polished paragraph. It is a report that lets the reader trace each number to its source, see missing data and decide what needs investigation. Add the model after the data contract is clear, and keep changes to campaigns outside the summary step&lt;/p&gt;

&lt;p&gt;This article was created with the help of AI.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>automation</category>
      <category>productivity</category>
    </item>
    <item>
      <title>AI content factory: matching Telegram writer replies to requests</title>
      <dc:creator>MatIntellect</dc:creator>
      <pubDate>Tue, 10 Nov 2026 04:51:09 +0000</pubDate>
      <link>https://dev.to/matintellect/correlating-telegram-ai-writer-replies-without-confusing-correlation-for-correctness-4ce6</link>
      <guid>https://dev.to/matintellect/correlating-telegram-ai-writer-replies-without-confusing-correlation-for-correctness-4ce6</guid>
      <description>&lt;p&gt;A Telegram-based writing workflow has an awkward boundary: the content engine sends a text file to a separate AI writer, then receives one or more messages back. The listener needs to know when those messages belong to a particular request and when it can stop waiting&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fz319tweomec8uys0er9v.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fz319tweomec8uys0er9v.jpg" alt="AI content factory illustration featuring Mat" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The implementation in &lt;code&gt;llm.py&lt;/code&gt; uses request IDs, a terminator, buffering and a silence fallback. It also serializes model calls with an &lt;code&gt;asyncio.Lock&lt;/code&gt;. These choices solve a narrow coordination problem. They do not validate the returned prose&lt;/p&gt;

&lt;h2&gt;
  
  
  The request envelope
&lt;/h2&gt;

&lt;p&gt;Every request begins with a JSON line containing three fields:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"request_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"…"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"stage"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"…"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"schema_version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The engine generates a short request ID and asks the writer to put &lt;code&gt;[END:&amp;lt;request_id&amp;gt;]&lt;/code&gt; on the last line. The stage identifies which writing step is running; the schema version labels the envelope format. The code sends the prompt as a &lt;code&gt;.txt&lt;/code&gt; file to &lt;code&gt;@matpibot&lt;/code&gt; through the owner’s Telegram client&lt;/p&gt;

&lt;p&gt;On the receiving side, a &lt;code&gt;NewMessage&lt;/code&gt; listener buffers messages from the configured bot account. It checks each buffer for the current request ID. If the joined text contains the exact end marker, the marker is removed and the waiting future resolves immediately&lt;/p&gt;

&lt;p&gt;This is correlation, not authentication or content validation. The ID lets the engine connect a reply to a pending task under the expected chat/user setup. It says nothing about whether research was adequate, whether the response is complete, or whether its statements are true&lt;/p&gt;

&lt;h2&gt;
  
  
  Why buffer fragments?
&lt;/h2&gt;

&lt;p&gt;A reply can arrive as several Telegram messages, including fragments that split text mid-line. The listener stores messages with timestamps and whether each includes the request ID. &lt;code&gt;_matpibot_join&lt;/code&gt; retains ID-bearing messages and nearby id-less messages in the same burst, then concatenates fragments without inserting a newline inside a burst. Separate bursts are joined with a newline&lt;/p&gt;

&lt;p&gt;There is a subtle detail in the silence path: an ID-bearing message without the terminator schedules a timer. A later message containing that request ID cancels and resets the timer. A fragment without the ID is buffered, but does not reset it; the timer can therefore expire while such fragments are still arriving&lt;/p&gt;

&lt;p&gt;When the timer fires, it resolves the future with the buffered text even though the terminator never arrived. In this implementation, &lt;code&gt;SILENCE_SECONDS&lt;/code&gt; is 15 seconds. That fallback is useful when the writer forgets the marker, but it is still a heuristic: silence is not proof that the writer intended to finish&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwk2djkfypk7rv6tnqy60.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwk2djkfypk7rv6tnqy60.jpeg" alt="People working at a computer. Photo: Pavel Danilyuk, Pexels" width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  One request at a time
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;call_via_matpibot&lt;/code&gt; creates an &lt;code&gt;asyncio.Lock&lt;/code&gt; and enters it before registering the pending future, sending the file and waiting for the answer. The lock is released only when the function exits. Consequently, calls through this path are single-flight: a second call waits for the first send-and-wait operation to finish&lt;/p&gt;

&lt;p&gt;That design avoids overlapping pending conversations through this doorway, making the response-matching story simpler. It trades throughput for simpler coordination. A slow writer blocks later requests even if their prompts are unrelated&lt;/p&gt;

&lt;p&gt;The normal timeout defaults to 600 seconds. On timeout, the future is shielded rather than cancelled and the code waits for a further 60 seconds for a late reply. If that grace period expires, the call returns an empty &lt;code&gt;LLMReply&lt;/code&gt; carrying &lt;code&gt;matpibot_timeout&lt;/code&gt;. A missing client, send exception and timeout are represented as distinct error states. There is no fallback to another model call path&lt;/p&gt;

&lt;h2&gt;
  
  
  State machine sketch
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;idle
  └─ acquire lock; register future and buffer
       └─ send request file
            ├─ matching joined END marker → return answer
            ├─ matching ID, no END → reset 15s silence timer
            │    └─ silence expires → return buffered answer (fallback)
            └─ 600s timeout → wait up to 60s more for late answer
                 └─ still nothing → return timeout error
  └─ remove pending state, cancel timer, delete temporary request file
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Review the protocol separately from editorial quality
&lt;/h2&gt;

&lt;p&gt;The factory’s README describes a broader pipeline: source cards in an “Ideas” topic, a human selects the channel and platforms, the AI writer researches and drafts, then a preview arrives in a “Posts” topic. A person must press “Publish”; otherwise nothing is published. Rewrites, media replacement and cancellation are separate preview actions&lt;/p&gt;

&lt;p&gt;That human review remains necessary even when the transport protocol works perfectly. An ID can be correct while a fact is wrong. A terminator can arrive while the answer is weak. A silence fallback can return buffered text that deserves another review&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1qjmtk7w57opgw60ne0o.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1qjmtk7w57opgw60ne0o.jpeg" alt="Video editing workspace. Photo: Ron Lach, Pexels" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In numbers, from my own setup: the factory reads 13 sources around the clock, drops duplicates and flags the best topics. About an hour of work per post dropped to roughly 5 minutes to a ready preview, and 84 posts have been published, none without my approval. A factory like this takes about a week to set up&lt;/p&gt;

&lt;p&gt;If you are adapting the handoff, exercise the branches in a safe test setup: correct marker, omitted marker followed by silence, fragmented marker, late answer and timeout. Treat those as tests to run, not claims that this article has executed them. Then test the human path independently: a draft should require an explicit publish action, and cancellation should stay a cancellation&lt;/p&gt;

&lt;p&gt;For the non-technical side of the same pipeline, including where human approval sits, see &lt;a href="https://matintellect.com/en/posts/how-to-build-an-ai-content-factory" rel="noopener noreferrer"&gt;how to build an AI content factory&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This article was created with the help of AI.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>automation</category>
      <category>productivity</category>
    </item>
    <item>
      <title>AI agent setup: a memory housekeeping pass you can run on a schedule</title>
      <dc:creator>MatIntellect</dc:creator>
      <pubDate>Mon, 09 Nov 2026 02:43:33 +0000</pubDate>
      <link>https://dev.to/matintellect/how-to-check-whether-an-ai-agent-remembers-your-instructions-52cd</link>
      <guid>https://dev.to/matintellect/how-to-check-whether-an-ai-agent-remembers-your-instructions-52cd</guid>
      <description>&lt;p&gt;Problem: after launch, an agent's memory grows with every conversation, and without rules it fills with long notes and stale one-off facts that keep influencing answers. Result: a small housekeeping pass that flags overlong notes and archives notes nobody used for a set number of days, while pinned rules stay put. Stack: Python 3.10+ standard library (tested on 3.15.2). Boundaries: the pass works on an in-memory list; reading and writing your agent's actual memory files is left to you, because every agent stores them differently&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fld6igz94nuvzmydflnve.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fld6igz94nuvzmydflnve.jpg" alt="AI-generated illustration of setting up an AI agent after launch" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Context: the three setup steps
&lt;/h2&gt;

&lt;p&gt;Memory is the third of three steps I go through with every agent after launch. First, an introduction conversation where the agent interviews me and offers answer options. Second, tools connected one at a time, each tried on a real task. Third, rules for what the agent keeps between conversations and how that memory is cleaned up&lt;/p&gt;

&lt;p&gt;My own rules for the third step are short. Facts are stored in a line or two. Details live in a separate file and the note links to them. Old material is archived rather than deleted. Cleanup runs on a schedule, daily or weekly. The code below turns those rules into something you can test&lt;/p&gt;

&lt;h2&gt;
  
  
  Input, processing, output
&lt;/h2&gt;

&lt;p&gt;Input: a list of notes. Each note has text, the date it was last used, a pinned flag for rules that must never expire, and an optional link to details&lt;/p&gt;

&lt;p&gt;Processing: every note longer than a threshold without a link is flagged for a fix. Every unpinned note unused for more than a set number of days goes to the archive list&lt;/p&gt;

&lt;p&gt;Output: the active notes, the archived notes and a human-readable report of what changed&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fz0diw8it430sch3tskik.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fz0diw8it430sch3tskik.jpeg" alt="Two colleagues talking" width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The example
&lt;/h2&gt;

&lt;p&gt;The notes below are invented for illustration, not taken from a real agent&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;dataclasses&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;dataclass&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;date&lt;/span&gt;

&lt;span class="no"&gt;MAX_FACT&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;120&lt;/span&gt;  &lt;span class="c1"&gt;# characters; longer text belongs in a linked file&lt;/span&gt;

&lt;span class="nd"&gt;@dataclass&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Note&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;last_used&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;date&lt;/span&gt;
    &lt;span class="n"&gt;pinned&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;False&lt;/span&gt;
    &lt;span class="n"&gt;link&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;problems&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;note&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Note&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;out&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;note&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="no"&gt;MAX_FACT&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;note&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;link&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"too long, move details to a file and link it"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;out&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;tidy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;notes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;Note&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;today&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;keep_days&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;active&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;archive&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;report&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;notes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;problems&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;report&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"fix: {n.text[:40]!r}: {p}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;idle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;today&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;last_used&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;days&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;idle&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;keep_days&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;pinned&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;archive&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;report&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"archive: {n.text[:40]!r} (unused {idle} days)"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;active&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;active&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;archive&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;report&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"__main__"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;today&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2026&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;11&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;notes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="nc"&gt;Note&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Owner prefers short answers in the morning"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2026&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;11&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nc"&gt;Note&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Never message clients without approval"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2026&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;pinned&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nc"&gt;Note&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Temporary: conference badge pickup on Oct 3"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2026&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nc"&gt;Note&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Pricing: "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;"details of every package, discount and exception "&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
             &lt;span class="nf"&gt;date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2026&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;11&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;11&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;active&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;archive&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;report&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;tidy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;notes&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;today&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"\n"&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;report&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"active {len(active)}, archived {len(archive)}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output, exactly as printed when I ran it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;archive: 'Temporary: conference badge pickup on Oc' (unused 43 days)
fix: 'Pricing: details of every package, disco': too long, move details to a file and link it
active 3, archived 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The approval rule from August survives because it is pinned, even though nobody "used" it recently. That is the point of pinning: rules that guard against rare, expensive mistakes are exactly the ones that look idle most of the time&lt;/p&gt;

&lt;h2&gt;
  
  
  Design notes
&lt;/h2&gt;

&lt;p&gt;Archive, do not delete. A stale fact sometimes turns out to matter. Moving it out of the active set removes it from everyday answers while keeping it searchable&lt;/p&gt;

&lt;p&gt;Flag, do not rewrite. The pass reports long notes instead of truncating them. Silently cutting a note would hide information; a human or the agent should split it into a short fact plus a linked file&lt;/p&gt;

&lt;p&gt;Define "used" honestly. In the example, last_used is a date you supply. In a real agent you need to update it when a note actually influences an answer, otherwise everything looks idle and gets archived&lt;/p&gt;

&lt;p&gt;Check before archiving. Before notes move, confirm that nothing important is lost and the agent can still find the details. In my setup that check is part of the scheduled run, not an afterthought&lt;/p&gt;

&lt;h2&gt;
  
  
  Where this comes from
&lt;/h2&gt;

&lt;p&gt;My personal agent Jes has been running for 134 days. She runs 10 scheduled jobs on her own and hands tasks to 7 other bots. After each correction she writes a new rule for herself so the mistake does not repeat, which is exactly why memory needs housekeeping: rules accumulate, and some of them stop being useful. Deleting data, spending money, messaging clients and publishing always wait for my explicit yes, and those rules are pinned&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F73ssfmximfy7q8u9fexr.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F73ssfmximfy7q8u9fexr.jpeg" alt="External drive next to a laptop" width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Errors and limits
&lt;/h2&gt;

&lt;p&gt;The pass only measures length and age. It cannot tell whether a short, recent note is wrong. Reading the active memory now and then is still human work&lt;/p&gt;

&lt;p&gt;Thresholds are guesses. Thirty days and 120 characters are starting points; adjust them after a few runs by looking at what got archived and whether anything was missed&lt;/p&gt;

&lt;p&gt;Concurrency: if the agent writes memory while the pass runs, you can lose a note. Run the pass when the agent is idle, or lock the memory store&lt;/p&gt;

&lt;h2&gt;
  
  
  Reproduce it
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Save the code as &lt;code&gt;tidy.py&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;python3 tidy.py&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Confirm the three output lines above&lt;/li&gt;
&lt;li&gt;Set &lt;code&gt;pinned=True&lt;/code&gt; on the conference note and run again: it should stay active and the report should drop the archive line&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The non-technical side of the three setup steps is on my site: &lt;a href="https://matintellect.com/en/posts/ai-agent-setup-after-launch" rel="noopener noreferrer"&gt;AI agent setup: three steps after launch&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This article was created with the help of AI.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>automation</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Updating AI agent models: a regression gate before you switch</title>
      <dc:creator>MatIntellect</dc:creator>
      <pubDate>Sun, 08 Nov 2026 23:15:48 +0000</pubDate>
      <link>https://dev.to/matintellect/updating-ai-agent-model-without-breaking-things-3cpg</link>
      <guid>https://dev.to/matintellect/updating-ai-agent-model-without-breaking-things-3cpg</guid>
      <description>&lt;p&gt;Problem: a new model can be better on benchmarks and still break one behaviour your agent depends on, such as asking for confirmation before sending something. Result of this article: a small gate that replays a fixed set of real tasks on the old and new model, reports lost behaviours and refuses to switch without a verified backup. Stack: plain Python 3.10+ (tested on 3.15.2), no external packages. Boundaries: both models are stubs returning recorded behaviours; wire in your own runs, with real sends switched off&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0o9vxgjkg4gaigc6d241.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0o9vxgjkg4gaigc6d241.jpg" alt="AI-generated illustration of updating an AI agent model safely" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Where this comes from
&lt;/h2&gt;

&lt;p&gt;Every day 8 Claude Code agents work for me, on Sonnet 5 and Opus 5.5 depending on the role. I update them by hand when a major model comes out; the last move was from Opus 5 to Opus 5.5, skipping the versions in between. I move one agent at a time and watch its real work before moving the next&lt;/p&gt;

&lt;p&gt;Backups run automatically at least weekly, with a manual one before every major update. My personal agent, Jes, also has an automatic backup model, so its 10 scheduled jobs keep running if the primary fails&lt;/p&gt;

&lt;p&gt;For clients the stakes are higher: a clinic runs a team of 6 agents on the owner's server, and assistants run for five people on their own servers. A broken upgrade there hits someone else's clients&lt;/p&gt;

&lt;p&gt;The code below is a teaching version of the gate I apply by hand. It is not code from my systems&lt;/p&gt;

&lt;h2&gt;
  
  
  Input, processing, output
&lt;/h2&gt;

&lt;p&gt;Input: a set of real tasks, each with the behaviours a correct run must show (asks for confirmation, reads the date correctly, follows the format), plus the observed behaviours of the old and the new model on each task, and whether the backup has been verified by an actual restore&lt;/p&gt;

&lt;p&gt;Processing: for each task, the gate computes which required behaviours the old model showed and the new one lost. The decision refuses any switch without a restored backup, keeps the old model if there is any regression, and otherwise allows switching this one agent only&lt;/p&gt;

&lt;p&gt;Output: one line per regression and one decision line&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fo0lbj94sdmskayet7vk7.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fo0lbj94sdmskayet7vk7.jpeg" alt="Working at a computer during a system update" width="800" height="524"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The example
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Replay a fixed task set on the old and new model, then decide per agent&lt;/span&gt;
&lt;span class="no"&gt;TASKS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;  &lt;span class="c1"&gt;# (task, what a correct run must do)&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"book a call tomorrow at 15:00"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"asks_confirmation"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"date_ok"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"find a free slot next week"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"date_ok"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"summarise yesterday's messages"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"follows_format"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"send the invoice to the client"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"asks_confirmation"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;run_old&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;   &lt;span class="c1"&gt;# stands in for the current model's recorded behaviour&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"asks_confirmation"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"date_ok"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"follows_format"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;run_new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;   &lt;span class="c1"&gt;# stands in for the candidate model; it skips one confirmation&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startswith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"send"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"date_ok"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"follows_format"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"asks_confirmation"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"date_ok"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"follows_format"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;compare&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tasks&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;old&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;new&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;regressions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;must&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;tasks&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;lost&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;must&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="nf"&gt;old&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;lost&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;regressions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;sorted&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lost&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;regressions&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;decide&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;regressions&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;backup_restored&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;backup_restored&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{agent}: stop, backup not verified by a restore"&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;regressions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{agent}: keep old model, {len(regressions)} regression(s)"&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{agent}: switch this one agent, watch it before the next"&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"__main__"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;regs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;compare&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;TASKS&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;run_old&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;run_new&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;lost&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;regs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"regression: '{task}' no longer does {', '.join(lost)}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;decide&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"calendar-agent"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;regs&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;backup_restored&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;decide&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"calendar-agent"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;backup_restored&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;decide&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"calendar-agent"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;backup_restored&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output, exactly as it printed when I ran it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;regression: 'send the invoice to the client' no longer does asks_confirmation
calendar-agent: keep old model, 1 regression(s)
calendar-agent: stop, backup not verified by a restore
calendar-agent: switch this one agent, watch it before the next
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Reading the result
&lt;/h2&gt;

&lt;p&gt;The new model handles dates and formats as before but stopped asking for confirmation before sending an invoice. On a benchmark that would barely register. For a business agent it is the most important behaviour in the set, which is why the gate compares behaviours rather than scores&lt;/p&gt;

&lt;p&gt;The second line shows the other hard rule: no switch until the backup has been restored at least once. A backup nobody has restored is a hope, not a backup&lt;/p&gt;

&lt;h2&gt;
  
  
  Design notes
&lt;/h2&gt;

&lt;p&gt;Build the task set from real work. About ten tasks the old model definitely handled, including rare ones that run weekly and cautious ones where the agent must stop and ask. For each, record what it was given, what it should do and how to tell it did&lt;/p&gt;

&lt;p&gt;Back up the whole agent. Instructions, memory, code, data and connection settings, not just the model setting. Otherwise a rollback leaves part of the system in the new state&lt;/p&gt;

&lt;p&gt;Switch one agent at a time. Different roles can end up on different models, and that is a normal design rather than a compromise&lt;/p&gt;

&lt;p&gt;Read the provider's notes on what changed between versions before you run anything&lt;/p&gt;

&lt;h2&gt;
  
  
  Errors and trade-offs
&lt;/h2&gt;

&lt;p&gt;Stubs hide variability. Real models do not return the same behaviour every run. Run each task a few times and treat any lost behaviour as a regression worth a look&lt;/p&gt;

&lt;p&gt;A rollback restores the system, not the world. Messages sent or records created in external services during a bad run must be fixed separately, which is why the test runs with real sends off&lt;/p&gt;

&lt;p&gt;Skipping an update is a valid outcome. If the agent works and the new model solves no specific problem, waiting is cheaper than any test&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhuy55zij22a43m0rge00.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhuy55zij22a43m0rge00.jpeg" alt="Checking work on several screens" width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How to reproduce the check
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Save the example as &lt;code&gt;upgrade.py&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;python3 upgrade.py&lt;/code&gt; with Python 3.10 or newer&lt;/li&gt;
&lt;li&gt;Compare the output with the block above&lt;/li&gt;
&lt;li&gt;Make &lt;code&gt;run_new&lt;/code&gt; ask for confirmation on the invoice task and confirm the first decision changes to switching one agent&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For the step-by-step business version, see &lt;a href="https://matintellect.com/en/posts/updating-ai-agent-model-without-breaking" rel="noopener noreferrer"&gt;updating an AI agent model without breaking things&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This article was created with the help of AI.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>automation</category>
      <category>productivity</category>
    </item>
    <item>
      <title>AI agent memory: client records with source, date and a way to forget</title>
      <dc:creator>MatIntellect</dc:creator>
      <pubDate>Sun, 08 Nov 2026 00:54:56 +0000</pubDate>
      <link>https://dev.to/matintellect/ai-agent-memory-how-it-remembers-clients-53k8</link>
      <guid>https://dev.to/matintellect/ai-agent-memory-how-it-remembers-clients-53k8</guid>
      <description>&lt;p&gt;Problem: an agent with client memory will eventually quote an agreement that has changed, mix two clients up, or be unable to delete what a client asked it to forget. Result of this article: a minimal long-term memory layer where every record has a source and a date, a newer agreement retires the older one, clients are kept apart and one call forgets a client completely. Stack: plain Python 3.10+ (tested on 3.15.2), no external packages. Boundaries: in-process storage only; search, summarisation and the database are described in prose and left out of the code&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxosqru5iflvh583l86aq.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxosqru5iflvh583l86aq.jpg" alt="AI-generated illustration of AI agent memory and how it remembers clients" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Where this comes from
&lt;/h2&gt;

&lt;p&gt;My own memory system has layers: a working layer for the current conversation, compression into summaries with the full transcript archived, and long-term records the agent retrieves on demand. Every agent has a rotation, daily or weekly depending on use, that keeps the important parts and archives the rest&lt;/p&gt;

&lt;p&gt;My personal agent, Jes, has been running for 134 days. She remembers earlier conversations, my profile and my rules, and writes herself a new rule after each correction. Since July she has passed 165 tasks to other bots and had to remember who got what and what came back&lt;/p&gt;

&lt;p&gt;Not every agent needs this. The clinic chatbot I built answers only from documents, about 114 price items and 48 services, and keeps no long memory of clients at all&lt;/p&gt;

&lt;p&gt;The code below is a teaching version of the long-term layer only. It is not code from my system&lt;/p&gt;

&lt;h2&gt;
  
  
  Input, processing, output
&lt;/h2&gt;

&lt;p&gt;Input: records with a client, a topic, the text of the agreement, a source reference and a date&lt;/p&gt;

&lt;p&gt;Processing: storing a record on a topic retires any active record for the same client and topic, without deleting it. Recall returns only the active record for that client and topic, with its date, source and how many earlier versions it replaced. Missing records produce an explicit "not on record" instead of a guess. Forget removes every record of one client&lt;/p&gt;

&lt;p&gt;Output: strings the agent can put in its context, each carrying the evidence for the claim&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6dnmiwczx28hfuqlij0s.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6dnmiwczx28hfuqlij0s.jpeg" alt="Archive with rows of filing drawers" width="800" height="535"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The example
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;dataclasses&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;dataclass&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;date&lt;/span&gt;

&lt;span class="nd"&gt;@dataclass&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Record&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;topic&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;source&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;date&lt;/span&gt;
    &lt;span class="n"&gt;active&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Memory&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;records&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;Record&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;remember&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;rec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Record&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="c1"&gt;# a newer record on the same topic retires the older one instead of deleting it&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;old&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;records&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;old&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;rec&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;old&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;topic&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;rec&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;topic&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;old&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;active&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;old&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;active&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;False&lt;/span&gt;
        &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;records&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rec&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;recall&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;topic&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;mine&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;records&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;topic&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;topic&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="n"&gt;current&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;mine&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;active&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;current&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"not on record, ask the client instead of guessing"&lt;/span&gt;
        &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;current&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="n"&gt;note&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;" (replaces {len(mine) - 1} earlier)"&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mine&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{r.text} | agreed {r.on.isoformat()} | source {r.source}{note}"&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;forget&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;before&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;records&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;records&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;records&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;before&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;records&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"__main__"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Memory&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;remember&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Record&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"client-a"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"discount"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"10% on the second order"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"chat#41"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2026&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;remember&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Record&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"client-b"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"delivery"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"deliver on Fridays"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"call#7"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2026&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;remember&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Record&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"client-a"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"discount"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"15% on the second order"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"chat#58"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2026&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"A discount:"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;recall&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"client-a"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"discount"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"A delivery:"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;recall&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"client-a"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"delivery"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"B delivery:"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;recall&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"client-b"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"delivery"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"forgot"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;forget&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"client-a"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"records of client-a"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"A discount:"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;recall&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"client-a"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"discount"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output, exactly as it printed when I ran it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;A discount: 15% on the second order | agreed 2026-10-20 | source chat#58 (replaces 1 earlier)
A delivery: not on record, ask the client instead of guessing
B delivery: deliver on Fridays | agreed 2026-10-05 | source call#7
forgot 2 records of client-a
A discount: not on record, ask the client instead of guessing
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Design notes
&lt;/h2&gt;

&lt;p&gt;Retire, do not overwrite. Keeping the older discount as inactive lets the agent say "this replaced an earlier agreement" and lets a person audit what changed. Overwriting would make the history disappear&lt;/p&gt;

&lt;p&gt;Source and date travel with the fact. The agent never states an agreement without being able to point at the conversation it came from. That is what makes a wrong memory correctable&lt;/p&gt;

&lt;p&gt;Clients are separate by construction. Recall filters by client before anything else, so client B's delivery terms cannot appear in an answer to client A&lt;/p&gt;

&lt;p&gt;"Not on record" is a feature. The most dangerous memory failure is a confident guess. An explicit miss tells the agent to ask&lt;/p&gt;

&lt;p&gt;Forgetting must reach every layer. Here there is only one list. In a real system the same client appears in working memory, summaries, long-term records and archives, and a forget request has to reach all of them&lt;/p&gt;

&lt;h2&gt;
  
  
  Errors and trade-offs
&lt;/h2&gt;

&lt;p&gt;Topic keys are brittle. "discount" and "price reduction" are different keys here. In a real system a separate process files facts into topics, and search should combine meaning and keywords&lt;/p&gt;

&lt;p&gt;Retrieval can still be wrong. Search misses relevant records and sometimes returns stale ones. Important decisions should be checked against the original conversation&lt;/p&gt;

&lt;p&gt;Summaries lose details. Compression saves context but can drop the detail that mattered; keep a link back to the full transcript&lt;/p&gt;

&lt;p&gt;Shared memory across channels is a separate decision. The clinic's voice agent shares memory with the owner's Telegram assistant, so nothing said by voice is lost in chat. That needs one store, not two kept in sync&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9thv9smiiupx8j33yaog.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9thv9smiiupx8j33yaog.jpeg" alt="Servers in blue and red light" width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How to reproduce the check
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Save the example as &lt;code&gt;memory.py&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;python3 memory.py&lt;/code&gt; with Python 3.10 or newer&lt;/li&gt;
&lt;li&gt;Compare the output with the block above&lt;/li&gt;
&lt;li&gt;Add a third discount record for client-a and confirm the recall reports two earlier versions&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For the non-technical version, including where long memory is the wrong choice, see &lt;a href="https://matintellect.com/en/posts/ai-agent-memory-how-it-remembers-clients" rel="noopener noreferrer"&gt;AI agent memory: how it remembers clients&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This article was created with the help of AI.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>automation</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Business process audit: check whether your data can be linked before you add AI</title>
      <dc:creator>MatIntellect</dc:creator>
      <pubDate>Sat, 07 Nov 2026 00:39:09 +0000</pubDate>
      <link>https://dev.to/matintellect/business-process-audit-what-to-check-before-ai-25en</link>
      <guid>https://dev.to/matintellect/business-process-audit-what-to-check-before-ai-25en</guid>
      <description>&lt;p&gt;Problem: before AI can analyse a business, the records of requests, bookings and payments have to connect to each other, and in most small businesses they do not. Result of this article: a short script that traces each payment back to a booking and a request through a shared contact field and reports every gap. Stack: plain Python 3.10+ (tested on 3.15.2), no external packages. Boundaries: the records are invented for teaching; loading real exports from a CRM, calendar or payment system is left to you&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7fqqhct1wxxaw3jlab83.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7fqqhct1wxxaw3jlab83.jpg" alt="AI-generated illustration of a business process audit before AI" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why linking comes first
&lt;/h2&gt;

&lt;p&gt;The most common finding in the audits I run is that data simply is not being collected, or is collected in places that cannot be joined. Payments live in one system, bookings in a calendar, requests in personal chats. An AI connected to all three still cannot tell which channel brings paying clients, because nothing ties the records together&lt;/p&gt;

&lt;p&gt;In my own setup the data does connect. Every client call becomes a transcript, a summary, tasks and a CRM card; a 57-minute call is processed in about 10 minutes, and about 40 calls with 15 clients have gone through the system. A plan for the day is assembled each morning from calendar, tasks and reminders, and has been for 127 days. My marketing agent collects 20 live questions and 10 topics every morning. All of it lands in one place, in a form that can be analysed&lt;/p&gt;

&lt;p&gt;The script below is a teaching tool for the first audit question: can your payments be traced back to where the client came from? It is not code from my system&lt;/p&gt;

&lt;h2&gt;
  
  
  Input, processing, output
&lt;/h2&gt;

&lt;p&gt;Input: three lists. Requests with a contact, a channel and whether they were answered. Bookings by contact. Payments by contact and amount&lt;/p&gt;

&lt;p&gt;Processing: requests are indexed by contact. Each payment is checked against that index and the set of booked contacts. A payment is traced if both exist, otherwise it is reported with the missing link. Unanswered requests are listed separately&lt;/p&gt;

&lt;p&gt;Output: one line per payment, the share of revenue with a known source, and the requests nobody answered&lt;/p&gt;

&lt;p&gt;The contact field is doing all the work here. If your systems do not share some field like it, this is the first thing the audit should fix, before any AI is involved&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5q0ys5mxz165sq09ivdq.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5q0ys5mxz165sq09ivdq.jpeg" alt="Data and charts on a laptop screen" width="800" height="530"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The example
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Which payments can be traced back to a request and a source?&lt;/span&gt;
&lt;span class="no"&gt;REQUESTS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;  &lt;span class="c1"&gt;# (contact, channel, answered)&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"anna@example.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"site"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"+100200300"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"messenger"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"bob@example.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"site"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"+100200301"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"call"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="no"&gt;BOOKINGS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"anna@example.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"+100200300"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"+100200302"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="no"&gt;PAYMENTS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;  &lt;span class="c1"&gt;# (contact, amount)&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"anna@example.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;120&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"+100200300"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;90&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"+100200302"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;150&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;trace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;bookings&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;payments&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;by_contact&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ch&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ans&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ch&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ans&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;booked&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bookings&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;report&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"traced"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"no_request"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"no_booking"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;contact&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;payments&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;contact&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;by_contact&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;report&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"no_request"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;contact&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;contact&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;booked&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;report&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"no_booking"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;contact&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;report&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"traced"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;contact&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;by_contact&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;contact&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;unanswered&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ans&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;ans&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;report&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;unanswered&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"__main__"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;report&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;unanswered&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;trace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;REQUESTS&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;BOOKINGS&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;PAYMENTS&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="no"&gt;PAYMENTS&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;traced&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;report&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"traced"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;contact&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;channel&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;report&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"traced"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"traced   {contact:18} source={channel:9} {amount}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;contact&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;report&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"no_request"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"GAP      {contact:18} paid {amount} but no request on record"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;contact&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;report&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"no_booking"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"GAP      {contact:18} paid {amount} but no booking on record"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"revenue with a known source: {traced} of {total} ({traced / total:.0%})"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"requests without an answer:"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;", "&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;unanswered&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="s2"&gt;"none"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output, exactly as it printed when I ran it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;traced   anna@example.com   source=site      120
traced   +100200300         source=messenger 90
GAP      +100200302         paid 150 but no request on record
revenue with a known source: 210 of 360 (58%)
requests without an answer: bob@example.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Reading the result
&lt;/h2&gt;

&lt;p&gt;In the invented data, 58% of revenue can be traced to a source. One client paid without any request on record, which means they reached the business through a channel nobody logs, perhaps a personal phone or a direct message. One request was never answered. Both are findings, and neither needs AI to fix: they need recording&lt;/p&gt;

&lt;p&gt;That is the general point. Gaps are results. They tell you exactly what to start recording, and an AI cannot reconstruct events that were never written down&lt;/p&gt;

&lt;h2&gt;
  
  
  Design notes
&lt;/h2&gt;

&lt;p&gt;Normalise contacts before matching. Real data mixes phone formats and email capitalisation. A single normalisation function at the point where records enter the system is better than cleaning in every report&lt;/p&gt;

&lt;p&gt;Record the same fields every day. For requests, the time of the message, the channel, whether it was answered and the next step are usually enough. Consistency matters more than detail&lt;/p&gt;

&lt;p&gt;Limit access to the task. Give the script, or the AI, only the fields it needs. I transcribe long client calls on my own computer so clients' voices do not leave it; the same caution applies to exports of conversations and payments&lt;/p&gt;

&lt;p&gt;Keep the output checkable. Each gap line names a contact and an amount, so a person can verify it in a minute. An audit result that cannot be checked is a list of wishes&lt;/p&gt;

&lt;h2&gt;
  
  
  Errors and trade-offs
&lt;/h2&gt;

&lt;p&gt;Shared contacts can mislead. A family or a company may pay from one contact for several people. Treat traced revenue as a lower bound on what you understand, not as exact attribution&lt;/p&gt;

&lt;p&gt;Missing bookings are not always errors. Some businesses sell without bookings. Remove the check if it does not apply&lt;/p&gt;

&lt;p&gt;Existing agents need the same treatment. If a business already has AI agents that keep breaking, the audit starts with an inspection and no changes: what works, what is broken, where the keys are, what is spending money. Finishing such a system takes 1–2 weeks depending on its size&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzc6kprhiqkk7jrkeiyob.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzc6kprhiqkk7jrkeiyob.jpeg" alt="Work documents and data on a desk" width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How to reproduce the check
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Save the example as &lt;code&gt;linkcheck.py&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;python3 linkcheck.py&lt;/code&gt; with Python 3.10 or newer&lt;/li&gt;
&lt;li&gt;Compare the output with the block above&lt;/li&gt;
&lt;li&gt;Replace the three lists with a month of your own exports, keeping only the contact, channel, answered and amount fields&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For the non-technical checklist behind this, including what to record first, see &lt;a href="https://matintellect.com/en/posts/business-process-audit-before-ai" rel="noopener noreferrer"&gt;business process audit: what to check before AI&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This article was created with the help of AI.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>automation</category>
      <category>productivity</category>
    </item>
    <item>
      <title>AI implementation cost: a payback check before you buy anything</title>
      <dc:creator>MatIntellect</dc:creator>
      <pubDate>Fri, 06 Nov 2026 05:13:12 +0000</pubDate>
      <link>https://dev.to/matintellect/ai-implementation-cost-what-the-first-step-involves-1e0o</link>
      <guid>https://dev.to/matintellect/ai-implementation-cost-what-the-first-step-involves-1e0o</guid>
      <description>&lt;p&gt;Problem: AI budgets are set by comparing subscription prices, while the question that decides whether it pays off is how many hours a specific task frees after you count the time spent checking the output. Result: a tiny calculator that sums monthly lines and compares the monthly value of freed hours with the AI bill. Stack: Python 3.10+ standard library (tested on 3.15.2). Boundaries: the payback cases use invented numbers; my own monthly lines are real&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1ey29gdw4pmpf4sehqt9.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1ey29gdw4pmpf4sehqt9.jpg" alt="AI-generated illustration of AI implementation cost" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The numbers behind it
&lt;/h2&gt;

&lt;p&gt;The floor for running an AI system is roughly 30 dollars a month: a model subscription and a cloud server. A server matters because a system on a laptop stops when the lid closes or the power goes out. My own bill for models and server is about 270 dollars a month: Claude Code 200, ChatGPT 20, GLM 20, server 30; with services like ElevenLabs and HeyGen it is around 300. That runs 8 Claude Code agents, a personal agent with 10 scheduled jobs, and a content factory that has published 84 posts&lt;/p&gt;

&lt;p&gt;For clients I install systems on their own server and subscription, so the model bill goes straight to the provider; AI assistants run that way for five people, and a clinic owner runs 6 agents&lt;/p&gt;

&lt;h2&gt;
  
  
  Input, processing, output
&lt;/h2&gt;

&lt;p&gt;Input: monthly cost lines; and for a candidate task, weekly hours before AI, hours after AI, weekly hours a person spends reviewing AI output, the value of that person's hour, and the monthly AI bill attributable to the task&lt;/p&gt;

&lt;p&gt;Processing: freed hours per month equals (before minus after minus review) times weeks per month; value equals freed hours times hourly value; net equals value minus the bill&lt;/p&gt;

&lt;p&gt;Output: the monthly total, and per task freed hours, value, bill and net&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5rffmn7sr8bl2mwos669.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5rffmn7sr8bl2mwos669.jpeg" alt="Working out a budget" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The example
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;monthly&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lines&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lines&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;values&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;payback&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hours_before&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;hours_after&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;review_hours&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;hourly_value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;ai_monthly&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;weeks&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;4.33&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="s2"&gt;"""Monthly value of freed time versus the monthly AI bill."""&lt;/span&gt;
    &lt;span class="n"&gt;freed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hours_before&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;hours_after&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;review_hours&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;weeks&lt;/span&gt;
    &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;freed&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;hourly_value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"freed_hours"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;freed&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"ai_bill"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ai_monthly&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s2"&gt;"net"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;ai_monthly&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"__main__"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;mine&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"claude_code"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"chatgpt"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"glm"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"server"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"models and server:"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;monthly&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mine&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;# invented teaching case: one task, one person, weekly hours&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;payback&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hours_before&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;hours_after&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;review_hours&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;hourly_value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ai_monthly&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;payback&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hours_before&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;hours_after&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;review_hours&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;hourly_value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ai_monthly&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output, exactly as printed when I ran it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;models and server: 270
{'freed_hours': 19.5, 'value': 292.27, 'ai_bill': 30, 'net': 262.27}
{'freed_hours': 1.3, 'value': 19.49, 'ai_bill': 30, 'net': -10.51}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first invented task pays back many times over. The second loses money even at the floor price, because the task barely takes time to begin with. The model is the same; the task choice decides the outcome&lt;/p&gt;

&lt;h2&gt;
  
  
  Design notes
&lt;/h2&gt;

&lt;p&gt;Review time is part of "after". Leaving it out is the most common way payback calculations lie. In every chain I run the last decision is human, and that time is real&lt;/p&gt;

&lt;p&gt;Separate one-off from monthly. Setup, connecting services and testing are one-off; subscriptions, server and support are monthly. Mixing them makes small pilots look expensive and large systems look cheap&lt;/p&gt;

&lt;p&gt;Subscription versus pay-as-you-go. A subscription and API access are billed differently; OpenAI, for example, bills ChatGPT and the API separately. With pay-as-you-go the bill scales with requests, so plug in your expected volume, not a pilot week&lt;/p&gt;

&lt;p&gt;Pick the task before the plan. Overpaying usually comes from buying the most expensive tier "to grow into" or building a large system before testing one task&lt;/p&gt;

&lt;p&gt;Count hidden costs explicitly. Extra services for voice, video and images, support after launch, and growth in model usage all belong in the monthly bill. Add them as separate lines instead of padding one number, so you can see later which one grew and decide whether it still earns its place&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup time is a cost too
&lt;/h2&gt;

&lt;p&gt;From my projects: a personal assistant on your own server and subscription from one day; a subtitle helper from 3 days; a turnkey content factory in about a week; a voice agent on top of an existing system in about 2 weeks; a team of agents, a customer chatbot or call and CRM automation in about 2–3 weeks&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxds422zywsp5h1mi1fma.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxds422zywsp5h1mi1fma.jpeg" alt="Working with documents and numbers" width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Small budgets
&lt;/h2&gt;

&lt;p&gt;A small budget is not a reason to wait. Start with a ready-made subscription and the one task that takes the most time; after a month the payback check tells you whether to take the next step. Losing one subscription is cheap; losing a budget on a large system that never paid back is not&lt;/p&gt;

&lt;h2&gt;
  
  
  Limits
&lt;/h2&gt;

&lt;p&gt;Hourly value is a simplification; for salaried staff use the value of what they would do with the freed time&lt;/p&gt;

&lt;p&gt;Quality is not in the formula. A faster process that produces worse work is not a saving&lt;/p&gt;

&lt;p&gt;The first weeks are not representative. Review takes longer until corrections become rules; recalculate after a month&lt;/p&gt;

&lt;h2&gt;
  
  
  Reproduce it
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Save the code as &lt;code&gt;budget.py&lt;/code&gt; and run &lt;code&gt;python3 budget.py&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Replace the cost lines with your own&lt;/li&gt;
&lt;li&gt;Measure one real task for a week before and after, including review&lt;/li&gt;
&lt;li&gt;Rerun the payback with your numbers&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The non-technical version: &lt;a href="https://matintellect.com/en/posts/ai-implementation-cost-first-step" rel="noopener noreferrer"&gt;AI implementation cost: what the first step involves&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This article was created with the help of AI.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>automation</category>
      <category>productivity</category>
    </item>
    <item>
      <title>AI bot vs chatbot: split each step between a program and a model before you build</title>
      <dc:creator>MatIntellect</dc:creator>
      <pubDate>Thu, 05 Nov 2026 03:03:23 +0000</pubDate>
      <link>https://dev.to/matintellect/ai-bot-vs-chatbot-how-to-choose-3hkh</link>
      <guid>https://dev.to/matintellect/ai-bot-vs-chatbot-how-to-choose-3hkh</guid>
      <description>&lt;p&gt;Problem: bots get built "on the model" end to end, and then cost money on every trivial step, behave differently from day to day, and let wrong numbers through inside fluent text. Result: a tiny planning helper that assigns each step of a job to a program or a model using two rules: exact data always goes to code, and only steps that need interpretation go to a model. Stack: Python 3.10+ standard library (tested on 3.15.2). Boundaries: keyword matching is a teaching device, not a classifier; the point is the decision rule, which a human applies in real projects&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fg0wl6txcgp3zmqunp5kr.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fg0wl6txcgp3zmqunp5kr.jpg" alt="AI-generated illustration of an AI bot vs a chatbot" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The distinction
&lt;/h2&gt;

&lt;p&gt;An ordinary bot is a program: it follows rules the developer wrote and behaves the same every time. It can have memory, files, services and a schedule. An AI bot has a language model attached, so it can interpret varied wording and choose a next step within what it is allowed. A model does not bring memory, schedules or file access by itself; the application provides those, and the model asks the application to act through function calls&lt;/p&gt;

&lt;h2&gt;
  
  
  How my systems split the work
&lt;/h2&gt;

&lt;p&gt;My morning plan is a plain program: calendar, tasks and reminders in one message, 127 days in a row, with reminders checked every 5 minutes and 240 sent so far. No model involved. My content factory splits: code watches 13 sources, selects topics, checks and publishes; a model gathers material, writes and checks facts. The marketer's brief: a Python program collects 20 live questions and 10 topics, and an agent adds what worked yesterday. The clinic chatbot answers with a model, but only from documents covering about 114 price items and 48 services, with prices read by code&lt;/p&gt;

&lt;h2&gt;
  
  
  Input, processing, output
&lt;/h2&gt;

&lt;p&gt;Input: a job written as a list of steps in plain language&lt;/p&gt;

&lt;p&gt;Processing: if a step mentions exact data (price, date, count, total, time slot), assign it to the program; else if it needs interpretation (depending on, understand, summarise, phrase), assign it to the model; otherwise the program&lt;/p&gt;

&lt;p&gt;Output: each step with its owner, and the share of steps that need a model&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7o4j75mfc935a2b7e5mh.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7o4j75mfc935a2b7e5mh.jpeg" alt="Working with a program" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The example
&lt;/h2&gt;

&lt;p&gt;The steps describe a generic customer-reply bot, invented for illustration&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="no"&gt;MODEL_MARKERS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"depending on"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"as appropriate"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"understand"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"work out"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"summarise"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"phrase"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="no"&gt;EXACT_MARKERS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"price"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"date"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"count"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"sum"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"total"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"time slot"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;assign&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;step&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;step&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;any&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="no"&gt;EXACT_MARKERS&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"program"&lt;/span&gt;          &lt;span class="c1"&gt;# exact data always goes to code&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;any&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="no"&gt;MODEL_MARKERS&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"model"&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"program"&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;plan&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;steps&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;rows&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;assign&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;steps&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;share&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;who&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;rows&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;who&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"model"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;share&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"__main__"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;steps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s2"&gt;"receive the message"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"understand what the customer is asking, depending on wording"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"look up the price and free time slot"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"phrase a reply with the returned numbers"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"check the reply contains only returned numbers"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"send or hand over to a person"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;share&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;plan&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;steps&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;who&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{who:8} {s}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"model share: {share:.0%}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output, exactly as printed when I ran it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;program  receive the message
model    understand what the customer is asking, depending on wording
program  look up the price and free time slot
model    phrase a reply with the returned numbers
program  check the reply contains only returned numbers
program  send or hand over to a person
model share: 33%
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two of six steps need a model. The price lookup stays in code even though it sits in the middle of a conversation, and a separate code step checks that the model's reply contains only the numbers code returned&lt;/p&gt;

&lt;h2&gt;
  
  
  Design notes
&lt;/h2&gt;

&lt;p&gt;Exact data wins ties. A step that both interprets and touches a price is split into two steps, so the price part can go to code. If you cannot split it, the step is badly defined&lt;/p&gt;

&lt;p&gt;Checks after model steps. Every model step should be followed by a program or human check when its output matters: numbers, client messages, anything public&lt;/p&gt;

&lt;p&gt;Cost follows the split. Program steps cost nearly nothing to run; model steps cost tokens or subscription quota on every call. The model share is a rough proxy for running cost&lt;/p&gt;

&lt;p&gt;Reliability follows it too. Program steps produce the same result every time. Model steps can vary, which is fine for wording and dangerous for facts&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fk0i9v1an1lb2artol9og.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fk0i9v1an1lb2artol9og.jpeg" alt="Discussing a decision" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  A quick manual version
&lt;/h2&gt;

&lt;p&gt;You do not need code to apply the rule. Write the job as steps on paper, and next to each step write "program" or "model". Ask of every model step: could I describe this without "depending on" or "work out what they meant"? If yes, cross it out and write "program". Then add a check after every remaining model step whose output reaches a customer or touches money&lt;/p&gt;

&lt;h2&gt;
  
  
  Signs the split is wrong
&lt;/h2&gt;

&lt;p&gt;High monthly cost for a bot that does the same simple thing every time: model steps that should be code. Frequent failures on unusual wording: code steps that need a model. Confident wrong numbers: exact data assigned to a model. Forgotten conversations: memory not implemented, which no model fixes&lt;/p&gt;

&lt;h2&gt;
  
  
  Reproduce it
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Save the code as &lt;code&gt;split.py&lt;/code&gt; and run &lt;code&gt;python3 split.py&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Compare with the output above&lt;/li&gt;
&lt;li&gt;Write your own job as steps and run it&lt;/li&gt;
&lt;li&gt;Treat the output as a draft; argue with every "model" assignment before building&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The non-technical version: &lt;a href="https://matintellect.com/en/posts/ai-bot-vs-chatbot-how-to-choose" rel="noopener noreferrer"&gt;AI bot vs chatbot: how to choose&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This article was created with the help of AI.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>automation</category>
      <category>productivity</category>
    </item>
    <item>
      <title>AI content factory vs content manager: a cost model where platforms are the variable</title>
      <dc:creator>MatIntellect</dc:creator>
      <pubDate>Wed, 04 Nov 2026 03:59:38 +0000</pubDate>
      <link>https://dev.to/matintellect/ai-content-factory-vs-content-manager-which-fits-46p1</link>
      <guid>https://dev.to/matintellect/ai-content-factory-vs-content-manager-which-fits-46p1</guid>
      <description>&lt;p&gt;Problem: "factory or manager" debates compare a salary with a subscription and ignore the variable that actually decides it, the number of platforms each post must be adapted for. Result: a small cost model that adds fixed monthly costs, amortised setup and people's time, and shows where the two options cross. Stack: Python 3.10+ standard library (tested on 3.15.2). Boundaries: all numbers in the example are invented for teaching; plug in your own rates and minutes&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkkuz0fah4cl0byjkp7f0.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkkuz0fah4cl0byjkp7f0.jpg" alt="AI-generated illustration of an AI content factory vs a content manager" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The model in words
&lt;/h2&gt;

&lt;p&gt;A post has a first version and then adaptations: a website article, a Telegram post, an Instagram caption, an English version. The first version costs roughly the same however you make it, because someone still has to decide what to say. The adaptations are where the routine lives, and that cost grows with every platform&lt;/p&gt;

&lt;p&gt;A content factory shrinks the per-platform cost to a few minutes of review, but adds fixed costs: setup, model subscriptions, a server, support. So on one platform it rarely pays off, and on many it usually does. The model below makes that crossover visible&lt;/p&gt;

&lt;p&gt;Note that the second option is "manager with factory", not "factory instead of manager". Someone still chooses topics and approves every post&lt;/p&gt;

&lt;h2&gt;
  
  
  Input, processing, output
&lt;/h2&gt;

&lt;p&gt;Input: per option, a fixed monthly cost, an hourly rate for people's time, minutes for the first version, minutes per extra platform, and optionally a setup cost spread over a number of months; plus posts per month and number of platforms&lt;/p&gt;

&lt;p&gt;Processing: hours = posts times (first + per-platform times extra platforms) / 60; cost = fixed + setup share + hours times rate&lt;/p&gt;

&lt;p&gt;Output: monthly cost per option for several platform counts&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1hmnu8o2i7mwuz8ntjws.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1hmnu8o2i7mwuz8ntjws.jpeg" alt="Laptop and content material" width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The example
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;monthly_cost&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;option&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;posts&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;platforms&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="s2"&gt;"""Full monthly cost: fixed money plus people's time at an hourly rate."""&lt;/span&gt;
    &lt;span class="n"&gt;rate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;option&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"hourly_rate"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;hours&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;posts&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;option&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"minutes_first"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;option&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"minutes_per_extra_platform"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;platforms&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;
    &lt;span class="n"&gt;setup&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;option&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"setup"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;option&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"setup_months"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;option&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"fixed_monthly"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;setup&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;hours&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;rate&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"__main__"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# invented teaching numbers, not real prices&lt;/span&gt;
    &lt;span class="n"&gt;manager&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"fixed_monthly"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"hourly_rate"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"minutes_first"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"minutes_per_extra_platform"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;with_factory&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"fixed_monthly"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"hourly_rate"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"minutes_first"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"minutes_per_extra_platform"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="s2"&gt;"setup"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"setup_months"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;platforms&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;monthly_cost&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;manager&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;posts&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;platforms&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;platforms&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;monthly_cost&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;with_factory&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;posts&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;platforms&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;platforms&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{platforms} platform(s): manager only {m}, manager with factory {f}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output, exactly as printed when I ran it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1 platform(s): manager only 160.0, manager with factory 220.0
3 platform(s): manager only 320.0, manager with factory 236.0
6 platform(s): manager only 560.0, manager with factory 260.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With these invented numbers the manager alone is cheaper on one platform, and the factory wins from three platforms up, with the gap widening as platforms grow. Your crossover will sit elsewhere; the shape is what matters&lt;/p&gt;

&lt;h2&gt;
  
  
  Design notes
&lt;/h2&gt;

&lt;p&gt;Count review time. A factory does not remove people's time, it moves it from rewriting to checking. In my own setup every post waits for my approval, and that time belongs in the model&lt;/p&gt;

&lt;p&gt;Amortise setup honestly. Spreading setup over too many months flatters the factory. Use the period you actually expect to run it&lt;/p&gt;

&lt;p&gt;Use real minutes. Measure one ordinary post end to end before plugging in numbers. Guesses about "how long it takes" are usually low for the manual option and low for review in the automated one&lt;/p&gt;

&lt;p&gt;Keep quality outside the number. The model compares cost, not results. A post that goes out wrong under your name costs more than any line here&lt;/p&gt;

&lt;h2&gt;
  
  
  What to measure before plugging numbers in
&lt;/h2&gt;

&lt;p&gt;Take one ordinary post and time every step: finding the topic, gathering material, checking facts, writing the first version, each platform version, pictures, publishing. Do it for two or three posts, not one, because the first is usually slower. With a factory, time the review of each preview the same way. Those minutes, not estimates, are what make the model useful&lt;/p&gt;

&lt;h2&gt;
  
  
  Reference point
&lt;/h2&gt;

&lt;p&gt;My own factory watches 13 sources around the clock, checks facts before drafting and prepares separate versions for Telegram and the website in two languages and for Facebook, Instagram, Threads and YouTube. A post that took about an hour by hand reaches a ready preview in about 5 minutes; 84 posts have been published, none without approval. A turnkey setup like that takes me about a week including connecting the platforms&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ffxjcl2jiq4q4f9dhxyin.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ffxjcl2jiq4q4f9dhxyin.jpeg" alt="Discussing content at a table" width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Limits
&lt;/h2&gt;

&lt;p&gt;Posting frequency matters as much as platforms. Run the model for your real monthly post count&lt;/p&gt;

&lt;p&gt;Hourly rate is a simplification. If the manager is salaried, use the share of their time the work takes, or the value of what they would do instead&lt;/p&gt;

&lt;p&gt;The model ignores ramp-up. In the first weeks review takes longer, until edits turn into rules&lt;/p&gt;

&lt;h2&gt;
  
  
  Reproduce it
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Save the code as &lt;code&gt;cost.py&lt;/code&gt; and run &lt;code&gt;python3 cost.py&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Compare with the output above&lt;/li&gt;
&lt;li&gt;Replace the invented numbers with your measured minutes, rates and costs&lt;/li&gt;
&lt;li&gt;Find the platform count where the two lines cross&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The non-technical version is on my site: &lt;a href="https://matintellect.com/en/posts/ai-content-factory-vs-content-manager" rel="noopener noreferrer"&gt;AI content factory vs content manager: which fits&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This article was created with the help of AI.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>automation</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
