<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mindaugas Nakrosis on Medium]]></title>
        <description><![CDATA[Stories by Mindaugas Nakrosis on Medium]]></description>
        <link>https://medium.com/@mindaugasnakr?source=rss-b1e4a6e14bbd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*TEPde9zRfNJlOXR9RlqYog.jpeg</url>
            <title>Stories by Mindaugas Nakrosis on Medium</title>
            <link>https://medium.com/@mindaugasnakr?source=rss-b1e4a6e14bbd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 02:54:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mindaugasnakr/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The on-call engineer who never sleeps: building an AI agent to triage FIX trading incidents]]></title>
            <link>https://mindaugasnakr.medium.com/the-on-call-engineer-who-never-sleeps-building-an-ai-agent-to-triage-fix-trading-incidents-7e19d3d09005?source=rss-b1e4a6e14bbd------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e19d3d09005</guid>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <dc:creator><![CDATA[Mindaugas Nakrosis]]></dc:creator>
            <pubDate>Thu, 24 Sep 2026 00:00:38 GMT</pubDate>
            <atom:updated>2026-09-25T06:56:16.795Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3ezC2xPSWG0Moy54.jpg" /></figure><p>How I replaced the first forty minutes of every FIX incident with an agent that investigates, cites its evidence and hands a human a diagnosis.</p><p>It’s 10:14 on a Tuesday and an alert fires: <em>reject rate high on session ACME_FIX44</em>. Anyone who has run a FIX-based trading platform knows what happens next, and knows that the hard part is not the fix. It’s finding it.</p><p>Someone on call drops what they’re doing. They open the log search and filter by session. They scroll through rejects, copy a tag number, look it up in the FIX spec, and check whether the client reconnected recently. They query the orders database, check the message broker for consumer lag, ask in Slack whether anyone deployed something, and search the wiki for a runbook that may or may not be current. Forty minutes later they have the answer: the client started sending PutOrCall as C instead of 1 after restarting their engine. The fix takes five minutes. Finding it took the rest.</p><p>As VP of Technology at Intick, a block trading venue for futures and options, I owned the FIX connectivity into our counterparties. Incidents like this weren’t rare, and they weren’t hard. They were <em>slow</em>, because the knowledge needed to solve them was spread across six systems and a few senior people’s heads. So I designed and shipped an AI agent to do the first pass. Not a chatbot that summarises logs, but an agent that investigates the way a good engineer does: it forms a hypothesis, pulls the evidence it needs and stops when the evidence is conclusive.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oVWqXEuplRu8U6Uoa-QQOg.png" /><figcaption>The engineer stops being the orchestrator. The agent does the running around; the human still makes the call.</figcaption></figure><h3>Why FIX incidents are slow to triage</h3><p>No single step is difficult. The problem is that every incident could live in one of four layers, and you don’t know which until you look:</p><ul><li><strong>Session layer:</strong> sequence gaps, resend storms, heartbeat timeouts, a certificate that expired overnight.</li><li><strong>Message layer:</strong> a missing required tag, an enum value the counterparty doesn’t accept, a repeating group with the wrong count.</li><li><strong>Business layer:</strong> unknown instrument, limit breach, an order in the wrong state.</li><li><strong>Infrastructure:</strong> broker lag, a dead consumer, messages piling up in a dead-letter queue.</li></ul><p>Each layer lives in a different system. FIX logs in one place, order state in PostgreSQL, broker health behind an admin API, runbooks in Confluence, deploy history in CI. The engineer’s real job during triage is <em>orchestration</em>: knowing which system to check next based on what the last one said.</p><p>That orchestration is exactly what agents are good at.</p><h3>What an agent actually is</h3><p>Strip away the marketing and an agent is three things:</p><ol><li><strong>A language model</strong> that reasons about what it’s seeing.</li><li><strong>Tools:</strong> ordinary functions you write, such as “get rejects for this session in this window” or “look up this FIX tag”.</li><li><strong>A loop:</strong> the model asks for a tool, your code runs it and returns the result, and the model decides what to do next. Repeat until it has an answer.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*23CNCM1Jr4QRM6KbKokJSg.png" /><figcaption>The model never touches your database. It can only ask.</figcaption></figure><p>The model can’t execute anything. It can only <em>request</em> a tool call, and your code decides whether and how to answer. That one fact shapes the whole design, and it’s what makes this safe enough for a trading environment. The list of tools you send with each request is, quite literally, the agent’s permission boundary: if a tool isn’t offered, it can’t be called.</p><h3>The same incident, investigated by an agent</h3><p>Here is how the agent handles that incident. The client name and details are changed, but the shape is typical.</p><p>The alert arrives. Before the model is involved at all, plain code parses the alert payload and pre-fetches the obvious context: recent session events, a reject summary and broker health. The model’s starting picture:</p><ul><li>The client logged out at 09:58 and back in at 10:01 with a sequence reset.</li><li>37 session-level rejects since then, all on QuoteRequest, all pointing at tag 201 with reason code 5 (“value incorrect for this tag”).</li><li>The broker is healthy: no lag, empty dead-letter queue.</li></ul><p>Then it investigates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zkGlMS-0kvh6h_sD0jI-Xg.png" /><figcaption>Five tool calls, well under a minute, and every claim in the report points at a specific message.</figcaption></figure><p>The report it posts back to the Slack thread:</p><blockquote><strong><em>Root cause (high confidence):</em></strong><em> ACME began sending PutOrCall (201) as </em><em>C/ </em><em>P instead of FIX 4.4 </em><em>0/ </em><em>1 after reconnecting at 10:01 with a sequence reset, most likely a client-side engine upgrade. No deploys or config changes on our side.</em></blockquote><blockquote><strong><em>Evidence:</em></strong><em> seq 14 at 10:03:41 rejected with reason 5 on tag 201; 37 identical rejects since.</em></blockquote><blockquote><strong><em>Next steps:</em></strong><em> contact ACME to confirm the engine change; short-term per-client enum override per runbook (requires four-eyes approval).</em></blockquote><p>Notice what the agent <em>didn’t</em> do. It didn’t dig into order state, business rules or the broker. The evidence pointed at the message layer, so it followed the evidence and stopped. That branching is the whole point. A hardcoded script would either check everything every time, or miss the case nobody anticipated.</p><h3>The design decisions that matter</h3><p>A demo like this takes an afternoon. Making it something you can trust in a regulated trading environment comes down to decisions. These are the six that mattered most.</p><h3>1. Deterministic where it must be, agentic where it must branch</h3><p>There’s a spectrum between a rigid workflow (fixed steps, AI summarises at the end) and a fully autonomous agent (vague goal, the AI decides everything). Neither end works well, so we split it deliberately.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6KJ8cSlpGKwCVL5ziPRCLg.png" /><figcaption>The model is used exactly where judgement is needed, and nowhere else.</figcaption></figure><p>Monitoring alerts are structured JSON, so parsing them is code, not AI. So are deduplication, validation, formatting and audit logging. The model’s only job is the part that genuinely branches: deciding what to look at next.</p><h3>2. Tools, never raw database access</h3><p>It’s tempting to hand the model a SQL connection and let it write its own queries. Don’t.</p><p>Every data source sits behind a narrow, named tool such as get_session_rejects(session, start, end). Behind it are parameterised queries, a read-only database role on a replica, a five-second statement timeout and hard row limits. The model chooses <em>which</em> tool to call and with what arguments. It never writes the query, and its arguments are validated before anything runs, because those arguments may have been influenced by text the model read along the way, such as a free-text field in a client&#39;s FIX message.</p><p>This makes the agent safer, and also <em>better</em>. A tool that returns “37 rejects, grouped by reason” is more useful to the model than 10,000 raw log lines, and far cheaper.</p><h3>3. Mask sensitive data inside the tool, not in the prompt</h3><p>In block trading, information leakage is the cardinal sin. Account IDs, legal entity identifiers, order sizes and prices must not leave your environment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VwzxOPRuXker0J-2dSz0ng.png" /><figcaption>“Please don’t repeat account numbers” in a prompt is a wish. Masking in code is a control.</figcaption></figure><p>Two details make this work. Identifiers are replaced with <em>consistent</em> HMAC tokens, so the model can still tell that every reject came from one account without knowing which account. And sizes become bands rather than disappearing, so a zero quantity or an absurdly large order is still visible. The diagnosis survives; the sensitive data doesn’t. The masker gets its own unit tests against real message shapes, because a missed tag is a data leak.</p><h3>4. Right-size the model</h3><p>The instinct is to reach for the biggest model available. For triage that’s the wrong call. The task is bounded (a handful of tool calls, pattern-matching against known failure modes) and latency matters, because during an incident people are watching the Slack thread. An alert storm that triggers twenty runs in a minute also needs to stay affordable.</p><p>The investigation loop runs on Claude Sonnet 5 at medium effort, and Claude Haiku 4.5 handles the trivial job of turning a human’s Slack message (“ACME rejects since 10:14”) into structured fields. When the evals show accuracy falling short, the first move is to raise the effort level, not to reach for a bigger model.</p><h3>5. The agent doesn’t learn. You do.</h3><p>This is the most common misconception I hear about agents like this one. Clicking thumbs-up on the agent’s report does not make it smarter. The model’s weights never change from your usage, and every run starts fresh with the same instructions and tools.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I3Cvg0TzXk9sLAgZBc3dSQ.png" /><figcaption>Improvement is an engineering loop, gated by evals.</figcaption></figure><p>Improvement comes from engineering discipline:</p><ul><li><strong>Evals.</strong> Take 30 to 50 historical incidents with known root causes, record what the tools returned at the time, and replay them against the agent. Every prompt change, tool change or model upgrade has to hold or improve the score before it merges. It’s a test suite, just for judgement instead of logic.</li><li><strong>Feedback as data.</strong> A thumbs-down opens a short form asking what the actual cause was. The run’s full trace gets reviewed, the gap gets fixed (a missing tool, a confusing tool description, a masking rule that hid the key field), and the incident joins the eval set.</li><li><strong>Memory through lookup.</strong> Confirmed diagnoses go into a searchable index of past incidents. Next time, the agent can find “we saw this exact enum issue in March”. What it can <em>reach</em> grows, even though the model doesn’t.</li></ul><h3>6. Humans stay in the loop</h3><p>The agent is read-only by design. It has no tool that can send a FIX message, reset a sequence number or change a client’s configuration. It diagnoses and recommends; a human decides and acts. Every claim must cite a specific message (session, sequence number, timestamp) so the engineer can verify in seconds rather than trust blindly, and when the evidence is thin it’s instructed to say “inconclusive” rather than guess.</p><h3>What it looks like in production</h3><p>The architecture is less exotic than people expect.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IDFDWAEIfR982lcckNA-Hg.png" /><figcaption>Plain Python and asyncio, the Slack Bolt SDK, the Anthropic SDK and the Azure SDKs. No heavyweight agent framework needed for one focused agent.</figcaption></figure><ul><li><strong>A small always-on listener</strong> in Azure Container Apps. It receives monitoring alerts by webhook and Slack mentions over an outbound websocket (Socket Mode), so there’s no public endpoint to defend.</li><li><strong>A queue</strong> between listener and worker, because alerts arrive in bursts and agent runs take seconds to minutes. It also means a restart mid-run doesn’t lose the job.</li><li><strong>A worker</strong> that scales from zero when jobs arrive, runs the agent loop and posts the report back to the thread.</li></ul><p>Everything the agent touches is logged: every tool call and its arguments, which prompt version ran, tokens used. In a regulated environment, “the AI said so” is not an audit trail. “The AI called these five tools, saw these results and concluded this” is. I’ve written separately about <a href="https://nakrosis.com/writing/how-to-audit-ai-agents">how to audit AI agents</a>; this design was built to pass that audit from day one.</p><h3>Traditional versus agentic triage</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TGMj3UZV6239YXUj4-z-Cw.png" /></figure><p>The agent doesn’t replace the on-call engineer. It replaces the first forty minutes of their incident: the part that was always orchestration rather than engineering.</p><h3>Where this goes next</h3><p>Once the tools existed, they were reusable. We extracted them into MCP servers used across the company, so tools like fix-dictionary and fix-logs became available to developers in their IDE (&quot;why is this client getting reason 5 on tag 201?&quot;) and to other agents. These are the agents I would build on top of them next:</p><ul><li><strong>An onboarding agent</strong> that reads a new client’s FIX specification, diffs it against your dictionary and drafts the configuration, mapping and certification test plan. Onboarding is usually the real bottleneck in a B2B trading network.</li><li><strong>A conformance agent</strong> that runs certification scenarios against UAT sessions and explains the failures.</li><li><strong>A change-impact agent</strong> that answers “if we change this tag, which clients break?” from real traffic rather than stale documentation.</li></ul><p>Build the tools once and every agent benefits.</p><h3>The real shift</h3><p>The traditional view treats incident triage as a skill that lives in senior engineers. The agentic view treats it as a <em>process that can be encoded</em>: the investigation strategy in a prompt, the access in tools, the safety in code and the quality in an eval suite.</p><p>That’s the part of agents I think is most often missed. The AI isn’t smarter than your best engineer. But your best engineer’s approach can now run at 3 a.m., on every alert, in under a minute, and show its work.</p><p><em>I build AI agents that run in production, move teams onto AI workflows and automate operations through </em><a href="https://trustflux.co.uk/#agentic-ai"><em>Trustflux Ltd</em></a><em>. If you run a trading or payments platform and your incident response still depends on who happens to be on call, </em><a href="https://nakrosis.com/contact"><em>get in touch</em></a><em>.</em></p><p>Newsletter</p><p>Get new pieces on building AI agents, moving teams onto AI workflows and automating operations by email when they come out.</p><p>Free. Unsubscribe any time.</p><p><em>Originally published at </em><a href="https://nakrosis.com/writing/fix-triage-agent"><em>https://nakrosis.com</em></a><em> on September 24, 2026.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e19d3d09005" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Your AI Agent Works in the Demo. Can You Explain What It Did Last Night?]]></title>
            <link>https://mindaugasnakr.medium.com/your-ai-agent-works-in-the-demo-can-you-explain-what-it-did-last-night-4391b624d56a?source=rss-b1e4a6e14bbd------2</link>
            <guid isPermaLink="false">https://medium.com/p/4391b624d56a</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[ai-agent]]></category>
            <dc:creator><![CDATA[Mindaugas Nakrosis]]></dc:creator>
            <pubDate>Wed, 29 Jul 2026 07:01:03 GMT</pubDate>
            <atom:updated>2026-07-29T07:01:03.544Z</atom:updated>
            <content:encoded><![CDATA[<p><em>An agent you cannot reconstruct is an agent you cannot deploy. In regulated environments, that is not a preference — it is the gate.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yObVXJDetTapvJjEGUdOeg.png" /></figure><p>At 02:14 an agent picked up a job. It read a queue, called four tools, updated three records, and decided one case did not need a human. By 09:00 someone in operations has noticed that one of those records looks wrong, and asks the only question that matters: what exactly did it do, and why?</p><p>The dashboards are green. Uptime was fine, latency was fine, the error rate was zero. Every one of those numbers is true and none of them answers the question. You can prove the agent ran. You cannot explain what it decided.</p><p>That gap is the whole problem. Traditional monitoring watches the system; agent observability explains the chain of decisions between the request and the outcome. Most teams do not discover the difference until they need it, which is the worst possible moment to find out that the reasoning was never recorded.</p><p>I have spent most of the last decade in FinTech and asset trading, where “the system did something and we cannot say why” is not an inconvenience to triage next sprint. It is a compliance failure that stops the deployment. Agents do not get an exemption from that standard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*McpKg1ds91Bvoby2iPm70g.png" /></figure><h3>The pilot-to-production chasm is an observability problem</h3><p>The numbers on agent adoption look impressive until you separate adoption from deployment. KPMG’s AI Pulse survey, published on 31 March 2026 and covering 2,110 senior leaders across 20 countries, found that only 11% of organisations qualify as leaders actively scaling AI agents across operations. The other 89% are running pilots, managing isolated deployments, or not seeing the returns they expected. McKinsey’s State of AI survey the previous November pointed the same direction: 62% of organisations at least experimenting with agents, 23% scaling in even one function.</p><p>That is not a capability gap. The models are good enough. The frameworks work. The demo genuinely does what the demo says it does.</p><p>It is a trust gap, and trust is downstream of observability. An engineering leader signing off on a production deployment is being asked to accept accountability for decisions they cannot inspect. The rational answer is no. So the pilot stays a pilot, and everyone blames “the technology not being ready” when what is missing is the ability to answer for it afterwards.</p><p>Here is the distinction I would put on a wall.</p><p><strong>Monitoring</strong> watches outputs and system health: latency, uptime, error rates, throughput. It tells you the agent ran and whether it fell over.</p><p><strong>Observability</strong> explains the chain of decisions between the request and the outcome: what the agent believed, what it chose to do about it, what came back, and how that changed what it did next.</p><p>A monitored agent that silently made a bad decision looks identical to a monitored agent that made a good one. Both return 200. That is why the dashboards were green at 09:00.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wmyUvJu2iREr9KUHAyJrUg.png" /></figure><h3>What observability actually means for an agent</h3><p>An agent’s trace is not a log line. It is a hierarchical record: each reasoning step, each tool call with its inputs and outputs, each state transition, memory reads and writes, and the model responses that drove all of it. The industry has converged on six signals worth tracking — tokens, cost, latency, errors, tool and model calls, and output quality — and on OpenTelemetry’s GenAI semantic conventions as the shape to record them in, with invoke<em>agent wrapping </em><em>chat and </em><em>execute_tool spans beneath it. Most </em><em>gen</em>ai.* attributes still carry Development stability badges, so the names can move. The structure is settling faster than the vocabulary.</p><p>I did not want to take any of this on faith, so I built a ReAct agent from scratch — no framework, raw Anthropic API, a while loop and a list — specifically to see what a reasoning cycle actually produces when you record every step of it. It takes a repository with failing tests and debugs it autonomously.</p><p>Writing this article exposed a hole in it. The loop rendered a perfectly readable trace to my terminal and then threw it away when the window closed. That is a debug log. It is not an audit trail, and I had been quietly calling it one. So I added a --trace flag that serialises every iteration to JSON.</p><p>Here is record 6 of 9 from a real run against an off-by-one bug, copied out of the file unedited:</p><pre>{<br>  &quot;iteration&quot;: 6,<br>  &quot;thought&quot;: &quot;The bug is clear. Both `findmax` and `findmin` use<br>              `range(len(items) - 1)` which skips the last element. It should<br>              be `range(len(items))` (or alternatively `range(1, len(items))`).&quot;,<br>  &quot;actions&quot;: [<br>    {<br>      &quot;tool&quot;: &quot;edit_file&quot;,<br>      &quot;input&quot;: {<br>        &quot;path&quot;: &quot;buggy_code.py&quot;,<br>        &quot;old_string&quot;: &quot;    for i in range(len(items) - 1):  # BUG: should be range(len(items))&quot;,<br>        &quot;new_string&quot;: &quot;    for i in range(len(items)):&quot;<br>      },<br>      &quot;tooluse_id&quot;: &quot;toolu01LA7bNLcm4rd5aQuRvmYCXP&quot;<br>    }<br>  ],<br>  &quot;observations&quot;: [<br>    {<br>      &quot;tooluse_id&quot;: &quot;toolu01LA7bNLcm4rd5aQuRvmYCXP&quot;,<br>      &quot;output&quot;: &quot;Successfully replaced 1 occurrence in buggy_code.py&quot;,<br>      &quot;is_error&quot;: false,<br>      &quot;truncatedformodel&quot;: false<br>    }<br>  ],<br>  &quot;tokens_cumulative&quot;: 14809,<br>  &quot;elapsed_seconds&quot;: 29.27,<br>  &quot;prev_hash&quot;: &quot;66853d8984ed6d66bed5d5cd78d71840acbb3e1eacfecb105587b729359cb675&quot;,<br>  &quot;record_hash&quot;: &quot;af9e89a2dcec386959ac19159248900356483a3ec3d383cba4cb186c3697ca88&quot;<br>}</pre><p>Read that as an auditor rather than as an engineer and the value becomes obvious.</p><p>thought is the only field that tells you <em>why</em>. Strip it out and you have a record of a file being edited by an automated process for no stated reason. It is the difference between a diff and a justification.</p><p>actions[].input is the exact payload, not a summary of it. When something goes wrong, &quot;the agent edited a file&quot; is useless and &quot;the agent replaced this string with that string in this path&quot; is a root cause. Note that it is a list: the model can return several tool calls in one turn, and a trace that records only the first one is lying by omission.</p><p>observations[].output is what the agent actually saw come back — which is frequently not what you assume it saw. Most agent failures I have looked at are not reasoning failures. They are the agent reasoning perfectly well over a truncated, malformed, or stale observation.</p><p>tokens_cumulative is the boring one that saves you money, because runaway loops show up as a cost curve long before they show up as an incident.</p><p>prev<em>hash and </em><em>record</em>hash are what turn a log into evidence. Each record is hashed with the hash of the record before it, so editing iteration 3 invalidates records 4 through 9, and deleting a step breaks the chain link. That is roughly what EU AI Act Article 12 means by tamper-evident logging, and it is about twenty lines of hashlib. One caveat worth naming: a chain stored in the same file it protects only defeats an editor who does not recompute it. Real tamper-evidence needs the final digest anchored where the writing process cannot reach — an append-only store, a signed receipt, a WORM bucket.</p><p>Then the finding I did not expect, which is the whole argument for writing traces down.</p><p>In that nine-iteration run, the thought field was empty five times.</p><p>The model went straight to a tool call with no stated reason on more than half the steps. It still solved the problem correctly, including a second instance of the bug I had not asked it to find. But if you had asked me beforehand whether my agent explained its reasoning at every step, I would have said yes — I had watched it run several times and the output looked coherent. The steps where it said nothing did not register as absences.</p><p>Reasoning capture is not something you get by default because the model is usually chatty. The text block is optional, the model skips it whenever the next action feels obvious, and “usually explains itself” is not a standard any auditor will accept. If you need a stated reason for every consequential action, force it — make rationale a required parameter on the tool schema, or capture extended thinking — then measure your coverage rather than assuming it.</p><p>I only know this about my own agent because I wrote the trace to disk and counted. That is the whole thesis in one example.</p><p>The insight is about timing. Record this from the first sprint and a production incident is an afternoon of reading. Bolt it on after the incident and you are reconstructing a crime scene with no cameras — interviewing the model about what it might have been thinking eight hours ago, which is exactly as reliable as it sounds.</p><p><em>[Screenshot: a full terminal run showing consecutive THOUGHT / ACTION / OBSERVATION panels, so the reader sees the rhythm rather than a single record — and note the iterations where the THOUGHT panel is absent entirely]</em></p><h3>Why regulated industries cannot skip this</h3><p>In trading, healthcare, or lending, “the model decided” is not an answer you can give a regulator, an auditor, or a risk committee. It is not a partial answer that needs more detail. It is a non-answer, and the people asking have the authority to stop your deployment over it.</p><p>This is less novel than it sounds. Regulated firms already run on audit trails: every trade, every privileged access, every production change has a record, an approver, and a timestamp. Nobody in that world argues the principle. An autonomous agent taking consequential actions is a new actor inside a control environment that has demanded this of every other actor for decades. It feels like a burden only because agent frameworks arrived without it.</p><p>The regulatory deadline is no longer theoretical either. The EU AI Act’s obligations for high-risk systems apply from 2 August 2026 — days away as I write this. Article 12 requires tamper-evident logging retained for at least six months. Article 14 requires that a natural person can effectively oversee the system, understand its limitations, interpret its output, and stop it. Article 72 requires post-market monitoring from day one of deployment. Non-compliance carries fines up to €35 million or 6% of global turnover.</p><p>Read Articles 12 and 14 as an engineer and they describe a trace and an approval gate. That is the entire technical requirement. The compliance department is asking for the thing good engineering practice would give you anyway.</p><p>The approval gate is where this gets interesting, because the tooling has just caught up. On 21 July 2026 Yubico shipped YubiKey 5.8, built on CTAP 2.3 with a developer preview of the WebAuthn signing extension. It turns a hardware key from a session-entry gate into a per-action authorisation primitive: an agent proposes a schema change or a large transfer, and nothing executes without a cryptographic signature proving a physically present human approved that action at that moment.</p><p>A logged approval says someone clicked a button. A hardware-signed approval is evidence that survives an adversarial reading.</p><p>So the reframe I would offer any engineering leader treating governance as drag: the audit trail is not overhead that slows the deployment down. It is the permission slip that lets you deploy into higher-value scenarios at all. Teams with trace-level observability and a working approval gate get to point agents at consequential work. Teams without one are permanently restricted to the low-stakes end of the problem space, which is precisely where agents are least worth the effort.</p><p><em>[Screenshot: a simple flow diagram — agent proposes action → risk classifier → reversible actions execute and log; irreversible actions block on hardware-signed human approval → both paths write to the same trace]</em></p><h3>Observability and evaluation are two halves of one practice</h3><p>Observability tells you what the agent did. Evaluation tells you whether it was any good. Running one without the other is a common and expensive mistake: traces without evaluation give you an instrumented system nobody reads until something breaks, and evaluation without traces gives you a score with no path back to the reasoning step that produced it.</p><p>The pattern that works is continuous evaluation against sampled production traffic. Score somewhere between 1% and 10% of production traces with an LLM-as-judge, watch the scores over time to catch drift, and promote any flagged trace into a regression test so a failure found in production becomes a permanent check in CI. That last step is what turns evaluation from a report into a ratchet.</p><p>There is a deeper point here about which agents actually ship. Every skill I have built for regulated work targets a verifiable domain: md-to-jira produces a backlog you can inspect, azure-cost-review produces findings you can check against the bill, spec-check produces findings that cite the authority they rest on. In each case a reviewer can hold the output against ground truth and say yes or no.</p><p>That is not an aesthetic preference — it is what makes evaluation possible at all. You cannot run LLM-as-judge against a domain where nobody can say what “correct” looks like. Which is why agents in verifiable domains — code, tickets, cloud spend, structured document review — are the ones crossing into production, while open-ended browser automation is still generating impressive demos and very few deployments. Verifiability determines whether you can evaluate. Evaluation determines whether you can trust. Trust determines whether you can deploy.</p><h3>What to actually do about it</h3><p>Five things, in the order I would do them.</p><p><strong>1. Instrument from sprint one.</strong> Trace every reasoning step and every tool call with its full input and output, not just the request and the final response. Retrofitting this after an incident is the single most expensive way to acquire it.</p><p><strong>2. Treat the trace as an audit artefact, not a debug log.</strong> The most commonly skipped recommendation, and I had skipped it myself. A trace that only exists in a scrollback buffer cannot be reviewed by risk or compliance, and cannot be produced six months later when someone asks. Serialise it, structure it so a non-engineer can read it, chain the records so edits are detectable, and ship the verifier alongside the writer — a tamper-evident log nobody verifies provides exactly as much assurance as no log at all.</p><p><strong>3. Add a human approval gate for irreversible actions.</strong> Classify the action space by reversibility, not by importance. Scope agent permissions tightly, let reversible actions run, and block the small set of things you cannot undo behind an explicit approval — cryptographically signed if the stakes justify it.</p><p><strong>4. Run continuous evaluation against sampled traces.</strong> Do not wait for a complaint. Complaints are a lagging indicator with terrible coverage.</p><p><strong>5. Find your shadow agents.</strong> Gartner published guidance in April 2026 on managing agent sprawl, and the underlying problem is familiar: teams deploying agents with no central registration, no ownership, and no monitoring. Shadow IT surfaced bad answers. A shadow agent holds credentials and takes autonomous action. Know what is running before you are asked.</p><h3>The morning after</h3><p>Back to 09:00, and the question: what did it do, and why?</p><p>In a system built this way, that question is boring. You open the trace. You read the reasoning step, the tool call, the exact input, what came back, and what the agent did next. Ten minutes, not two days, and you can hand the record to someone in risk without translating it first.</p><p>That is what production-readiness looks like. Not the demo, not the benchmark — the unglamorous ability to reconstruct every decision after the fact, in a form somebody outside engineering can read.</p><p>The teams that win with agents over the next two years will not be the ones with the most capable systems. They will be the ones who can always answer for what their agents did — because in a regulated environment that answer is the difference between a pilot and a deployment.</p><p><em>I build agentic tooling for regulated environments through Trustflux Ltd — Claude Code skills for spec review, Azure cost audit, and backlog generation, all designed around verifiable output and readable traces. The ReAct debugger, including the </em><em>--trace writer and the chain verifier described here, and the rest of the work, is at </em><a href="https://nakrosis.com/"><em>nakrosis.com</em></a><em>. The spec-review skill is open source at </em><a href="https://github.com/mindaugasnakrosis/notion-spec-checker"><em>github.com/mindaugasnakrosis/notion-spec-checker</em></a><em>.</em></p><p><strong>Sources</strong></p><ul><li><a href="https://enterprisedna.co/resources/news/kpmg-ai-pulse-enterprise-agent-adoption-2026/">KPMG AI Pulse survey, 31 March 2026</a></li><li><a href="https://prefactor.tech/learn/ai-agent-adoption-statistics">McKinsey State of AI, November 2025</a></li><li><a href="https://opentelemetry.io/blog/2026/genai-observability/">OpenTelemetry GenAI observability and semantic conventions</a></li><li><a href="https://artificialintelligenceact.eu/article/14/">EU AI Act, Article 14 — Human oversight</a></li><li><a href="https://www.yubico.com/press-releases/yubico-extends-passkeys-beyond-trusted-authentication-to-verified-authorization-with-launch-of-yubikey-5-8/">Yubico — YubiKey 5.8, verified authorisation, 21 July 2026</a></li><li><a href="https://www.gartner.com/en/newsroom/press-releases/2026-04-28-gartner-identifies-six-steps-to-manage-artificial-intelligence-agent-sprawl">Gartner — six steps to manage AI agent sprawl, April 2026</a></li><li><a href="https://www.braintrust.dev/articles/continuous-evaluation-ai-agents-trace-classifications-2026">Braintrust — continuous evaluation with trace classifications</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4391b624d56a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Built a Self-Debugging AI Agent from Scratch — Here’s Exactly How the Reasoning Cycle Works]]></title>
            <link>https://mindaugasnakr.medium.com/i-built-a-self-debugging-ai-agent-from-scratch-heres-exactly-how-the-reasoning-cycle-works-c0ae1e9cf4c5?source=rss-b1e4a6e14bbd------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0ae1e9cf4c5</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Mindaugas Nakrosis]]></dc:creator>
            <pubDate>Wed, 10 Jun 2026 07:01:02 GMT</pubDate>
            <atom:updated>2026-06-10T07:01:02.760Z</atom:updated>
            <content:encoded><![CDATA[<h3><em>No LangChain. No agent framework. Just the raw Anthropic API and a Python loop.</em></h3><p>I recently built a self-debugging agent that takes a repository with failing tests and autonomously finds and fixes the bug. Not using LangChain, AutoGPT, or any agent framework — just the raw Anthropic API and about 200 lines of Python.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*La-EoFDBt0mnPn4B01efyQ.png" /></figure><p>The reason: I wanted to actually understand how AI agents work, not just call a library and hope for the best. If you’ve ever looked at an “AI agent” and thought <em>but what is it actually doing?</em> — this article is for you.</p><h3>What Is a ReAct Agent?</h3><p>ReAct (Reasoning + Acting) is a pattern introduced in a 2022 paper by Yao et al. The core idea is elegantly simple: give a language model tools it can call, and let it alternate between three steps until it’s done:</p><ol><li><strong>THOUGHT</strong> — the model reasons about what it knows and what it needs to find out</li><li><strong>ACTION</strong> — it calls a tool to gather information or make a change</li><li><strong>OBSERVATION</strong> — it reads the result and updates its understanding</li></ol><p>Then it loops. Each <strong>THOUGHT</strong> is informed by every <strong>OBSERVATION</strong> that came before it. The context window becomes a working memory that accumulates evidence across iterations.</p><p>This sounds simple. The implementation is where it gets interesting.</p><h3>The Core Problem: The API Has No Memory</h3><p>Here’s the thing most people miss: <strong>Claude has no memory between API calls.</strong> Every single call is completely stateless. Send a message, get a response — the model has no idea what happened in the previous call.</p><p>So how does an “agent” that runs for 10 iterations remember what it tried in iteration 3?</p><p>The answer is almost anticlimactic: <strong>you keep a list and send the entire thing on every call.</strong></p><pre>self.messages: list[dict] = []  # this IS the agent&#39;s memory</pre><p>After three iterations, this list looks like:</p><pre>[<br>  { role: &quot;user&quot;,      content: &quot;Debug fixtures/01off_byone, tests are failing...&quot; },<br>  { role: &quot;assistant&quot;, content: [TextBlock(&quot;I&#39;ll run the tests first&quot;), ToolUseBlock(&quot;run_tests&quot;)] },<br>  { role: &quot;user&quot;,      content: [toolresult(&quot;1 failed: assert findmax([1,2,3,4,5]) == 5, got 4&quot;)] },<br>  { role: &quot;assistant&quot;, content: [TextBlock(&quot;The test shows findmax returns 4 instead of 5...&quot;), ToolUseBlock(&quot;readfile&quot;)] },<br>  { role: &quot;user&quot;,      content: [tool_result(&quot;4: for i in range(len(items) - 1):  # BUG&quot;)] },<br>  { role: &quot;assistant&quot;, content: [TextBlock(&quot;Found it. range(len(items) - 1) skips the last element&quot;), ToolUseBlock(&quot;edit_file&quot;)] },<br>  { role: &quot;user&quot;,      content: [toolresult(&quot;Successfully replaced 1 occurrence in buggycode.py&quot;)] },<br>]</pre><p>Every iteration appends two things to this list: the assistant’s thought + tool call, and the tool’s result. The next API call sends the whole list. The model reads the entire transcript from scratch and responds as if it “remembers” — but it doesn’t. It just re-reads the conversation you handed it.</p><p><strong>The context window is the agent’s working memory. Nothing more.</strong></p><h3>How Tool Calls Actually Work at the API Level</h3><p>When you pass tools=TOOL_DECLARATIONS to the Anthropic API, you&#39;re sending Claude a list of JSON schemas describing what actions are available. Claude reads the descriptions to decide which tool to use. Vague descriptions lead to bad tool choices — this is actually prompt engineering.</p><pre>{<br>    &quot;name&quot;: &quot;read_file&quot;,<br>    &quot;description&quot;: &quot;Read the contents of a file. Optionally specify a line range. Use this to inspect code you suspect contains the bug.&quot;,<br>    &quot;input_schema&quot;: {<br>        &quot;type&quot;: &quot;object&quot;,<br>        &quot;properties&quot;: {<br>            &quot;path&quot;: {&quot;type&quot;: &quot;string&quot;},<br>            &quot;start_line&quot;: {&quot;type&quot;: &quot;integer&quot;},<br>            &quot;end_line&quot;: {&quot;type&quot;: &quot;integer&quot;},<br>        },<br>        &quot;required&quot;: [&quot;path&quot;],<br>    },<br>}</pre><p>The API response has a content field that is a <strong>list of blocks</strong>, not a single string. Two types matter:</p><ul><li><strong>TextBlock</strong> — the model’s reasoning in plain English (the THOUGHT)</li><li><strong>ToolUseBlock</strong> — which tool to call and what arguments (the ACTION)</li></ul><pre>response.content = [<br>    TextBlock(text=&quot;The test fails on the last element. Let me look at the loop bounds...&quot;),<br>    ToolUseBlock(id=&quot;tooluabc123&quot;, name=&quot;read_file&quot;, input={&quot;path&quot;: &quot;buggycode.py&quot;}),<br>]</pre><p>The TextBlock comes first — reasoning before acting. That’s the “Reason” in ReAct. Then comes the action.</p><h3>The Contract You Must Not Break</h3><p>Here’s the part that took me a debugging session to understand properly.</p><p>When Claude returns a ToolUseBlock, the API establishes a <strong>strict contract</strong>: before your next API call, you must send back a tool<em>result block whose </em><em>tool_use</em>id matches the id in the ToolUseBlock. If you don&#39;t — 400 error.</p><p>The conversation structure the API enforces:</p><pre>Turn 1: user      → task description<br>Turn 2: assistant → [thought text] + [tooluse  id=&quot;abc&quot;  name=&quot;runtests&quot;]<br>Turn 3: user      → [toolresult   tool_useid=&quot;abc&quot;  content=&quot;1 failed...&quot;]<br>Turn 4: assistant → [thought text] + [tooluse  id=&quot;def&quot;  name=&quot;readfile&quot;]<br>Turn 5: user      → [toolresult   tool_useid=&quot;def&quot;  content=&quot;line 4: range(len...&quot;]</pre><p>This broke for me when Claude returned <strong>two</strong> ToolUseBlocks in a single response — list<em>files and </em><em>read_file in the same turn. My code only sent back one </em><em>tool</em>result. The API rejected it immediately.</p><p>The fix: collect every ToolUseBlock from the response, execute every one, return all results in a single user message.</p><pre># WRONG: only handles the last tool call<br>for block in response.content:<br>    if block.type == &quot;tool_use&quot;:<br>        tool_call = ToolCall(name=block.name, input=block.input, id=block.id)<br> <br># RIGHT: collect all of them<br>tool_calls: list[ToolCall] = []<br>for block in response.content:<br>    if block.type == &quot;tool_use&quot;:<br>        tool_calls.append(ToolCall(name=block.name, input=block.input, id=block.id))</pre><p>Claude may request parallel tool calls when it can gather multiple pieces of information at once. Every single one needs a matching result in the next message, or the entire request fails.</p><h3>The Loop Structure in Full</h3><p>Here’s the complete loop, simplified. This is the entire agentic pattern:</p><pre># 1. Seed the conversation with the task<br>messages.append({&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: &quot;Debug this repo, tests are failing...&quot;})<br> <br>while iteration &lt; max_iterations:<br> <br>    # 2. Ask Claude: given everything you&#39;ve seen, what next?<br>    response = client.messages.create(<br>        model=&quot;claude-sonnet-4-6&quot;,<br>        tools=TOOL_DECLARATIONS,<br>        messages=messages,       # the FULL history every time<br>    )<br> <br>    # 3. Parse the response into thought + tool calls<br>    thought = &quot;&quot;<br>    tool_calls = []<br>    for block in response.content:<br>        if block.type == &quot;text&quot;:<br>            thought += block.text          # THOUGHT: the reasoning<br>        elif block.type == &quot;tool_use&quot;:<br>            tool_calls.append(block)       # ACTION: what to do<br> <br>    # 4. Stop if the agent declares success or failure<br>    if any(tc.name == &quot;finish&quot; for tc in tool_calls):<br>        break<br> <br>    # 5. Execute every tool call<br>    results = [(tc.id, execute(tc)) for tc in tool_calls]<br> <br>    # 6. Append everything to history<br>    messages.append({&quot;role&quot;: &quot;assistant&quot;, &quot;content&quot;: response.content})<br>    messages.append({&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: [<br>        {&quot;type&quot;: &quot;toolresult&quot;, &quot;tool_useid&quot;: id, &quot;content&quot;: result.output}<br>        for id, result in results<br>    ]})<br> <br>    # 7. Loop — Claude now sees the new observations and reasons again</pre><p>That’s it. Seven steps. Every agent framework you’ll ever use — LangChain, the Claude agent SDK, AutoGen — is some variation of this loop with more scaffolding around it.</p><h3>What the Agent Actually Did</h3><p>I gave the agent a Python file with an off-by-one bug: range(len(items) - 1) instead of range(len(items)). The tests were failing because the loop skipped the last element.</p><p>The agent never saw the bug description. It had to find it.</p><p>In six iterations it:</p><ol><li>Ran tests → saw assert find_max([1,2,3,4,5]) == 5 failing with value 4</li><li>Listed files → identified buggy_code.py as the source</li><li>Read the file → saw range(len(items) - 1) with no surrounding context</li><li>Formed the hypothesis: “the loop iterates indices 0 through n-2, skipping the last element”</li></ol><p>5. Called edit_file with the fix</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*noXg3RcU1hCC6NuLqeti1Q.png" /></figure><p>6. Called finish with an accurate root cause summary</p><p>Nobody told it that range(len(items) - 1) skips the last element. It connected: test fails on the last element + loop stops one short of the last element = bug.</p><p>That connection happened inside a single <strong>THOUGHT</strong> block — plain English reasoning, visible in the terminal, formed by reading the test failure and the source code in sequence. The context window was doing what a developer’s working memory does.</p><h3>Why Not Just Ask “What’s Wrong With This Code?” in One Shot?</h3><p>You could. For a small, self-contained file, a one-shot prompt would likely find the same bug.</p><p>But the agent pattern scales to things a single prompt can’t handle:</p><ul><li><strong>The bug is in file B, but you only know it exists because test A failed</strong> — you need to navigate there</li><li><strong>The fix requires reading context</strong> — imports, constants, how functions call each other</li><li><strong>Verification matters</strong> — apply the fix, then run the tests again to confirm</li><li><strong>Errors teach</strong> — if edit_file fails because the string wasn&#39;t found exactly, the agent reads the error and tries differently</li></ul><p>A single prompt gets one shot. The agent gets as many shots as you give it iterations. Each shot is informed by every observation that came before it.</p><h3>The Execution Sandbox</h3><p>One last piece: when the agent calls run<em>tests or </em><em>edit</em>file, those calls need to execute somewhere safely. We used Docker.</p><p>The agent’s edits need to persist across tool calls within a run — it can’t apply a fix and then have run_tests see the original file. So the setup is:</p><ol><li>Copy the repo to a temporary directory at the start of a run</li><li>Start a Docker container with that directory mounted at /repo</li><li>File reads and writes go directly to the tmpdir on the host</li><li>Command execution (pytest, arbitrary shell commands) goes through docker exec</li><li>Both see the same files because the tmpdir IS /repo via the volume mount</li></ol><p>The container runs with --network none so the agent can&#39;t make outbound HTTP requests, and --memory 512m to prevent runaway resource usage. At the end of the run — success or failure — the container stops and the tmpdir is deleted.</p><p>The clean separation is the point: the ReAct loop itself doesn’t change between Phase 1 (fake stubs) and Phase 2 (real Docker). Only what execute_tool() calls at the bottom changes. The reasoning cycle is completely independent of the execution environment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NlJCiWY2RMlYQs31MsSbaA.png" /></figure><h3>What I Learned</h3><p>The ReAct pattern is not magic. It’s a while loop with a list. The “intelligence” is entirely the language model’s — the loop just gives it a structure to gather information before committing to an answer.</p><p>The hardest part isn’t the loop. It’s the details:</p><ul><li>Every tool<em>use needs a matching </em><em>tool</em>result in the very next message</li><li>Parallel tool calls are real and your code must handle all of them</li><li>Tool descriptions are prompt engineering — write them carefully</li><li>The context window fills up — you need to truncate long observations before they blow the token budget</li></ul><p>The full code is on GitHub: <a href="https://github.com/mindaugasnakrosis/ai-react-loop">https://github.com/mindaugasnakrosis/ai-react-loop</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0ae1e9cf4c5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Review Pull Requests With AI From My Terminal — Here’s How to Set It Up in 15 Minutes]]></title>
            <link>https://mindaugasnakr.medium.com/i-review-pull-requests-with-ai-from-my-terminal-heres-how-to-set-it-up-in-15-minutes-1bf09fdaa9e8?source=rss-b1e4a6e14bbd------2</link>
            <guid isPermaLink="false">https://medium.com/p/1bf09fdaa9e8</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Mindaugas Nakrosis]]></dc:creator>
            <pubDate>Thu, 04 Jun 2026 12:51:48 GMT</pubDate>
            <atom:updated>2026-06-04T12:51:48.974Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>A step-by-step guide to installing Claude Code and using it to review Azure DevOps PRs — for developers who’ve never touched an AI coding tool.</strong></p><p>A colleague stopped by my desk last month, watched me paste a PR URL into my terminal, and said: “what the hell was that?” I’d just given a 40-file diff a thorough first pass in under three minutes. He’d been staring at the same PR for twenty.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ImepCRXqlnRsdkRk5v1jFQ.png" /></figure><p>I’m a technical architect. I review pull requests on Azure DevOps every day. For the past few months I’ve been using Claude Code — Anthropic’s terminal-based AI coding tool — to do the first pass automatically. It fetches the diff via the Azure DevOps API, reads every changed file, spots issues I’d be likely to miss at 4pm on a Friday, and posts review comments directly to the PR thread. Not a summary. Actual inline comments, on specific files and lines.</p><p>There’s no beginner guide for this specific workflow. Most AI-in-coding articles assume you’re building something new. This one assumes you want to review code faster. Here’s the full setup, from zero to posting review comments on Azure DevOps, in roughly 15 minutes.</p><h3>What is Claude Code?</h3><p>Claude Code is a command-line tool made by Anthropic — the company behind the Claude family of AI models. You install it once, run it in your terminal, and talk to it in plain English.</p><p>It’s not an IDE plugin. It’s not a chat window you copy-paste code into. It’s an agent: it has read access to your filesystem, can run shell commands, call external APIs, and write files. You describe what you want done, and it decides how to approach it.</p><p>For PR reviews, that means: you give it a pull request URL, it calls the Azure DevOps REST API to fetch the diff, reads through every changed file, applies its judgement to identify issues, and then calls the same API to post its findings as comments.</p><p>The current models available through Claude Code are:<br>1. <strong>Opus 4.8<br>2. Sonnet 4.6<br>3. Haiku 4.5</strong></p><p>For most PR reviews, Sonnet handles diffs well. Opus is worth the token cost on large or complex PRs where you need deeper reasoning.</p><p><strong>Pricing.</strong> As of June 2026 — verify at <a href="https://claude.ai/pricing">https://claude.ai/pricing</a> before committing, as Anthropic adjusts plans regularly:</p><ul><li><strong>Pro:</strong> $20/month with usage limits. Fine for light use.</li><li><strong>Max 5x:</strong> $100/month — 5× the Pro token budget. The practical starting point for a developer running reviews daily.</li><li><strong>Max 20x:</strong> $200/month — 20× the Pro budget. For all-day use or teams running heavy review workflows.</li><li><strong>API key:</strong> Pay-per-use. Worth considering if your company has an enterprise arrangement or you want per-call billing visibility.</li></ul><h3>Prerequisites — what you need before starting</h3><p>A few things need to be in place before the install.</p><p><strong>Node.js 18 or later.</strong> Claude Code is distributed as an npm package. Check your version with node --version. If you&#39;re on 16 or below, update first.</p><p><strong>An Anthropic account with a subscription or API key.</strong> Pro works for getting started. Max is more comfortable for sustained daily use.</p><p><strong>An Azure DevOps Personal Access Token.</strong> This is the key piece. It’s how Claude Code will read PR diffs and post review comments on your behalf, via the Azure DevOps REST API. You need two scopes: Code (Read &amp; Write) and Pull Request Threads (Read &amp; Write). I’ll walk through creating one in Step 2.</p><p><strong>Git installed and configured.</strong> Claude Code should be run from inside a git repository — it uses git context to understand your codebase structure.</p><p><strong>A terminal.</strong> Bash, Zsh, and PowerShell all work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tpX2myPnaZps6yy3HeXSYA.png" /></figure><h3>Step 1 — Install Claude Code</h3><pre>npm install -g @anthropic-ai/claude-code</pre><p>One note on permissions: don’t use sudo here. If you see a &quot;permission denied&quot; error, the correct fix is to configure npm to install global packages into a user-writable directory — typically ~/.npm-global — and add that to your PATH. The npm docs cover this under &quot;resolving EACCES errors.&quot;</p><p>Check your Node version if the install fails:</p><pre>node --version<br># should output v18.0.0 or higher</pre><p>If you’re on a corporate network with a proxy, you may need to configure npm’s proxy settings before the install reaches npm’s registry. Ask your IT team for the proxy address, or try on a VPN first.</p><p>Once installed, launch Claude Code from your project directory:</p><pre>cd /path/to/your/repo<br>claude</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VS6YqQgOu9XEtVsCtSKVkA.png" /></figure><p>On first run, Claude Code opens your browser to an Anthropic login page. Sign in, authorise the app, and the terminal resumes automatically. You’ll land at a prompt that looks like:</p><pre>Claude Code 1.x.x<br>Type / for commands, or just start typing.<br> <br>&gt;</pre><p>That’s the whole install. You’re ready.</p><p>If you’re using an API key instead of a subscription, set it before running claude:</p><pre>export ANTHROPICAPIKEY=&quot;sk-ant-...&quot;</pre><h3>Step 2 — Set up Azure DevOps access</h3><p>This is the step most AI-tooling tutorials skip because they assume you’re working with local files. For this workflow, you need an Azure DevOps Personal Access Token (PAT) so Claude Code can call the REST API to fetch PR diffs and post comments.</p><p><strong>Create the token:</strong></p><ol><li>Go to dev.azure.com and sign in to your organisation</li><li>Click your profile picture in the top right → <strong>Personal access tokens</strong></li><li>Click <strong>+ New Token</strong></li><li>Give it a name and set an expiry (90 days is a reasonable default; set a calendar reminder to rotate it)</li><li>Under <strong>Scopes</strong>, select:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*fTxHYoEheZzUm2nw7YBmLA.png" /></figure><p><strong>- Code</strong> — Read &amp; Write<br>- <strong>Pull Request Threads</strong> — Read &amp; Write</p><p>Click <strong>Create</strong>, then copy the token immediately — Azure DevOps won’t show it again</p><p><strong>Set the environment variables:</strong></p><pre>export AZUREDEVOPSPAT=&quot;your-token-here&quot;<br>export AZUREDEVOPSORG=&quot;https://dev.azure.com/your-organisation&quot;</pre><p>Add these to your ~/.zshrc or ~/.bashrc so they persist across terminal sessions:</p><pre>echo &#39;export AZUREDEVOPSPAT=&quot;your-token-here&quot;&#39; &gt;&gt; ~/.zshrc<br>echo &#39;export AZUREDEVOPSORG=&quot;https://dev.azure.com/your-org&quot;&#39; &gt;&gt; ~/.zshrc<br>source ~/.zshrc</pre><p><strong>Why this works.</strong> Claude Code doesn’t have built-in Azure DevOps integration. What it has is the ability to make HTTP requests using any credentials available in its environment. When you instruct it to review a PR and post comments, it constructs REST calls to the Azure DevOps API — using your PAT as the Bearer token in the Authorization header — the same calls you&#39;d make with curl or the az devops CLI. The key endpoints it uses:</p><ul><li>GET .../pullRequests/{id} — fetch PR metadata and description</li><li>GET .../pullRequests/{id}/iterations — fetch the diff</li><li>POST .../pullRequests/{id}/threads — create a new review thread (with file and line position)</li><li>POST .../pullRequests/{id}/threads/{threadId}/comments — add a reply to a thread</li></ul><p>Claude Code constructs these calls itself. You just provide the PR URL.</p><h3>Step 3 — Your first PR review</h3><p>Open a terminal in your repository directory and run claude. Then paste something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LdMtEKW906tZYZtICmaN4Q.png" /></figure><p>Here’s what happens over the next two to three minutes:</p><p>Claude Code calls the Azure DevOps API, fetches the PR diff, and starts reading. For a 40-file PR — the kind that would take a senior developer 20–30 minutes to review carefully — it takes roughly two to three minutes. It reads everything. It doesn’t skim the smaller files and slow down on the larger ones the way a tired human reviewer does.</p><p>Then it starts posting. Each finding becomes an inline thread comment on the relevant file and line. A realistic comment on a backend service might look like this:</p><blockquote><strong>UserService.ts, line 147</strong> — getUserById builds the query with string interpolation: \SELECT * FROM users WHERE id = &#39;${userId}&#39;`. If userId` is not validated before this call — and the validation at line 89 only checks for empty string — this is a SQL injection risk. Replace with a parameterised query or use the ORM&#39;s query builder method instead.</blockquote><p>That’s a specific issue, on a specific line, with context about the upstream call. Not a generic “check your SQL queries” note.</p><p>After the inline comments, Claude Code posts a summary to the PR thread covering what it reviewed, what it found, and what it deliberately skipped (generated files, migrations, lock files — if you told it to).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DCEsjped6P858jX8LnyMCg.png" /></figure><p>A 40-file PR that used to take me 25 minutes to review now gets a thorough first pass in about three minutes. The pass isn’t perfect — I’ll come back to what it misses — but it catches the mechanical layer reliably.</p><h3>What I’ve learned after months of AI PR reviews</h3><p>The honest assessment, not the sales pitch.</p><p><strong>What it catches reliably.</strong> Null checks and missing defensive guards. Unhandled promise rejections and async errors swallowed in empty catch blocks. String-interpolated SQL queries. Hardcoded credentials or API keys committed to configuration files. Mismatches between what the PR description says it does and what the code actually does — a particularly useful check when a PR description hasn&#39;t been updated after a scope change.</p><p>On large PRs, the fatigue resistance is the underrated benefit. A human reviewer reads the first 15 files carefully and the last 10 quickly. Claude Code reads file 35 with the same attention as file 1.</p><p><strong>What it gets wrong.</strong> It doesn’t know your architecture. It can’t tell whether using a singleton here is an intentional design trade-off your team made two years ago or a careless choice. It doesn’t know that LegacyReportingService.cs is a read-only compatibility layer that hasn&#39;t been touched in three years and shouldn&#39;t be touched now either.</p><p>Tone is also variable. Some comments are well-calibrated. Others are too formal or too pedantic in a way that would annoy the PR author rather than help them. I occasionally soften a comment before it goes out, or dismiss one that’s technically correct but would start an argument about a decision that was already made.</p><p><strong>My rule.</strong> Claude Code does the first pass. I do the second. It handles the mechanical layer so I can focus on the design questions — the ones that require understanding why the code is the way it is. I still approve or request changes. The AI doesn’t have merge authority, and it shouldn’t.</p><h3>Tips to get better reviews</h3><p><strong>Be specific in your prompt.</strong> “Focus on security and error handling in the authentication module” gets better results than “review this PR.” The more precisely you describe what matters, the more the review focuses on what’s actually risky in this specific change.</p><p><strong>Include domain context.</strong> “This is a payment processing service that handles PCI-scoped card data” isn’t overhead — it changes what Claude Code treats as high-severity. A hardcoded test key in a utility library is a Low finding. The same key anywhere near a payment flow is Critical.</p><p><strong>Use a </strong><strong>CLAUDE.md file.</strong> This is a persistent instruction file that Claude Code reads automatically when it starts a session in a directory. Put your team&#39;s coding conventions, architectural decisions, and known patterns there. For a .NET team that prohibits synchronous I/O in the service layer, putting that rule in CLAUDE.md means every PR gets reviewed against it automatically — without you mentioning it each time.</p><p><strong>Skip generated files on large PRs.</strong> For PRs with 50 or more files, tell Claude Code explicitly: “focus on the business logic files, skip EF migrations, package-lock files, auto-generated API clients, and resource files.” Otherwise it will read every file — which is thorough, but review time increases and findings on generated files are rarely useful.</p><p><strong>Iterate within the session.</strong> If the review misses something you spotted, say so directly: “you missed the race condition in OrderProcessor.cs — there&#39;s no lock around the _activeOrders dictionary in the ProcessBatch method.&quot; Claude Code will pick it up and post the additional comment. The session retains context, so follow-up prompts are fast.</p><h3>The setup is 15 minutes. The workflow shift takes longer.</h3><p>This isn’t about replacing human reviewers. The decisions that actually require engineering judgement — trade-offs between approaches, code that encodes six months of production incident learning, choices that are technically wrong but correct for your specific system — those still need a human who understands the context.</p><p>What the setup does is remove the mechanical layer from my plate. The null checks, the error handling gaps, the security antipatterns — I stopped finding those at 4pm on a Friday. Claude Code finds them at 9am, before anyone’s eyes are glazing over.</p><p>The quality of our actual review discussions has gone up, because they’re not about “you forgot to handle the null case.” They’re about whether the approach is right.</p><p>I’ve written about other Claude Code setups on Medium and at nakrosis.com — including an Azure cost investigator and a pre-merge spec-review skill. If you try this setup, I’d like to hear how it goes. Find me on <a href="https://www.linkedin.com/in/mindaugas-nakro%C5%A1is-142a4a108/">LinkedIn</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1bf09fdaa9e8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I built a multi-agent AI system that reads industry news and writes original articles about it]]></title>
            <link>https://mindaugasnakr.medium.com/i-built-a-multi-agent-ai-system-that-reads-industry-news-and-writes-original-articles-about-it-7b02d31198dc?source=rss-b1e4a6e14bbd------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b02d31198dc</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Mindaugas Nakrosis]]></dc:creator>
            <pubDate>Tue, 12 May 2026 07:01:03 GMT</pubDate>
            <atom:updated>2026-05-12T07:01:03.479Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Four specialized agents, strict JSON contracts between them, and a human review gate before anything ships. The architecture that finally made my agentic systems work in production.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*Yp1VrpsrrKKB6Rz21jTN6g.png" /><figcaption>generated article</figcaption></figure><h3>Yes, this was written by AI.</h3><p>Every morning, four AI agents read the news for me. The first one ranks the day’s RSS feeds and surfaces the three stories worth writing about. I pick one. The second agent reads the source article and writes a 1,000-word piece of original analysis from my company’s perspective — headline, meta description, slug, structured markdown body, internal-link suggestions, and a schema.org type, all conforming to a strict JSON schema. The third generates a 1200×630 social card and, if the body contains real numeric data, one or two charts to go with it. The fourth renders the final MDX file with embedded JSON-LD, copies the assets into my Next.js public tree, opens a feature branch, and creates a pull request.</p><p>I review the draft before the assets and publisher stages run. There is no autonomous publish path.</p><p>This is my 4th Claude Code plugin. The architecture is the same as the previous three because it keeps working: <strong>narrow agents with strict contracts, deterministic code between them, a human gate before anything irreversible.</strong> This post walks through the most recent one — <strong>content-engine</strong> — and the five design decisions I now reach for by default whenever I’m building agentic systems.</p><h3>The architecture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bDe7rMlKqf1WChhWyPTVXA.png" /><figcaption>content-engine architecture</figcaption></figure><p>Each box is a Claude Code subagent. Each arrow is a JSON file written to a per-article working directory. A Python CLI (content-engine) sits underneath and does every deterministic operation the agents would otherwise have to bluff their way through — RSS feed parsing and scoring, source-article prefetch and cleaning, SEO constraint validation, MDX rendering, OG-image generation (matplotlib, 1200×630), schema.org JSON-LD assembly, asset copying into the Next.js public tree.</p><h3>Decision 1: One agent per failure mode</h3><p>The first temptation with an LLM pipeline is to ship one agent and give it tools. That’s wrong because <strong>different stages of a content pipeline have different failure modes</strong>, and prompt language that prevents one failure makes another worse.</p><ol><li><strong><em>The</em></strong><em> </em><strong><em>news-scanner</em></strong> has to be ruthless about cutting noise. One good candidate beats five mediocre ones. Its prompt is full of language like “if you’re unsure, drop it” and a strict 0–100 scoring rubric.</li></ol><p>2. <strong><em>The</em></strong><em> </em><strong><em>content-strategist</em></strong> has to write substance. Vague summaries of the source article are the failure mode. Its prompt is full of language like “the news is the hook; your expertise is the substance” and explicit instructions about original analysis, not paraphrasing.</p><p>3. <strong><em>The</em></strong><em> </em><strong><em>asset-producer</em></strong> has to refuse to invent data. The failure mode is drawing a chart from numbers it imagined. Its prompt has the hard rule “every number in a chart must appear in the article body.”</p><p>4. <strong><em>The</em></strong><em> </em><strong><em>publisher</em></strong> has to obey git discipline. The failure mode is git push --force on main. Its prompt has explicit prohibitions on --no-verify, git add -A, and committing on main/master.</p><p>If you put all four sets of instructions in one prompt, they fight each other. “Be ruthless” conflicts with “write substantively.” “Never invent data” gets diluted by 50 other rules. <strong>Four narrow prompts of 100 lines each are more reliable than one 400-line prompt covering the same ground.</strong></p><h3>Decision 2: Deterministic code between the agents</h3><p>The second insight took me longer to learn: <strong>most of what looks like “agent work” is actually deterministic work the agent shouldn’t be doing.</strong></p><p>When the <strong>news-scanner</strong> runs, it doesn’t fetch RSS feeds. The CLI does. The scanner reads the structured candidate list the CLI produced and applies judgment on top — re-ranking, picking angles, dropping items the rubric scored too generously.</p><p>When the <strong>content-strategist</strong> runs, it doesn’t parse HTML from the source article. The CLI does (BeautifulSoup, strips scripts/styles/nav, caps at 20K chars). The strategist reads clean structured text and writes.</p><p>When the <strong>asset-producer</strong> runs, it doesn’t render PNGs. The CLI does (matplotlib, with hard checks on chart kind and slice counts). The agent decides what to render and writes the alt text; the code produces the pixels.</p><p>When the <strong>publisher</strong> runs, it doesn’t assemble JSON-LD or YAML frontmatter or copy image files. The CLI does. The agent invokes the render command and then handles git on a feature branch.</p><p>The result is that <strong>each agent’s prompt is short</strong> (under 200 lines), each prompt is <strong>about judgment, not mechanics</strong>, and the <strong>boundary between LLM and deterministic logic is explicit</strong> — you can read the CLI code to know exactly what cannot vary, and read the prompt to know exactly what’s left to judgment.</p><p>This is the most important design decision in the whole project. If I had to give one piece of advice to someone building an agentic system, it’s: <strong>before adding to a prompt, ask whether the work belongs in code.</strong></p><h3>Decision 3: Strict JSON contracts as the agent interface</h3><p>Agents communicate by writing JSON files to a working directory, not by passing messages in context.</p><pre>runs/20260508-141522/<br>  selected.json    # scanner&#39;s pick<br>  brief.json       # prefetched source text<br>  draft.json       # strategist&#39;s output<br>  assets.json      # asset-producer&#39;s manifest</pre><p>Each file has a strict schema. The strategist’s draft must include headline ≤60 chars, meta<em>description ≤155 chars, </em><em>slug matching </em><em>^[a-z0-9]+(-[a-z0-9]+)*$, </em><em>target_keywords count 3–5, </em><em>schema</em>type in {Article, NewsArticle, BlogPosting}, zero H1 in the body. The validator runs as a separate stage and returns a list of Issue objects with level: error | warning. Errors block; warnings inform.</p><p>This buys three things:</p><ol><li><strong>Each stage is independently re-runnable.</strong> If the asset producer fails, I rerun just the asset producer. I don’t re-invoke the strategist or re-scan the feeds.</li><li><strong>Each stage is independently testable.</strong> Hand it a known-good JSON input and assert on the output. I have 89 tests for this pipeline. Most LLM workflows can’t be tested at all.</li><li><strong>Each stage is debuggable.</strong> When something looks wrong in the final MDX, I can read the four JSON files in the working directory and pinpoint where reality diverged from expectation.</li></ol><p>The interface between LLM and code is not natural language. It’s a JSON schema, validated.</p><h3>Decision 4: Hard rules in code, not just prompts</h3><p>A prompt that says “never copy more than 25 consecutive words from the source” is a polite request. A validator that scans the draft body and refuses to mark it ok: true if it finds a long verbatim quote is a hard rule.</p><p>content-engine encodes the hard rules in both places, on purpose. The prompt expresses intent — that’s what gets the LLM to write the right kind of text in the first place. The validator is the safety net that catches the cases where the prompt didn’t work.</p><p>Same with git: the publisher agent’s prompt says “never --no-verify, never git add -A, never on main/master.&quot; But the practical safety comes from the fact that those operations require the human running Claude Code to approve them.</p><p><strong>Prompts express intent. Code makes intent unbreakable.</strong> Use both.</p><h3>Decision 5: A human gate before anything irreversible</h3><p>There is no autonomous publish path. The pipeline explicitly stops after the strategist writes the draft. The orchestrator skill says, in plain English, “Always pause for human review before publishing. No autonomous publish.”</p><p>I have strong views on this. Reactive content tied to real news, written by a system that can produce 30 articles a day, is exactly the kind of system that needs a human in the loop. Not because the LLM might write something incorrect (it might), but because <strong>automation at scale magnifies whatever you encode</strong> — including the things you didn’t realize you were encoding. The human gate is the place where context the agents don’t have (“we said the opposite of this two weeks ago”, “this lender just lost a major lawsuit”) catches up with the output.</p><p>This is the difference between a tool I’d use to ship work and a tool I’d warn people about.</p><h3>What I’d carry to the next agentic project</h3><p>Looking back across the four Claude Code plugins I’ve built — md-to-jira, azure-cost-investigator, a Notion spec checker, and now content-engine — these are the moves I keep making:</p><ul><li><strong>Many narrow agents, not one wide one.</strong> Each agent should have a single failure mode it’s tuned against.</li><li><strong>Deterministic CLI doing the boundary work.</strong> Anything reproducible should be in code, not in a prompt.</li><li><strong>JSON contracts between stages.</strong> Files in a working directory, not passing context in-context.</li><li><strong>Hard rules in code AND prompts.</strong> Belt and suspenders.</li><li><strong>A human gate before anything irreversible.</strong> Not optional.</li><li><strong>Test it.</strong> The deterministic parts are testable; extract them, write the tests.</li></ul><p>89 tests covering an LLM pipeline isn’t a stunt. It’s the natural consequence of pulling the deterministic work out of the agent layer. The agents shrink. The code grows. Both get more reliable. The system survives contact with production.</p><p>That’s the playbook.</p><p><em>The repo is </em><a href="https://github.com/mindaugasnakrosis/agentic-newsroom">https://github.com/mindaugasnakrosis/agentic-newsroom</a><em>. It ships as a Claude Code plugin: drop it into a repo, configure your industry keywords and RSS feeds, run </em><em>content-engine run, and a working pipeline drops PRs into your blog repo. I&#39;m always interested in talking to people building agentic systems — find me at mnakrosis@trustflux.co.uk</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b02d31198dc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I built an AI code reviewer that refuses to write anything]]></title>
            <link>https://mindaugasnakr.medium.com/i-built-an-ai-code-reviewer-that-refuses-to-write-anything-522668f80c9f?source=rss-b1e4a6e14bbd------2</link>
            <guid isPermaLink="false">https://medium.com/p/522668f80c9f</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[notion]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Mindaugas Nakrosis]]></dc:creator>
            <pubDate>Thu, 07 May 2026 07:01:02 GMT</pubDate>
            <atom:updated>2026-05-07T07:01:02.527Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A Claude Code skill that reviews a feature branch against its Notion spec — grounded in citable authorities, read-only by architectural firewall, shipping at v0.1.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8jbB0ww6O7ye-pTvUsykJg.png" /></figure><p>Most “AI for code review” tools have the same problem. They’re confident, ungrounded, and one bad prompt away from running git push --force on the wrong branch. I wanted something narrower and more honest, so I built <strong>spec-check</strong> — a Claude Code skill that does exactly one thing: read a feature branch and the Notion page that specs it, and produce a pre-merge review report grounded in a hardcoded knowledge corpus.</p><p>It’s a v0.1. It works end-to-end. It’s also unfinished in ways I’ll name at the end. The point of writing this up now is to put the design decisions on record before they become folklore — and to invite people to break it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dwazBF8jkD2LK35cqf-AGA.png" /></figure><h3>The job-to-be-done</h3><p>There’s a 15-minute review every engineering manager and tech lead does dozens of times a sprint. <em>“Does this PR actually meet the spec it was opened against?”</em> You skim the diff, you flip to the Notion page, you check whether the acceptance criteria are vaguely covered, you flag the suspicious bits, you approve or push back.</p><p>It’s a high-leverage review and an annoying one. You’re not looking for bugs — there are linters and tests for that — you’re looking for <strong>scope creep, ambiguous criteria, missing test coverage, and silent goalpost moves on the spec page</strong>. Those four things are what spec-check was built to surface.</p><p>Not catch. <em>Surface.</em> That distinction matters and I’ll come back to it.</p><h3>The shape of the thing</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3Gs7HvbbClbd8iMFVrvMag.png" /></figure><p>The skill is invoked from Claude Code with a natural-language prompt:</p><blockquote>Review this branch against the Notion spec at <a href="https://notion.so/Login-flow-abc123">https://notion.so/Login-flow-abc123</a>.</blockquote><p>Claude recognises the trigger, runs spec-check doctor to confirm the environment, fetches the Notion page via the official Notion MCP plugin, writes the payload to a temp JSON file, runs the spec-check CLI against it, and narrates the resulting report.md back to the reviewer. The report is severity-grouped (Critical → High → Medium → Low → Info), every finding is grounded in a knowledge document, and every recommendation is phrased as a question for the human, not an instruction.</p><p>A real run, against a deliberately mediocre spec, produces something like this:</p><pre># spec-check report — feat/PROJ-1-login<br> <br>- Branch: feat/PROJ-1-login<br>- Spec: PROJ-1: Login flow<br>- Resolution method: ticket_key<br> <br>4 finding(s): 1 High, 3 Medium.<br> <br>## High (1)<br> <br>### Spec was modified after the branch was created<br>- Rule: specmodified_afterbranch · Severity: High · Confidence: Medium<br>- Knowledge: spec-drift.md<br> <br>Question: The spec page was edited 2965s after this branch was created.<br>Notion&#39;s API doesn&#39;t expose what changed — can the spec author confirm<br>whether the edit was a typo or clarification, or did the criteria<br>themselves move while the branch was open?<br> <br>## Medium (3)<br> <br>### Ambiguous language in AC-2<br>- Rule: ambiguous_criterion · Severity: Medium · Confidence: Medium<br>- Knowledge: ambiguity-in-acceptance-criteria.md<br> <br>Question: Criterion AC-2 contains the imprecise phrases &#39;fast&#39;,<br>&#39;user-friendly&#39;, and &#39;should&#39;. Could the criterion be re-phrased so a<br>reviewer would not have to guess what passing looks like — or is the<br>phrase a domain term that the team has agreed to accept?</pre><p>The output is a forward-able artefact. You can paste it into a PR comment and the conversation that follows is anchored to specific criteria and specific authorities, not vibes.</p><h3>The two design decisions worth defending</h3><h3>1. Two read-only firewalls</h3><p>Most LLM-driven dev tools are read-only <strong>by convention</strong> — the prompt says “don’t edit anything” and you hope. spec-check is read-only by <strong>architecture</strong>, on both surfaces it touches.</p><ul><li><strong>Git</strong>: every shell-out goes through gitwrap.py, which has an explicit allowlist of read verbs (status, log, diff, rev-parse, show, for-each-ref, reflog, branch --show-current, symbolic-ref). Any other verb — checkout, commit, push, rebase, apply, reset, restore, anything that mutates state — raises GitWriteRefused <em>before</em> git is invoked. Verified by dedicated unit tests, one per refused verb.</li><li><strong>Notion</strong>: the notion.py wrapper allows only notion-fetch and the explicit search verbs the resolver needs. update<em>page, </em><em>append_block, </em><em>create</em>page, delete, comment posts, property edits — all refused at the wrapper boundary. Same test discipline.</li></ul><p>That sounds paranoid for a skill that <em>intends</em> to be read-only. The point is exactly that: the skill’s intent is irrelevant. The architecture is what a reviewer can audit, and the architecture is what survives a prompt injection or a hallucinated tool call. If the LLM hallucinates a git checkout mid-review, the wrapper refuses; the skill can&#39;t bypass it because the skill doesn&#39;t have a code path that reaches git outside the allowlist.</p><h3>2. Every claim cites an authority</h3><p>Each rule fires against a specific document in a hardcoded knowledge/*.md corpus that ships with the skill. There are five today: an INVEST verbatim quote (Bill Wake, 2003), and four authored project conventions covering Notion page conventions, ambiguity in acceptance criteria, observable acceptance criteria, and spec drift.</p><p>Each knowledge document carries frontmatter with its canonical URL, retrieval date, and a content SHA-256 for verbatim quotes. Authored documents are explicitly marked canonical_url: null so they can&#39;t be confused with external authorities.</p><p>The Pydantic validator on Finding refuses to construct a non-Info finding without at least one knowledge_refs entry. <em>If you can&#39;t cite, you can&#39;t claim.</em> That constraint forced an interesting discipline during development: every time I wanted a rule to flag something, I had to write the document first. Several rules I thought I wanted got cut at that step, because I couldn&#39;t ground them in anything I&#39;d defend in front of a reviewer.</p><p>The corpus is committed. There are no live web fetches at runtime. Refresh is a maintainer-only operation reviewed by a human before commit.</p><h3>Surface, don’t catch</h3><p>spec-check produces questions, not directives. The Finding validator rejects 17 imperative prefixes (Add, Fix, Rewrite, Update, Implement, Replace, …). Every recommended_investigation field has to end with a ?. The skill&#39;s persona instructions reinforce the same constraint: <em>&quot;Has the spec author confirmed AC-3 was intentionally omitted?&quot;</em> — never <em>&quot;the author should add AC-3.&quot;</em></p><p>This isn’t a stylistic choice. It’s the difference between an LLM tool that <strong>decides</strong> and an LLM tool that <strong>prepares a human to decide</strong>. The former is, today, mostly broken in subtle ways the user can’t audit. The latter is just a really good staff engineer pre-reading a PR for you.</p><p>A High-severity, Medium-confidence finding is fundamentally different from a High-severity, High-confidence finding. The first means <em>“the signal is strong but the inference depends on a heuristic you can override.”</em> The second means <em>“the signal is in the data, not in a heuristic.”</em> Both axes are reported, always. Severity rubric and confidence rubric are independent and explicit.</p><h3>What v0.1 actually does</h3><p>Nine rules, grounded in five knowledge documents:</p><p>Rule Severity Confidence missing<em>ac</em>section High High missing<em>acceptance</em>criteria High High large<em>diff_without</em>spec High High / Medium multiple<em>specs</em>referenced Medium High scope_creep Medium Medium criterion<em>without</em>test Medium Medium ambiguous_criterion Medium Medium untestable_criterion Medium Medium spec<em>modified_after</em>branch High High / Medium</p><p>372 tests, ~5s on my laptop. Repo conventions enforced at import-time, not at evaluate-time, so missing knowledge docs fail fast. CI on Python 3.11 and 3.12.</p><h3>What v0.1 doesn’t do, and why I’m shipping anyway</h3><p>The report header has a known display bug when the spec is resolved via --spec override but fetched via --spec-payload: the spec slot says (unresolved) even though the rules ran against the right page. The findings are correct. The header is misleading. Filing for v0.2.</p><p>There’s no per-criterion test mapping. criterion<em>without</em>test is a coarse signal at the diff/spec level — it doesn&#39;t yet match each criterion&#39;s text against test names. That&#39;s the most-asked-for v0.2 feature and the most likely place I&#39;ll regret cutting corners.</p><p>There’s no Confluence or Google Docs adapter. The notion.py wrapper is the only spec-source-specific code; a sibling adapter is mechanically straightforward. I haven&#39;t built it because I don&#39;t need it yet.</p><p>There’s no semantic similarity between criteria and code. That’s a deliberate cut — embeddings introduce non-determinism the “every claim cites a knowledge doc” discipline depends on, and I’d rather be auditable than clever.</p><p>I’m shipping v0.1 because the alternative is to keep iterating in private until the v2 features above are perfect, by which point the design decisions in v0.1 will have congealed into folklore I can’t push back on. Better to put the read-only-firewall and citation-or-it-doesn’t-claim disciplines in front of people while they’re still fresh enough to argue about.</p><h3>Try it</h3><p><a href="https://github.com/mindaugasnakrosis/notion-spec-checker">github.com/mindaugasnakrosis/notion-spec-checker</a></p><pre>git clone https://github.com/mindaugasnakrosis/notion-spec-checker<br>cd notion-spec-checker<br>uv sync --all-packages<br>bash scripts/install_skill.sh</pre><p>Then in Claude Code, against any repo where you’ve connected Notion’s MCP plugin:</p><blockquote>Review this branch against the Notion spec at &lt;url&gt;.</blockquote><p>Open issues for rules I should have written, knowledge documents I should have cited, and authorities I missed. The pattern of <em>knowledge document → citing rule → testable threshold</em> is reusable for anything with published thresholds — INVEST is just the first one I cared about.</p><p>If you find a way to get either firewall to write something, that’s a security report, not an issue. SECURITY.md in the repo.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=522668f80c9f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I built a Claude Code skill that does a 20-minute Azure cost review]]></title>
            <link>https://mindaugasnakr.medium.com/i-built-a-claude-code-skill-that-does-a-20-minute-azure-cost-review-40efc3cf5b19?source=rss-b1e4a6e14bbd------2</link>
            <guid isPermaLink="false">https://medium.com/p/40efc3cf5b19</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[azure]]></category>
            <dc:creator><![CDATA[Mindaugas Nakrosis]]></dc:creator>
            <pubDate>Fri, 01 May 2026 07:01:01 GMT</pubDate>
            <atom:updated>2026-05-04T13:31:47.194Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A read-only Azure cost auditor that produces a written report a human can read and act on. Calibrated against a real tenant. Finds roughly 3× what Azure Advisor surfaces.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-0fZtBC7fQHi9MEOUOC4UQ.jpeg" /></figure><h3>The pitch</h3><p>Most Azure cost reviews are some combination of: someone clicking through the portal for a day, a £15k consultant deck three weeks later, or Azure Advisor — which is honest about what it sees but conservative by design.</p><p>I wanted a fourth option: a Claude Code skill that runs in twenty minutes, against a snapshot of the tenant, and produces a written report a human can read and act on. Read-only. Citation-grounded. Reproducible.</p><p>Run against a tenant doing roughly <strong>£30k/month</strong> in Azure spend, the latest run produces:</p><blockquote><strong><em>Total estimated monthly savings: £5,436 — £7,369 / month</em></strong></blockquote><blockquote><em>Findings by severity: </em><strong><em>0 Critical · 18 High · 38 Medium · 174 Low · 8 Info</em></strong></blockquote><p>That’s roughly <strong>3× Azure Advisor’s published recommendation ceiling</strong> for the same tenant (~£20k/year). Not because Advisor is wrong — because the skill carries opinions Advisor cannot.</p><p>Below: what it catches, and the architecture that lets it grow without becoming flaky.</p><h3>What it found</h3><p>The single biggest finding wasn’t a misconfigured VM. It was a <strong>5× App Service P2v3 reservation</strong> running at low utilisation with <strong>9 months remaining</strong> before expiry. The skill reports both the monthly band and the term-to-expiry forecast:</p><blockquote><em>Underused reservation: P2v3 × 5–40% utilisation Forecast: </em><strong><em>£4,558 — £5,535 between now and expiry</em></strong></blockquote><p>That single line is worth more attention than any number of orphaned-disk findings. It’s also the kind of thing Advisor never says, because Advisor doesn’t combine <em>spend</em> + <em>utilisation</em> + <em>term remaining</em> into a single forward-looking £ figure.</p><p>Other examples from the same run:</p><ul><li><strong>GeoRedundant backup vault</strong> flagged on a non-production subscription — switching to LocallyRedundant is a 50% storage cut on Microsoft published rates, but only if there are no protected items at switch time.</li><li><strong>Backup retention bloat</strong> on a workload-policy vault: weekly=104, monthly=60, yearly=10 — well above what the source workload actually needs.</li><li><strong>Subscription on full PAYG/EA/CSP whose name says non-prod</strong>: a hint that whoever provisioned it skipped the Dev/Test offer. The skill is offer-aware (CSP vs EA vs PAYG) and writes the recommendation accordingly.</li><li><strong>Premium SSD P30 reservations</strong> at 25% utilisation, forecast £1,447–£1,953 over the remaining 8 months.</li></ul><p>The point isn’t any single number — it’s the texture. The skill surfaces the kinds of findings that show up in a senior FinOps consultant’s deck, not the kinds an Advisor cron job emits.</p><h3>The architecture</h3><p>The skill is a monorepo of two installable Python packages:</p><ul><li><strong>azure-investigator-core</strong> — the read-only collectors. Pulls from az CLI, normalises into a snapshot directory.</li><li><strong>azure-cost-investigator</strong> — the rule engine. Reads a snapshot, evaluates rules, writes a report.</li></ul><p>Numbers as of the latest commit:</p><p>Rules <strong>15</strong> Knowledge corpus docs <strong>14</strong> Collectors <strong>18</strong> Tests passing <strong>227 passed, 1 skipped</strong> Output formats report.md + report.html + findings.yaml</p><h3>Reservation forecast: a small change with a big narrative effect</h3><p>A naïve “underused reservation” rule reports a <em>monthly</em> band: “this reservation is wasting £X/month at current utilisation”. True, but small.</p><p>The skill reads expiryDateTime from the reservation snapshot and adds two evidence fields:</p><pre>termremainingmonths: 9<br>forecastlow_gbp_toexpiry: 4558<br>forecasthigh_gbp_toexpiry: 5535</pre><p>If expiryDateTime is missing, it falls back to a 12-month default (overridable via config). The recommendation copy reads &quot;<strong>£4,558–£5,535 between now and expiry</strong>&quot; instead of &quot;<strong>£506–£615/month</strong>&quot; — same underlying data, dramatically clearer impact.</p><p>The same rule dispatches across <strong>VM, App Service, and Premium SSD</strong> SKU families, not just VMs.</p><h3>Six architectural bets</h3><p><strong>1. Read-only is absolute.</strong> A single function (azcli.run<em>json) gates every Azure CLI call. Twenty-three unit tests verify it rejects every one of 33 forbidden write verbs before </em><em>subprocess is reached. Every collector — vms, disks, reservations, recovery_services, log</em>analytics — goes through the same gate. There is no escape hatch.</p><p><strong>2. Citation-grounded knowledge corpus.</strong> Every rule declares KNOWLEDGE<em>REFS pointing at committed </em><em>.md files in the corpus. Each knowledge doc has frontmatter with </em><em>source_url, </em><em>source_retrieved, and </em><em>source</em>sha256. A rule that cites a missing document fails to load. This is how I keep the model from inventing numbers — the rule is allowed to compute, but it must justify its limits from a doc that has a Microsoft URL on it.</p><p><strong>3. Severity × Confidence as independent axes.</strong> Findings carry both. A high-severity / low-confidence finding (“we <em>think</em> this £4k reservation is wasted, but utilisation data is sparse”) gets handled differently from a low-severity / high-confidence finding (“this £4 IP is definitely orphaned”). Single-axis lists hide that distinction.</p><p><strong>4. Savings as ranges, not point estimates.</strong> Every monetary recommendation comes with a non-empty assumption string explaining what&#39;s <em>not</em> netted out: negotiated discounts, reservation coverage, regional price drift. Treating the range itself as the answer is a feature.</p><p><strong>5. Persona separation in the core package.</strong> The core package is shared with a sibling azure-security-investigator skill (a v2 stub in the same repo). When I added the recovery-services collector for cost, the security skill inherited it for free.</p><p><strong>6. Rendering is a first-class output.</strong> The skill produces report.html automatically alongside report.md, with print-friendly CSS. Browser-print-to-PDF works without extra tooling. This matters because cost reports get sent to humans who don&#39;t read terminal Markdown.</p><h3>The rule corpus</h3><p>The fifteen rules currently in the skill:</p><ul><li>orphaned_disks — unattached managed disks billed by capacity.</li><li>unattached<em>public</em>ips — Public IPs not bound to a NIC or load balancer.</li><li>vm_rightsizing — P95 CPU under 3% and outbound under 2 Mb/s on a 7-day window.</li><li>underused_reservations — VM, App Service, and Premium SSD reservations under utilisation threshold, with term-to-expiry forecast.</li><li>appservice<em>idle</em>plans — App Service Plans with zero traffic.</li><li>storage<em>tier</em>mismatch — Hot blobs older than the Cool break-even.</li><li>basic<em>sku</em>retirement — Public IP Basic SKU and other deprecated SKUs.</li><li>tagging_governance — missing CAF-recommended tags.</li><li>env<em>mismatch_in_prod</em>sub — non-prod-named resources living in production subs.</li><li>unused_snapshots — disk snapshots older than the retention threshold.</li><li>nic_orphans — NICs detached from any VM.</li><li>rsv<em>backup</em>retention — Recovery Services Vault retention bloat plus GRS-redundancy scrutiny.</li><li>dev<em>test_offer</em>eligibility — PAYG/EA/CSP subscriptions that look non-prod by name.</li><li>log<em>analytics</em>retention — Log Analytics workspace retention exceeding workload need.</li><li>advisor<em>cost</em>recommendations — surfaces Azure Advisor&#39;s own £-quantified findings.</li></ul><h3>What it deliberately doesn’t do</h3><p>A short list:</p><ul><li><strong>No remediation verbs.</strong> Read-only is a guarantee, not a default.</li><li><strong>No live web fetches at runtime.</strong> Knowledge is committed and SHA256-tracked.</li><li><strong>No reservation purchase recommendations.</strong> Sizing reservations is a finance decision, not a script’s call.</li><li><strong>No multi-cloud comparisons.</strong> AWS/GCP have different mental models.</li><li><strong>No ticket-system integration.</strong> The output is a Markdown file. What you do with it is yours.</li><li><strong>No web UI.</strong> A static report.html is the closest concession.</li></ul><p>Security findings live in azure-security-investigator, a separate v2 stub in the same repo, sharing the core package. Splitting cost from security at the skill boundary keeps each persona&#39;s report focused.</p><h3>Running it</h3><pre>az login                                  # interactive<br>uv sync --all-packages                    # one-time<br>azure-investigator pull -s &lt;SUB_NAME&gt;     # one or more --subscription flags<br>azure-cost-investigator analyse latest    # writes report.md + report.html + findings.yaml</pre><p>Twenty minutes is roughly the wall-clock for a tenant with a few dozen subscriptions worth of resources. Most of it is az calls; the rule evaluation is sub-second.</p><p>For a printable PDF: open report.html in a browser, ⌘P → Save as PDF. The CSS is print-tuned.</p><h3>Repo</h3><p><a href="https://github.com/mindaugasnakrosis/azure-costs-analyzer">github.com/mindaugasnakrosis/azure-costs-analyzer</a></p><p>MIT-licensed. Python 3.11+. CI green on 3.11 and 3.12.</p><p>If you run it against your own tenant and it surfaces something interesting (or — more usefully — something <em>wrong</em>), open an issue. Calibration against more tenants is the next thing keeping this honest.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=40efc3cf5b19" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From markdown notes to a sized Jira backlog in five minutes]]></title>
            <link>https://mindaugasnakr.medium.com/from-markdown-notes-to-a-sized-jira-backlog-in-five-minutes-3fbca07a9c3f?source=rss-b1e4a6e14bbd------2</link>
            <guid isPermaLink="false">https://medium.com/p/3fbca07a9c3f</guid>
            <category><![CDATA[leadership]]></category>
            <category><![CDATA[agile]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <dc:creator><![CDATA[Mindaugas Nakrosis]]></dc:creator>
            <pubDate>Wed, 29 Apr 2026 07:01:01 GMT</pubDate>
            <atom:updated>2026-04-29T07:01:01.917Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D-kamJ59qJnBrb7gFIjOpQ.png" /></figure><p><em>A working agent that does the unglamorous part of agile delivery — and refuses to ship vague work.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/1*PDd_W3GSY7NfVwJWS5gAKg.png" /></figure><p>Last week I tested an idea on a deliberately rough product brief — an Inventory Management System change list, six themes, eighteen features, three bugs, written in the kind of plain language people actually use when they&#39;re thinking. No Jira terminology, no story-point talk, no acceptance criteria. Just sections like &quot;Real-Time Stock Visibility&quot; and bullets like &quot;extend the stock read model to track bonded and duty-paid quantities independently.&quot;</p><p>The traditional next step is for a business analyst or a senior engineer to spend half a day grooming that into Jira: deciding the Epic / Story / Subtask split, writing INVEST-compliant summaries, sizing in modified Fibonacci, picking priorities, applying a label taxonomy, and writing acceptance criteria a tester can actually verify.</p><p>I gave the markdown to Claude Code with a Jira-aware skill loaded. Five minutes later there were 48 tickets in a Jira project, sized, prioritised, and labelled, with descriptions written to a senior-coach standard.</p><p>Here&#39;s what came out, what didn&#39;t, and why the interesting thing isn&#39;t the tool.</p><h3>The run</h3><p>The skill is mdjira — a tiny Python CLI plus a Claude skill file that encodes the working canon of agile and Jira practice. Citations to Bill Wake on INVEST, Mike Cohn on the user-story template and Fibonacci sizing, Dan North on Given/When/Then, Atlassian on the epic/story/subtask hierarchy and the &quot;Miscellaneous Bug Fixes&quot; anti-pattern, Roman Pichler on slicing the cake. Open the skill file and every rule has a footnote.</p><p>The flow:</p><ol><li>I typed /mdjira IMS-project-example.md in Claude Code.</li><li>The skill read the markdown, made structural decisions, and drafted an intake.yaml next to the source file.</li><li>It ran a lint check (17 mechanical anti-pattern rules — empty descriptions, single-child epics, unsized stories, uniform priorities, padding subtasks, label spam) and reported a 30-second human-readable preview.</li><li>I approved.</li><li>The CLI made three bulk API calls to Jira (POST /rest/api/3/issue/bulk, one per hierarchy level — Epics, Stories, Subtasks) and wrote a results.json audit file. 48 tickets, SCRUM-5 through SCRUM-52.</li></ol><p>That&#39;s the surface story. The interesting part is what the skill <em>decided</em> in step 2.</p><h3>The judgment shown</h3><p>Three calls stood out, the kind a junior would miss and a senior would defend.</p><p><strong>It killed a &quot;Defects to Fix&quot; epic.</strong> The source markdown had a section titled &quot;Defects to Fix&quot; with three bugs underneath: a concurrency race, a timezone export bug, and a search bug ignoring accented characters. The naive move is to honour the source structure: Epic &quot;Defects&quot;, three child Stories. The skill refused. Atlassian&#39;s own guidance calls a &quot;Miscellaneous Bug Fixes&quot; epic an anti-pattern by name — <em>only create an Epic if there is a clear beginning, end, and specific value being delivered.</em> The three bugs share nothing except being defects. So the skill distributed them: the concurrency race attached to the real-time stock epic (it directly threatens the data-integrity outcome that epic depends on), the timezone bug to the audit-and-compliance epic (where exports live), and the accented-character search bug to the UX epic (catalogue-search friction). Each kept a defect label so they remain filterable as a set.</p><p><strong>It split a too-big story.</strong> The source had a single recommendation called &quot;Two-way sync with the trading platform&quot; — publish stock-reservation events from IMS, consume shipment events back, with idempotency on redelivery. As a single story that&#39;s a sub-epic in disguise: two surfaces, two teams&#39; concerns, sequenced consumer-depends-on-publisher. The skill split it into INTEG-PUB and INTEG-CONS, sized each at 5 points, and noted in the description that the consumer is dependent on the publisher&#39;s contract. That&#39;s textbook Pichler — slicing the cake on goal lines, not technical lines.</p><p><strong>It refused a uniform Highest.</strong> A common mistake under time pressure is to mark everything as High because everything <em>feels</em> important. The skill flagged exactly one ticket as Highest: the negative-stock concurrency race. Its rationale, in the preview message: <em>silent data corruption from a known race, undermines every other RTSV story, active fire.</em> Everything else landed at High / Medium / Low in proportion. The final spread was 1 Highest, 5 High, 9 Medium, 2 Low — which is what a healthy backlog looks like. If everything is Highest, nothing is.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ew6nzjqQNVGwHDm8-vfxLg.png" /></figure><h3>What got written, not just decided</h3><p>Each story description follows a fixed template — <em>Why this matters</em>, <em>Scope</em>, <em>Acceptance criteria</em>, <em>Source</em> — so a stakeholder can read any single ticket cold and know what&#39;s being done and why. The acceptance criteria are written as observable outcomes, not implementation steps. From the live-stock story:</p><blockquote>A stock movement recorded by the warehouse adjustment service is reflected on the dashboard tile within 60s</blockquote><blockquote>When the client loses connectivity for up to five minutes, it reconnects and resyncs to current stock without user action</blockquote><blockquote>No regression in initial dashboard load time (within ±10% of baseline)</blockquote><p>Compare to what a rushed draft would have written: &quot;Real-time updates work. Reconnection handled.&quot; Both describe the same feature; only one is testable.</p><p>For backend / infra / bug stories, AC are bullet checklists. For user-facing flows, AC are Given/When/Then. The skill picks per story and doesn&#39;t mix formats — force-fitting Given/When/Then onto a database resize is something amateurs do.</p><p>Story points are on the modified Fibonacci scale (1, 2, 3, 5, 8, 13). Anything that would size to 20+ has to be split before it can leave the skill — Cohn&#39;s point about the gaps growing with size is the explicit policy. The 17 stories from this run totalled 91 points: 1×2pt, 3×3pt, 8×5pt, 5×8pt, no 13s. Every 5-point or larger story has a sizing rationale in the preview.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R3tqG6dcHA4mJ25XfkptFQ.png" /></figure><h3>What this is, and what it isn&#39;t</h3><p>mdjira is not a &quot;wrap GPT around Jira&quot; wrapper. The LLM is a substitutable component; Claude today, something else next year. The product is the <strong>encoded senior-coach prompt</strong> — about 400 lines of agile and Jira practice with citations, anti-pattern checks, title patterns by ticket type, and a description template that&#39;s mandatory for every ticket. It&#39;s the kind of thing a £1000/day Jira contractor would charge a quarter to teach a team and then leave behind half-applied.</p><p>What surprised me, building it: the prompt&#39;s value is mostly in the <em>refusals</em>. The skill refuses to write a ticket without a &quot;Why this matters&quot; line. It refuses to size a story above 13 without splitting. It refuses to ship an epic with one child. It refuses to mix Given/When/Then with bullet AC in the same ticket. It refuses to use labels as priority synonyms. The cumulative effect is that the output is <em>worse to argue with than to accept</em>, because the alternative is producing the same level of rigour by hand.</p><p>That last sentence is the whole bet. Most agile tooling assumes you&#39;ll fight the rigour and lose. This one assumes you&#39;ve already lost the fight against the rigour and want help applying it consistently.</p><h3>Try it</h3><p>Repo: <a href="https://github.com/mindaugasnakrosis/mdjira">https://github.com/mindaugasnakrosis/mdjira</a></p><pre>pip install mdjira<br>mdjira init<br>mdjira install-skill</pre><p>Then in Claude Code, on any markdown file:</p><pre>&gt; /mdjira specs/your-doc.md</pre><p>It will preview before writing. It will refuse to ship vague work. The first run on a real document is the only review you need to decide whether the bet — that encoded judgment is more valuable than encoded automation — holds for your team.</p><p><em>MIT licensed. Issues, forks, and bug reports welcome. The skill file is the spec — disagree with a rule? Fork it. That&#39;s the point.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3fbca07a9c3f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Title: Building Scalable Infrastructure: A Guide for CTOs]]></title>
            <link>https://mindaugasnakr.medium.com/title-building-scalable-infrastructure-a-guide-for-ctos-7df4c6434e38?source=rss-b1e4a6e14bbd------2</link>
            <guid isPermaLink="false">https://medium.com/p/7df4c6434e38</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[cto]]></category>
            <category><![CDATA[scalable-architecture]]></category>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[cto-as-a-service]]></category>
            <dc:creator><![CDATA[Mindaugas Nakrosis]]></dc:creator>
            <pubDate>Tue, 28 Nov 2023 15:42:46 GMT</pubDate>
            <atom:updated>2023-11-28T15:42:46.853Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>Introduction</strong>: As technology continues to evolve at a rapid pace, the need for scalable infrastructure is more critical than ever. As a Chief Technology Officer (CTO), it’s your responsibility to ensure that your organization’s infrastructure can handle growth, maintain performance, and adapt to changing demands. In this article, we’ll explore key strategies and best practices for creating scalable infrastructure.</h4><h4>1. Embrace Cloud Computing:</h4><ul><li>Leverage cloud services to benefit from on-demand resources.</li><li>Use Infrastructure as Code (IaC) tools for efficient resource provisioning.</li><li>Explore serverless computing for automatic scaling based on demand.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LiPrdOwrkY3nEjZi.png" /><figcaption>Serverless scalable architecture AWS</figcaption></figure><h4>2. Microservices Architecture:</h4><ul><li>Break down applications into small, independent services.</li><li>Enables easier scalability, fault isolation, and development agility.</li><li>Use containerization (e.g., Docker) for consistent deployment.</li></ul><h4>3. Load Balancing:</h4><ul><li>Distribute incoming traffic across multiple servers to prevent overloading.</li><li>Implement a load balancer to ensure optimal resource utilization.</li><li>Use elastic load balancing for automatic scaling in response to demand.</li></ul><h4>4. Horizontal Scaling:</h4><ul><li>Add more servers or resources to the system to handle increased load.</li><li>Distribute workload across multiple servers for improved performance.</li><li>Automate scaling based on predefined thresholds.</li></ul><h4>5. Monitoring and Analytics:</h4><ul><li>Implement robust monitoring tools to track system performance.</li><li>Use analytics to identify patterns, forecast demand, and optimize resources.</li><li>Implement alerts for proactive issue resolution.</li></ul><h4>6. Database Scaling:</h4><ul><li>Choose databases that support horizontal scaling (e.g., NoSQL databases).</li><li>Implement sharding to distribute data across multiple database servers.</li><li>Optimize queries and indexes for improved database performance.</li></ul><h4>7. CDN Integration:</h4><ul><li>Utilize Content Delivery Networks (CDNs) to cache and deliver content globally.</li><li>Improve latency and reduce server load by distributing content geographically.</li><li>Integrate CDN with your infrastructure for faster content delivery.</li></ul><h4>8 Automated Deployment and Testing:</h4><ul><li>Implement Continuous Integration/Continuous Deployment (CI/CD) pipelines.</li><li>Automate testing to ensure new features do not compromise scalability.</li><li>Streamline deployment processes for efficiency and reliability.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/0*6tpzSqkN3b9rK4Xi.png" /></figure><p><strong>Conclusion</strong>: Creating scalable infrastructure is a continuous process that involves embracing modern technologies, staying agile, and being proactive in addressing challenges. As a CTO, adopting these strategies will not only enhance your organization’s ability to handle growth but also position it for future success in an ever-changing technological landscape.</p><p>By prioritizing cloud computing, microservices architecture, load balancing, horizontal scaling, monitoring, database scaling, CDN integration, and automated deployment, CTOs can build a resilient and scalable infrastructure that meets the demands of today’s dynamic business environment.</p><p>Remember, scalability is not just a technical consideration but a strategic one, ensuring that your organization can adapt and thrive in the face of evolving technological and business challenges.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7df4c6434e38" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fullstack Apollo+React GraphQL setup]]></title>
            <link>https://mindaugasnakr.medium.com/fullstack-apollo-react-graphql-setup-da606e8c97ef?source=rss-b1e4a6e14bbd------2</link>
            <guid isPermaLink="false">https://medium.com/p/da606e8c97ef</guid>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[apollo]]></category>
            <category><![CDATA[graphql-apollo-server]]></category>
            <dc:creator><![CDATA[Mindaugas Nakrosis]]></dc:creator>
            <pubDate>Sat, 14 May 2022 22:09:39 GMT</pubDate>
            <atom:updated>2022-05-14T22:09:39.786Z</atom:updated>
            <content:encoded><![CDATA[<p>In my recent commercial greenfield 🍏 project we decided to use <strong>GraphQL</strong>. The main reasons why our decision shifted towards it:</p><ul><li>We were going to have a mobile and web applications which consume the same API in slightly different ways</li><li>We needed some built-in frontend caching</li><li>The data that we were going to work with was pretty complex and hard for the client to consume</li><li>Automatic TypeScript types generation for the frontend was a requirement</li></ul><p>So we decided to give <a href="https://www.apollographql.com/"><strong>Apollo</strong></a> a try as it is the most widely used GraphQL client. It has its pros and cons and might not suit every project’s needs but I will show you the setup we have.</p><h3>Initial setup</h3><p>The configuration needed to spin everything up is quite well documented and easy to get into place.</p><h4>React</h4><pre>import { ApolloProvider } from &#39;<a href="http://twitter.com/apollo/client">@apollo/client</a>/react&#39;;<br>import { ApolloClient, ApolloLink, createHttpLink, InMemoryCache } from &#39;<a href="http://twitter.com/apollo/client">@apollo/client</a>&#39;;</pre><pre>const cache = new InMemoryCache();<br>  <br>const httpLink = createHttpLink({<br>  uri: http://localhost:4000,<br>});</pre><pre>const client = new ApolloClient({<br>  link: ApolloLink.from([httpLink]),<br>  cache,<br>});</pre><pre>const App = () =&gt; {<br>  return (<br>    &lt;ApolloProvider client={client}&gt;<br>      &lt;Routes /&gt;<br>    &lt;/ApolloProvider&gt;<br>  )<br>}</pre><p><strong>Steps:</strong><br>1. An Apollo client with <strong>inMemoryCache</strong> (which caches stuff, cool right?)<br>2. Assign url to the server which I will soon show how to setup<br>3. That’s already it. Keep on reading!</p><p>And you are good to go. 🎆 There is so much more that we have implemented since:</p><ul><li><strong>Authentication</strong></li><li><strong>Error handling</strong></li><li><strong>Cache configuration</strong></li><li><strong>Local variables</strong></li></ul><p>But I won’t get into all of that in this article.</p><h4>GraphQL server</h4><p>Our GraphQL server basically consists of:</p><ul><li>Datasources (REST)</li><li>Schema</li><li>Resolvers</li></ul><p>This is the full server configuration:</p><pre>import { ApolloServer } from &quot;apollo-server&quot;;<br>import {<br>  ApolloServerPluginLandingPageDisabled,<br>  ApolloServerPluginLandingPageGraphQLPlayground,<br>} from &quot;apollo-server-core&quot;;<br>import depthLimit from &quot;graphql-depth-limit&quot;;<br>import typeDefs from &quot;./schemas&quot;;<br>import resolvers from &quot;./resolvers&quot;;<br>import dataSources from &quot;./datasources&quot;;</pre><pre>console.log(`🔥 process.env.NODE_ENV: ${process.env.NODE_ENV}`);<br>if (process.env.NODE_ENV === &quot;development&quot;) {<br>  process.env.NODE_TLS_REJECT_UNAUTHORIZED = &quot;0&quot;;<br>}</pre><pre>const isProduction = () =&gt; {<br>  return process.env.NODE_ENV === &quot;production&quot;;<br>};</pre><pre>const server = new ApolloServer({<br>  debug: true,<br>  typeDefs,<br>  resolvers,<br>  dataSources,<br>  context: async ({ req }) =&gt; {<br>    return { req };<br>  },<br>  validationRules: [depthLimit(5)],<br>  introspection: isProduction() ? false : true,<br>  formatError: (err) =&gt; {<br>    err.message = err?.extensions?.response?.body?.title || err.message;<br>    return err;<br>  },<br>  plugins: [<br>    isProduction()<br>      ? ApolloServerPluginLandingPageDisabled()<br>      : ApolloServerPluginLandingPageGraphQLPlayground(),<br>  ],<br>});</pre><pre>server.listen({ port: process.env.PORT || 4000 }).then((listenResponse) =&gt; {<br>  console.log(`🚀 Server is running at ${listenResponse.url}`);<br>});</pre><p>You can analyse what each line means yourself as it is pretty self-explanatory.</p><h4>Datasources</h4><p>These as you can expect input our GraphQL with data. You can use whatever dataSource type you want. Not only REST. I will show you how it is done with REST though as it is by far the most popular usage case.</p><p>This is datasources/index.ts:</p><pre>import { DataSources } from &quot;apollo-server-core/dist/graphqlOptions&quot;;<br>import TodoApi from &quot;./TodoApi&quot;;</pre><pre>export interface IDataSources {<br>  todoApi: ITodoAPI;<br>}</pre><pre>const dataSources = (): DataSources&lt;IDataSources&gt; =&gt; {<br>  return {<br>    todoApi new TodoApi(),<br>  };<br>};</pre><pre>export default dataSources;</pre><p>Then you need to define your TodoApi:</p><pre>import { ITodoApi } from &quot;../types/todoTypes&quot;;<br>import BaseRestDataSource from &quot;./BaseRestDataSource&quot;;</pre><pre>class SearchApi extends BaseRestDataSource implements ITodoApi {<br>  constructor() {<br>    super();<br>    this.baseURL = // Your REST service url here<br>  }</pre><pre>  todos() {<br>    return this.get(&quot;Todo&quot;);<br>  }<br>}</pre><pre>export default TodoApi;</pre><p>Then define ITodoApi interface:</p><pre>export interface ITodoApi {<br>    todos(): Promise&lt;Todo&gt;;<br>}<br>  <br>interface Todo {<br>  id: number;<br>  name: string;<br>}</pre><p>And that is your dataSource ready! ✅</p><h4>Schema (type definitions)</h4><p>This is your index file:</p><pre>import { gql } from &quot;apollo-server&quot;;<br>import todoDefs from &quot;./todoDefs&quot;;</pre><pre>const baseTypeDefs = gql`<br>  type Query<br>  type Mutation<br>`;</pre><pre>const schemas = [<br>  todoDefs,<br>];</pre><pre>export default schemas;</pre><p>Then define todo schema:</p><pre>import { gql } from &quot;apollo-server&quot;;</pre><pre>const todoTypeDefs = gql`<br>  extend type Query {<br>    todos: Todo<br>  }</pre><pre>  type Todo {<br>    id: Int!<br>    name: String!<br>  }<br>`;</pre><pre>export default todoTypeDefs;</pre><p><em>Exclamation marks </em>️️️❗<em>means that it is non-nullable.</em><br>And your schema is good to go! ✅</p><h4>Resolvers</h4><p>This is the most interesting part as resolvers enabled us to shape the input that we receive into whatever we want. Resolvers is one of the things that makes GraphQL so powerful 👊. Here is our index file:</p><pre>import GraphQLJSON from &quot;graphql-type-json&quot;;<br>import merge from &quot;lodash/merge&quot;;<br>import todoResolvers from &quot;./todoResolvers&quot;;</pre><pre>export default merge(<br>  {},<br>  todoResolvers,<br>);</pre><p>And the todoResolver:</p><pre>import { IDataSources } from &quot;../types&quot;;</pre><pre>interface IAppContext {<br>  dataSources: IDataSources;<br>}</pre><pre>const queryResolvers = {<br>  todos: (<br>    // unused in this case<br>    parent: unknown,<br>    // no parameter provided to this query<br>    parameters: unknown,<br>    // the REST datasources we can use to make API calls<br>    { dataSources }: IAppContext<br>  ) =&gt; {<br>    return dataSources.todoApi.todos();<br>  },<br>};</pre><pre>export default {<br>  Query: queryResolvers,<br>};</pre><p>The resolver accepts three parameters:</p><ol><li><strong>Parent 👨 </strong>is available if you are trying to access child 👶 of a parent (nested data). e.g:</li></ol><pre>todos {<br>  properties {<br>    propertyName<br>    propertyValue<br>  }<br>}</pre><p>In this case if you were accessing properties in Property resolver the parent would be Todo.</p><p>2. <strong>Parameters</strong>. If you provide parameters to the query or mutation they will be accessible in the resolvers.</p><p>3. <strong>Datasource</strong>. It is the REST datasource that we defined and can be used to fetch data in the resolvers.</p><p>That is an abstract setup of Apollo GraphQL server 🔥. There is so much more to it that I left out intentionally or not as I don’t want this article to become a huge read 📚.</p><p>If you are still reading, thanks for your attention!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IKY9HvQY5m-4dT5M" /><figcaption>Photo by <a href="https://unsplash.com/@kellysikkema?utm_source=medium&amp;utm_medium=referral">Kelly Sikkema</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da606e8c97ef" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>