<?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 Dusmamat Karimov, PhD on Medium]]></title>
        <description><![CDATA[Stories by Dusmamat Karimov, PhD on Medium]]></description>
        <link>https://medium.com/@dkarimov?source=rss-cc6215dc2535------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*pgFG-ROTurVc1fwVqQq1Rg.jpeg</url>
            <title>Stories by Dusmamat Karimov, PhD on Medium</title>
            <link>https://medium.com/@dkarimov?source=rss-cc6215dc2535------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 13:24:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dkarimov/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[Three Powers and a Middle Way: Nursi on the Faculties of the Soul]]></title>
            <link>https://dkarimov.medium.com/three-powers-and-a-middle-way-nursi-on-the-faculties-of-the-soul-a456cac6384f?source=rss-cc6215dc2535------2</link>
            <guid isPermaLink="false">https://medium.com/p/a456cac6384f</guid>
            <dc:creator><![CDATA[Dusmamat Karimov, PhD]]></dc:creator>
            <pubDate>Sun, 15 Nov 2026 20:47:23 GMT</pubDate>
            <atom:updated>2026-11-15T20:47:23.967Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This story was written with the assistance of AI. A source-grounded writing tool drafted the three main sections from passages of my doctoral thesis (Durham, 2017); I checked every note against the cited page and corrected the sentences that did not hold. The introduction and conclusion were drafted with an AI assistant and edited by me.</em></p><p>Justice can be accepted as a form of fairness or an impartial distribution of rights. However, in the thought of Said Nursi the question begins inside the human being, in the balance of the soul’s own powers. To this end, this short article examines how Nursi describes the faculties of the soul and how the doctrine of the mean (<em>wasaṭ</em>) shapes his understanding of justice (<em>ʿadl</em>). It is organised as follows. The first section sets out the three faculties and the reason they are given. The second section describes what happens when each faculty is in deficiency, in excess or at the mean. The third section places Nursi’s account beside those of al-Ghazzālī and Aristotle.</p><h3>The three faculties</h3><p>According to Nursi, the human soul possesses three distinct faculties. The first is the faculty of animal appetites, which comprises sensual and bestial powers that attract useful things to a person. The second is the faculty of animal passion or repulsion, which drives off harmful and destructive things. The third is the faculty of intellect, encompassing rational and angelic powers that enable one to distinguish between good and evil, and between beneficial and harmful [1]. Unlike the faculties of other living creatures, these faculties are bestowed on humans by God’s wisdom without innate limits, allowing for human development [2]. Because they lack built-in restrictions, these faculties can cause imbalance and mischief unless they are regulated and controlled by divinely ordained law [2]. Accordingly, Nursi teaches that humans must maintain the middle path (al-wasaṭ) in using these faculties, avoiding both excess (ifrāṭ) and deficiency (tafrīṭ) [2].</p><h3>The middle way</h3><p>According to the thesis, Nursi identifies three faculties of the human soul: desire, anger and intellect. Each faculty can exist in one of three states, and what manifests depends on which state prevails [3].</p><p>When the faculty of desire is at deficiency, apathy and lack of interest emerge [4]. At excess, greed and profligate behaviour appear [4]. At the mean, the virtue of temperance is attained, and the person desires only what is lawful and abstains from the forbidden [4].</p><p>The faculty of anger at deficiency produces cowardice, causing individuals to fear without cause [4]. At excess, rashness emerges, and Nursi argues that tyranny, despotism and oppression result from this imbalance [4]. At the mean state, courage appears, and a person is disposed to protect the world’s order and the rights of others [4].</p><p>The faculty of intellect at deficiency generates stupidity [4]. At excess, wickedness is produced, making a person wily, tricky and deceitful [4]. When at the mean state, the virtue of wisdom is achieved [4].</p><p>When all three faculties remain sound, moderate and harmonious, the right mean is obtained, which Nursi identifies with justice and a balanced state [3]. The thesis argues that excess and deficiency in these faculties curtail social bonds, violate the rights of innocent people and cause corruption that spoils the order of the earth [5].</p><h3>Nursi among the philosophers</h3><p>According to the thesis, Nursi’s analysis of the soul’s faculties and virtues shares significant ground with both al-Ghazzālī and Aristotle, though with important differences. Like Plato, Nursi identifies three faculties of the soul (desire, anger and reason), whereas al-Ghazzālī counts four; Nursi agrees with both, however, that each faculty can exist in three states [6]. Nursi’s approach to analysing vices and virtues parallels Aristotle’s work, and according to Ozdemir, whom the thesis cites, Nursi had direct acquaintance with the ethical works of Plato and Aristotle [6].</p><p>However, Nursi departs from al-Ghazzālī on a crucial point. Al-Ghazzālī treats justice as a fourth faculty, which in Quasem’s reading controls the faculties of desire and anger, and he holds that justice has no two extremes but only its opposite, injustice [6]. Nursi, by contrast, does not regard justice as a separate faculty at all [6]. Instead, he understands justice as a virtue that emerges when all the other faculties achieve their mean state, making justice itself a synthesis of virtues rather than a faculty that produces them [6].</p><h3>What this article does not cover</h3><ul><li>The thesis does not explain Nursi’s theological rationale for why God specifically chose to give these three faculties rather than a different number or configuration.</li><li>The thesis does not explain how the mean is determined for specific situations or persons.</li><li>The thesis does not provide a detailed comparison of how Nursi’s specific conception of the mean differs from Aristotle’s doctrine of the mean between extremes.</li></ul><h3>Summary and conclusion</h3><p>This article has examined Nursi’s account of the faculties of the soul as it is presented in the thesis. It can therefore be assumed that, for Nursi, justice is not a further power that governs the others. Rather, it is the condition reached when desire, anger and intellect each stand at the mean. In other words, the just person is the balanced person, and the same faculties that are given for human development become sources of mischief when they fall into excess or deficiency. It should be noted that the article draws on one thesis only and does not assess Nursi’s own texts directly; the questions listed above therefore remain open for further study.</p><h3>Sources</h3><p>[1] Karimov, D. (2017), <em>The Qur’anic Concept of Justice (al-ʿAdl) from a Nursian Perspective</em>, PhD thesis, Durham University, § 3.4.2, pp. 138–139.</p><p>[2] Karimov, D. (2017), § 3.4.2, pp. 139–140.</p><p>[3] Karimov, D. (2017), § 5.2, pp. 199–200.</p><p>[4] Karimov, D. (2017), § 5.2, pp. 200–201.</p><p>[5] Karimov, D. (2017), § 5.5, pp. 217–218.</p><p>[6] Karimov, D. (2017), § 5.2, pp. 202–203.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a456cac6384f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Workflow, Not Agent: Building a Source-Grounded Article Writer for a Doctoral Thesis]]></title>
            <link>https://dkarimov.medium.com/workflow-not-agent-building-a-source-grounded-article-writer-for-a-doctoral-thesis-66c8424155cd?source=rss-cc6215dc2535------2</link>
            <guid isPermaLink="false">https://medium.com/p/66c8424155cd</guid>
            <dc:creator><![CDATA[Dusmamat Karimov, PhD]]></dc:creator>
            <pubDate>Sun, 15 Nov 2026 00:00:39 GMT</pubDate>
            <atom:updated>2026-11-15T21:00:06.180Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TFsoCKY9gqgI6CPY.png" /></figure><p>Language models are now routinely described as agents, and almost any system that calls a model more than once is presented as agentic. This article does not argue that agents are the wrong tool. Rather, it argues that a writing tool whose purpose is to be checked against its source is better built as a workflow, and it shows what such a workflow looks like in practice. The system in question drafts short articles from one source only, the author’s 2017 doctoral thesis, and every sentence it prints must point to a printed page of that thesis. To this end, the article is organised as follows. The first section settles the question of whether the system is an agent. The second section compares it with five published systems that do similar work. The third section describes how the workflow was built, and the fourth reports what its first real drafts revealed. The fifth section presents a published example, and the last section states the limits of the claim.</p><h3>1. Agent or workflow?</h3><p>The clearest distinction comes from Anthropic’s guide <em>Building effective agents</em>. According to the guide, “workflows are systems where LLMs and tools are orchestrated through predefined code paths”, whereas agents “are systems where LLMs dynamically direct their own processes and tool usage, maintaining control over how they accomplish tasks” [1]. It should be noted that the guide places both under the wider heading of agentic systems, so the useful question is not whether a system is agentic in some loose sense but which of the two architectures it follows.</p><p>Measured against that distinction, the article writer is a workflow. The author writes the title and the outline, and each outline line becomes one question to the thesis. Each question receives one retrieval and one model call, after which a programmatic gate either accepts the section or blocks it with a stated reason. The model never chooses a tool, never decides to search again and never decides when the article is finished. In other words, the pattern is what the guide calls prompt chaining with a gate, and the guide’s own example of that pattern is almost a description of this tool: “writing an outline of a document, checking that the outline meets certain criteria, then writing the document based on the outline” [1].</p><p>The survey literature on agentic retrieval draws the same line. Singh and colleagues describe agentic retrieval-augmented generation as systems in which agents “dynamically manage retrieval strategies” and “iteratively refine contextual understanding” [2]. The article writer does neither, and this is deliberate. Interestingly, the guide itself observes that “workflows offer predictability and consistency for well-defined tasks” [1], and a task whose output must be traced, priced in advance and reproduced from a record is exactly such a task. Taken together, the accurate description is therefore a grounded, human-in-the-loop drafting workflow over a retrieval pipeline, not an agent.</p><h3>2. Five systems that do similar work</h3><p>The closest system in shape is STORM, developed at Stanford and published at NAACL 2024 [3]. STORM writes Wikipedia-like articles in two stages: it first researches a topic and builds an outline, and it then writes the article section by section, retrieving material for each section by its headings. However, STORM builds the outline itself, by simulating conversations between writers with different perspectives and a question-answering component grounded on the web. The article writer, by contrast, takes the outline from the author and searches one document only. It is also worth noting what STORM’s authors found when they examined unsupported sentences: the main problems were “drawing improper inferences and inaccurate paraphrasing, rather than hallucinating non-existent contents” [3]. As section 4 shows, the same kind of error appeared in this project.</p><p>The closest system in method is WikiCrow, built on PaperQA2 by FutureHouse [4]. According to its authors, each PaperQA2 query “created a different article section”, which is the same one-question-per-section design used here. WikiCrow’s articles had fewer cited but unsupported statements than the matching human-written Wikipedia articles (13.5% against 24.9%), at an average cost of $4.48 per article [4]. Nevertheless, PaperQA2 itself is an agent in the sense defined above, because it chooses among tools to find papers, gather evidence and explore citations.</p><p>OpenScholar, published in <em>Nature</em> in 2026, synthesises answers from 45 million open-access papers and refines its own draft “by means of a self-feedback loop” that includes citation verification [5]. That loop is precisely what the article writer avoids: a section that fails is recorded and shown, not regenerated. GPT Researcher, a widely used open-source project, goes further still, since planner and execution agents generate their own research questions, search the web and assemble a report [6].</p><p>Finally, ALCE, a benchmark from Princeton presented at EMNLP 2023, offers a way of measuring citation quality automatically: citation recall asks whether each statement is supported by its citations, and citation precision asks whether each citation is needed [7]. According to its authors, the automatic scores agreed substantially with human judges on recall (Cohen’s kappa 0.698) and moderately on precision (0.525) [7]. From the above it can be assumed that the article writer is not novel in its parts. What appears to be less common is the combination: one author’s own corpus, opaque handles resolved to printed pages, sections refused when support is weak, and a recorded human verdict on every note. It should be noted, however, that the search behind this comparison was not exhaustive.</p><h3>3. How the workflow was built</h3><p>The project began as a question-answering assistant over the thesis, and its central rule was set before the article writer existed. The thesis is split into 294 passages, each stored with the printed page it came from, and a question retrieves the five closest passages. The model sees those passages only under opaque handles such as [E1] and never sees a page number. Consequently, a page number in the output can only come from the stored record, so the model cannot invent one. A validation step then checks that every handle exists, that no page number was written by the model, and that a weak answer says so rather than pretending to be complete.</p><p>The article writer was added in three planned stages, each written as a plan, approved and then built by Claude Code sessions working from written briefs, with every change reviewed before it was merged and deployed to a Raspberry Pi. The essential design decision was that the writer would not be a second pipeline. Each section brief is sent through the same question-answering path and the same validation as an ordinary question, so a section that the thesis cannot support is not written at all. In addition, the writer leaves out reference-list passages and cuts footnote text before drafting, because a footnote that cites another scholar would otherwise be presented as the author’s own view; of the 294 passages, 262 remain available to an article.</p><p>The first real draft, discussed below, led to seven further changes, each introduced with a test that failed on the old code [8]. A note marker must close the clause it supports and may never act as a word of the sentence, so “[5] states that” now blocks a section. Limitations are gathered into one closing list, “What this article does not cover”, instead of appearing in the body. The model’s own commentary is switched off by default and, when switched on, needs the author’s separate verdict. A direct quotation may not exceed 25 words, and quotations may not exceed one fifth of a section. An optional editorial pass may rewrite a section for flow, but the rewrite is kept only if every paragraph carries exactly the same notes as before, no new name, number or transliterated term appears, and no em dash is introduced. Moreover, every finished step is now saved at once, so a restart can no longer lose a paid draft, and a command-line tool can plan an article and print its model calls before anything is sent.</p><p>It is equally important to record what was rejected. An automatic entailment model was considered as a gate and rejected, because it could not run in the project’s offline tests and because the evaluation literature reports such checks at their weakest on changed entities and subtle inconsistencies [8], [9]. Therefore the final judgement on each note remains with the author, who marks it in the application as supporting, partly supporting or not supporting the sentence. Until every note is judged, the article remains marked as a draft. On Claude Haiku 4.5, the model used here, each section costs roughly one US cent.</p><h3>4. What the first drafts revealed</h3><p>The first real draft, made on 15 November 2026, passed every automatic check and still did not read as an article. Note numbers stood as the subjects of sentences (“[5] describes three faculties”), five lines beginning “The evidence does not” sat in the body, and five commentary paragraphs appeared in three sections. More seriously, one commentary sentence spoke of “Nursi’s decision to endow humans with unlimited faculties”, whereas the thesis attributes that act to God; in other words, the model had changed who acts in the source. Measured against the author’s own writing, the draft also used 6.2 connectives per 1,000 words, against a target of at least 12.</p><p>After the seven changes, two further drafts were made from the same outline, one with the editorial pass and one without. Both passed validation, and both printed a raw handle where a note number should have been: “[E1, E2]” in one and “[E1, E4]” in the other. The cause was small but instructive. The pattern that recognises handles matched only single handles such as [E1], and validation combined the handles it found with the model’s own list of the citations it had used, which did list E1 and E2. As a result, nothing failed, and an unresolved handle reached the reader with no page behind it. The fix makes any joined bracket a validation failure and adds a final guard in both renderers, so that no raw handle can be printed [10]. When the two earlier drafts were reopened under the new code, each showed one blocked section with the reason “one handle per bracket”; the full offline suite reported 468 tests passed and one expected failure.</p><p>The editorial pass also produced a useful negative result. In one section the rewrite was rejected because it introduced an em dash, and the original stood. However, the original itself contained four em dashes, because the rule applied only to the rewrite. That is to say, a check that guards one step does not guard the text that the step leaves untouched, and the project now reports such dashes for every section.</p><h3>5. A published example</h3><p>A clean draft was then made from the same outline under the corrected code, on the faculties of the soul and the doctrine of the mean in the thought of Said Nursi. All three sections were written, none was blocked, no raw handle was printed, and the six notes resolved to printed pages. The draft is published on Medium, with an AI disclosure at the top, as <a href="https://dkarimov.medium.com/three-powers-and-a-middle-way-nursi-on-the-faculties-of-the-soul-a456cac6384f"><em>Three Powers and a Middle Way: Nursi on the Faculties of the Soul</em></a>.</p><p>Interestingly, the most important correction was one that no automatic check could have caught. The draft stated that “like Plato and al-Ghazzālī, Nursi identifies three primary faculties of the soul” and cited the correct pages. Yet the cited page says that al-Ghazzālī “mentions the four faculties”; Nursi agrees with him only on the three possible states of each faculty. The note was real, the page was right, and the sentence was wrong. Five further corrections were of the same kind. Two claims that the thesis reports from other scholars, Ozdemir and Quasem, had been presented as the thesis’s own; one term, “animal passion”, named the faculty of anger in one section and the faculty of desire in the next; one sentence inverted what the source says about the consequences of excess; and one closing sentence carried no note at all. Each was corrected against the cited page before publication. Taken together, these corrections illustrate the limit stated in the project from the start: a checked note proves that a passage exists, not that it supports the sentence.</p><h3>6. Limits</h3><p>The claim of this article is modest. The workflow guarantees that every printed page number comes from the stored record and that a section the thesis cannot support is refused; it does not guarantee that a cited passage supports the sentence that cites it. The support rate of the articles has not yet been measured over more than one article, and the corrections reported above come from one draft only. In addition, the system has been used on one corpus, written by one author, so nothing here shows how it behaves on a collection of sources that disagree. Medium’s own policy also matters for anyone who publishes such text: writing that is mainly AI-generated may not be placed behind the paywall, whether or not it is disclosed, and a story that is fully AI-generated is not promoted beyond the author’s own network [11].</p><h3>Summary and conclusion</h3><p>This article has set out to answer two questions: whether a source-grounded article writer should be called an agent, and how such a writer can be built so that its output can be checked. The main finding is that the article writer is a workflow in Anthropic’s sense, a chain of fixed steps with programmatic gates, and that this is a strength for its purpose rather than a shortcoming. Systems such as STORM, WikiCrow and OpenScholar show what more autonomy can add in breadth and coverage; however, every degree of autonomy also adds a decision that the reader cannot trace. It can therefore be assumed that, where the purpose of a text is to be verified against one source, the more useful design keeps the model on fixed rails and leaves the last judgement to the person whose source it is. The next step, suggested by ALCE, is an automatic support check that proposes a verdict for each note while leaving the final verdict with the author.</p><h3>References</h3><p>[1] Schluntz, E. and Zhang, B. (2024). Building effective agents. Anthropic. <a href="https://www.anthropic.com/research/building-effective-agents">https://www.anthropic.com/research/building-effective-agents</a>.</p><p>[2] Singh, A. et al. (2025). Agentic Retrieval-Augmented Generation: A Survey on Agentic RAG. arXiv:2501.09136.</p><p>[3] Shao, Y., Jiang, Y., Kanell, T. A., Xu, P., Khattab, O. and Lam, M. S. (2024). Assisting in Writing Wikipedia-like Articles From Scratch with Large Language Models. NAACL 2024. <a href="https://aclanthology.org/2024.naacl-long.347">https://aclanthology.org/2024.naacl-long.347</a>.</p><p>[4] Skarlinski, M. D. et al. (2024). Language agents achieve superhuman synthesis of scientific knowledge. arXiv:2409.13740.</p><p>[5] Asai, A. et al. (2026). Synthesizing scientific literature with retrieval-augmented language models. Nature 650, 857–863. <a href="https://www.nature.com/articles/s41586-025-10072-4">https://www.nature.com/articles/s41586-025-10072-4</a>.</p><p>[6] Elovic, A. GPT Researcher. <a href="https://github.com/assafelovic/gpt-researcher">https://github.com/assafelovic/gpt-researcher</a>.</p><p>[7] Gao, T., Yen, H., Yu, J. and Chen, D. (2023). Enabling Large Language Models to Generate Text with Citations. EMNLP 2023. <a href="https://aclanthology.org/2023.emnlp-main.398">https://aclanthology.org/2023.emnlp-main.398</a>.</p><p>[8] source-grounded-rag. Decision record 0005: Making a drafted article readable without weakening its grounding. <a href="https://github.com/mattkari/source-grounded-rag/blob/main/docs/decisions/0005-article-quality.md">https://github.com/mattkari/source-grounded-rag/blob/main/docs/decisions/0005-article-quality.md</a>.</p><p>[9] Honovich, O. et al. (2022). TRUE: Re-evaluating Factual Consistency Evaluation. NAACL 2022. arXiv:2204.04991.</p><p>[10] source-grounded-rag. Decision record 0006: One handle per bracket. <a href="https://github.com/mattkari/source-grounded-rag/blob/main/docs/decisions/0006-one-handle-per-bracket.md">https://github.com/mattkari/source-grounded-rag/blob/main/docs/decisions/0006-one-handle-per-bracket.md</a>.</p><p>[11] Medium Help Center. Artificial Intelligence (AI) content policy. <a href="https://help.medium.com/hc/en-us/articles/22576852947223">https://help.medium.com/hc/en-us/articles/22576852947223</a>.</p><p>Keep reading</p><p><a href="https://mattkari.github.io/writing">All 14 essays</a></p><p><em>Originally published at </em><a href="https://mattkari.github.io/articles/workflow-not-agent/"><em>https://mattkari.github.io</em></a><em> on November 15, 2026.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=66c8424155cd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I turned my crypto trading bot into a signal engine that cannot trade.]]></title>
            <link>https://dkarimov.medium.com/i-turned-my-crypto-trading-bot-into-a-signal-engine-that-cannot-trade-47c3b26c9e60?source=rss-cc6215dc2535------2</link>
            <guid isPermaLink="false">https://medium.com/p/47c3b26c9e60</guid>
            <dc:creator><![CDATA[Dusmamat Karimov, PhD]]></dc:creator>
            <pubDate>Fri, 23 Oct 2026 19:39:17 GMT</pubDate>
            <atom:updated>2026-10-23T19:39:17.714Z</atom:updated>
            <content:encoded><![CDATA[<h3>I turned my crypto trading bot into a signal engine that cannot trade. Here’s how it reads BTC, ETH and ADA</h3><p><a href="https://mattkari.github.io/">Matt Karimov</a> · <a href="https://mattkari.github.io/writing">All writing</a><em>A test automation engineer’s walkthrough of a read-only market signal engine on a Raspberry Pi: the indicators, the gates, the Telegram bot, the live data, and what it can and cannot tell you about the market.</em></p><p>Matt Karimov · Test automation engineer · October 2026</p><blockquote><strong><em>Not financial advice.</em></strong><em> This is a personal engineering project. It reads public market data and prints technical indicators. It doesn’t predict prices, its strategy has only been tested in-sample, and nothing below is a recommendation to buy or sell anything.</em></blockquote><h3>From trading bot to signal engine</h3><p>This project started as a live Binance trading bot written in Python. It watched Bitcoin, Ethereum and Cardano on four-hour candles and placed real orders when its rules lined up.</p><p>When I closed the exchange account, I had a choice. I could add a DRY_RUN = True flag and keep the order code &quot;just in case&quot;, or I could delete the trading capability completely.</p><p>I deleted it. A repository that is one boolean away from placing an order is a risk, not a feature. What’s left is a <strong>read-only signal engine</strong>:</p><ul><li>It reads public market data (prices, candles, order book) with no API key.</li><li>It computes the same technical signals the bot used to trade on.</li><li>It reports them three ways: a Telegram bot, a web dashboard, and a JSON API.</li></ul><p>The last trading-capable version is preserved at a git tag, so the history is honest and nothing is lost.</p><h3>Live data first</h3><p>This is the dashboard, captured from the running container on my Raspberry Pi on <strong>23 October 2026 at 19:43 UK time</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6C4UciQFl6y1x0Ai.png" /></figure><p>At that moment:</p><p>All three say <strong>HOLD</strong>, and the reason is the same: the 4-hour trend gate (the red ✕ HTF badge) is blocked because the short-term average is below the longer one. The rest of this article explains what that means and how the engine arrives at it.</p><h3>How it works</h3><h3>The pipeline</h3><pre>Public Binance market data (no API key) └─ 4h candles (300), daily candles (250), 24h ticker, order book └─ indicators: RSI, EMA9/EMA21, MACD, Bollinger Bands, ATR, volume, buyer % └─ 3 mandatory gates: 4h trend, market regime, daily trend └─ mode: TREND-FOLLOWING or MEAN-REVERSION └─ condition score (e.g. 5 of 7) → BUY / SELL / HOLD └─ Telegram · web dashboard · JSON API</pre><p>One function, evaluate_symbol(), does the whole computation and returns a plain dictionary. The Telegram bot, the dashboard, the API and the tests all read that same dictionary, so the three outputs can never disagree about the logic.</p><h3>Step 1: the indicators</h3><p>For each coin, the engine looks at the <strong>last closed</strong> 4-hour candle (the current one is still moving, so its values would change under you) and calculates:</p><ul><li><strong>RSI (14):</strong> how stretched recent moves are. Below 35 is usually called oversold, above 65 overbought.</li><li><strong>EMA9 and EMA21:</strong> a fast and a slow average. EMA9 above EMA21 means short-term momentum is up.</li><li><strong>MACD histogram:</strong> the gap between two averages, minus its own average. Rising means downward momentum is fading.</li><li><strong>Bollinger Bands:</strong> a band two standard deviations around the 20-period average. Touching the lower band is a common “stretched down” sign.</li><li><strong>Volume against its average,</strong> and <strong>buyer %</strong>: the share of volume that came from buyers (Binance’s taker-buy volume).</li></ul><h3>Step 2: three gates that must all pass</h3><p>Before any BUY is considered, three gates act like a pre-flight check:</p><p>On 23 October, the regime gate passed for all three coins (the market was “ranging”, not wild), but the 4h trend gate was blocked for all three. That alone is enough to force HOLD.</p><h3>Step 3: trend mode or mean-reversion mode</h3><p>The engine runs in one of two modes:</p><ul><li><strong>Trend-following:</strong> used when the daily chart is in a golden cross and the 4h trend isn’t bearish. A BUY needs 5 of 8 conditions, including EMA9 above EMA21 and a positive MACD.</li><li><strong>Mean-reversion:</strong> used otherwise. It looks for oversold bounces at support. A BUY needs <strong>5 of 7</strong> conditions.</li></ul><p>Here is the full mean-reversion scorecard for Bitcoin from the same run:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/0*C78rka5omLt49s2x.png" /></figure><p>Bitcoin scored <strong>3 of 7</strong>:</p><ul><li><strong>Passed:</strong> buyers slightly outnumbered sellers (54%), MACD was rising, and volume was above average.</li><li><strong>Failed:</strong> RSI wasn’t below 35 yet (36.6), RSI was falling, price wasn’t at support or the lower band, and the candle was red.</li></ul><p>Ethereum and Cardano each scored <strong>4 of 7</strong>, so all three fell short of five even before the trend gate. Cardano was the closest to a textbook oversold setup (RSI 32.2), but its RSI was still falling.</p><p>This is the part I like most as a tester: every decision is traceable. You can see exactly which conditions passed and failed, and why the answer is HOLD. Nothing is a black box.</p><h3>Talking to it on Telegram</h3><p>The engine runs a small Telegram bot through the python-telegram-bot library. It only answers four commands, all read-only:</p><p>There’s deliberately no /buy, /sell, /start, /stop or /balance. Those existed when it was a trading bot and were deleted with the order code.</p><p>This is the reply to /signal btc, rendered from the bot&#39;s own formatting function with the same live data:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/0*uX9Od94oWbK7LYVC.png" /></figure><p><em>Note: this image is rendered from the bot’s real output text, not a phone screenshot.</em></p><h3>Set up your own bot (5 minutes)</h3><ol><li>In Telegram, message <strong>@BotFather</strong>, send /newbot, and pick a name. BotFather gives you a <strong>bot token</strong>. Treat it like a password.</li><li>Send any message to your new bot, then open https://api.telegram.org/bot&lt;TOKEN&gt;/getUpdates in a browser. Your <strong>chat ID</strong> is the chat.id number in the reply.</li><li>Put both in a .env file next to docker-compose.yml. Never commit it:</li></ol><pre>TELEGRAM_BOT_TOKEN=... # from BotFather TELEGRAM_CHAT_ID=... # from getUpdates ZAI_API_KEY=... # optional, only for the LLM analyst</pre><pre>docker compose up -d --build curl -s localhost:8300/api/health</pre><p>The health check answers with &quot;trading_enabled&quot;: false, plus how old the cached data is.</p><h3>The bot code in brief</h3><p>Commands map to small async handlers. The /signal handler calls the same scan() function the command line uses:</p><pre>async def _cmd_signal(update, context): symbol_arg = context.args[0].lower() if context.args else None result = scan(symbol_arg) # same computation as the dashboard and API await update.message.reply_text(f&quot;📊 *Signal Check*\n{result}&quot;, parse_mode=&quot;Markdown&quot;) app = Application.builder().token(os.environ[&quot;TELEGRAM_BOT_TOKEN&quot;]).build() app.add_handler(CommandHandler(&quot;signal&quot;, _cmd_signal)) app.add_handler(CommandHandler(&quot;status&quot;, _cmd_status)) app.add_handler(CommandHandler(&quot;help&quot;, _cmd_help)) app.run_polling(drop_pending_updates=True)</pre><p>A Raspberry Pi drops its connection now and then, so startup retries with a back-off (5s, 10s, 15s…). A global error handler logs Telegram’s occasional “Bad Gateway” errors as one line rather than letting them crash the bot.</p><h3>The dashboard and API</h3><p>The second container is a small FastAPI app on port 8300, reachable only on my home network:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VuqhM8G2vIT2IrZL.png" /></figure><p>Every route is a GET. Sending a POST to /api/signals returns <strong>405 Method Not Allowed</strong>, which I checked on the running container. A background loop refreshes the signals every 5 minutes and stores them in memory, so page views never multiply calls to the exchange.</p><pre>curl -s localhost:8300/api/signals/ada</pre><pre>{ &quot;symbol&quot;: &quot;ADA/USDT&quot;, &quot;signal&quot;: &quot;HOLD&quot;, &quot;mode&quot;: &quot;MEAN-REV&quot;, &quot;price&quot;: 0.2164, &quot;rsi&quot;: 32.2, &quot;explanation&quot;: &quot;Downtrend - wait for reversal&quot;, &quot;gates&quot;: {&quot;htf_trend&quot;: {&quot;value&quot;: &quot;bearish&quot;, &quot;blocked&quot;: true}, &quot;regime&quot;: {&quot;value&quot;: &quot;ranging&quot;, &quot;blocked&quot;: false}} }</pre><h3>Making “it cannot trade” a test, not a promise</h3><p>I’m a test automation engineer, so “trust me, the trading code is gone” wasn’t good enough. The repository has a test suite that <strong>reads the source code of every first-party file</strong> (using Python’s ast module) and fails the build if any of these come back:</p><ul><li>an authenticated exchange call or any order method (create_order, cancel_order...)</li><li>an exchange credential name (BINANCE_API_KEY, apiKey, secret...)</li><li>the old function that let an LLM override a rule-based BUY or SELL</li></ul><pre>FORBIDDEN_CALLS = {&quot;create_order&quot;, &quot;create_market_order&quot;, &quot;cancel_order&quot;, &quot;fetch_balance&quot;, &quot;fetch_my_trades&quot;, &quot;withdraw&quot;, ...} # First-party code only: an allowlist, not a denylist. SOURCE_DIRS = (&quot;analysis&quot;, &quot;connectors&quot;, &quot;core&quot;, &quot;notifications&quot;, &quot;strategies&quot;, &quot;web&quot;) @pytest.mark.parametrize(&quot;path&quot;, list(_source_files()), ids=lambda p: p.name) def test_no_order_placing_calls(path): tree = ast.parse(path.read_text(), filename=str(path)) offenders = { node.func.attr for node in ast.walk(tree) if isinstance(node, ast.Call) and isinstance(node.func, ast.Attribute) and node.func.attr in FORBIDDEN_CALLS } assert not offenders, f&quot;{path.name} calls forbidden exchange method(s): {sorted(offenders)}&quot;</pre><p>On 23 October: <strong>76 tests passed</strong>. I also checked the running container directly, not just the source tree:</p><pre>docker exec crypto-signal-web sh -c &#39;env | grep -ci BINANCE&#39; # 0 docker exec crypto-signal-web python -c &quot;import analysis.ai_analyst as a; print(hasattr(a,&#39;arbitrate_signal&#39;))&quot; # False curl -s -o /dev/null -w &#39;%{http_code}&#39; -X POST localhost:8300/api/signals # 405</pre><p>One detail that matters: the suite walks an <strong>allowlist</strong> of my own folders. A denylist over every .py file in the project would also walk .venv, find the order methods inside the installed ccxt library, and fail on code I didn&#39;t write.</p><h3>Can it predict the market?</h3><p>Short answer: <strong>no, and it isn’t designed to.</strong> What it can honestly do is narrower:</p><ul><li><strong>It describes the current state</strong> of BTC, ETH and ADA in a consistent, rule-based way: trend, momentum, how stretched the price is, and whether its own entry conditions are met.</li><li><strong>It saves you staring at charts.</strong> One /signal message tells you whether anything interesting has happened since the last 4-hour candle.</li><li><strong>It shows how the coins relate.</strong> On 23 October all three had the same gate blocked, which is typical: altcoins like ADA tend to move with Bitcoin. The config even has an optional filter that blocks altcoin BUY signals while Bitcoin is weak.</li></ul><p>What it can’t do:</p><ul><li><strong>It hasn’t been validated.</strong> The backtest in the README covers one coin (ADA) over six months, with the rules tuned on that same data. The best version showed +1.41% over 22 trades, while ADA fell 73%. That’s in-sample, it isn’t evidence of an edge, and the README says so next to the numbers.</li><li><strong>It lags.</strong> Signals come from the last closed 4-hour candle, so a sharp move inside the current candle won’t show until it closes.</li><li><strong>Live values move between calls.</strong> The order-book “buy pressure” is a snapshot. It read 6% on the dashboard and 41% in a scan a minute later. Treat it as noise, not a signal.</li></ul><h3>What I found while writing this</h3><p>Writing about a system makes you look at it more closely than running it does. Two honest findings:</p><ol><li><strong>The daily-trend gate never fires live.</strong> The code that builds the daily averages names the columns SMA_50 and SMA_200, but the signal service looks them up as sma_50 and sma_200. The lookup always misses, so the daily trend shows as &quot;unknown&quot;. The gate therefore never blocks, and trend-following mode never switches on. On 23 October the daily 50-day average (about 81,800) was above the 200-day (about 72,900), so Bitcoin was actually in a golden cross the engine couldn&#39;t see. It made no difference that day, because the 4h gate was blocked anyway, but it&#39;s a real bug, and the dashboard&#39;s green &quot;Daily ✓&quot; badge hides it. The fix is a one-line change plus a test that asserts the daily trend is never &quot;unknown&quot; when 250 days of data are present.</li><li><strong>The LLM analyst isn’t wired in.</strong> The code that asks a language model (Z.AI GLM) for market commentary still exists, but nothing calls it in the live path. /ai reports zero calls. That&#39;s safe, because the model was never allowed to make decisions, but the README&#39;s &quot;LLM analyst layer&quot; overstates what&#39;s running today.</li></ol><p>Both are exactly what a QA review should find: the system worked, its health checks were green, and it was still quietly doing less than it said.</p><h3>Rules I’d keep</h3><ul><li><strong>Delete dangerous capability rather than disabling it,</strong> and keep the history in a git tag.</li><li><strong>Enforce safety claims with tests</strong> that read the code, and check the running container, not just the repository.</li><li><strong>Make every signal explainable:</strong> gates, a score, and a plain-English reason.</li><li><strong>Write the limitations next to the numbers,</strong> especially for anything that looks like a trading result.</li><li><strong>Keep the LLM observational.</strong> A model that can override a rule-based decision is a model you now have to test as a trader.</li></ul><p><em>I’m a test automation engineer working towards AI quality and LLM evaluation. The next step for this project is an evaluation harness for the LLM analyst, scored on schema validity, refusal on bad input and self-consistency rather than on market returns.</em></p><p><em>Originally published at </em><a href="https://mattkari.github.io/articles/crypto-signal-engine/"><em>https://mattkari.github.io</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=47c3b26c9e60" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I built a “second brain” for test automation with Claude Code and Obsidian (and tested it like…]]></title>
            <link>https://dkarimov.medium.com/how-i-built-a-second-brain-for-test-automation-with-claude-code-and-obsidian-and-tested-it-like-e9fd96f22e99?source=rss-cc6215dc2535------2</link>
            <guid isPermaLink="false">https://medium.com/p/e9fd96f22e99</guid>
            <dc:creator><![CDATA[Dusmamat Karimov, PhD]]></dc:creator>
            <pubDate>Thu, 22 Oct 2026 19:41:23 GMT</pubDate>
            <atom:updated>2026-10-22T19:41:23.486Z</atom:updated>
            <content:encoded><![CDATA[<h3>How I built a “second brain” for test automation with Claude Code and Obsidian (and tested it like a QA engineer)</h3><p><a href="https://mattkari.github.io/">Matt Karimov</a> · <a href="https://mattkari.github.io/writing">All writing</a><em>A step-by-step guide to an Andrej Karpathy-style LLM knowledge base: rough notes in, a linked wiki out, answers that cite their sources, and a guard that stops secrets reaching the model.</em></p><p>Matt Karimov · Test automation engineer · October 2026</p><p>Every test automation engineer I know carries a private pile of knowledge around in their head. Which environment falls over at 8am. Why the parallel runner is capped at six threads. The one locator that only works if you wait for the dashboard, not the login page. How to reset test data without raising a ticket.</p><p>Most of it never gets written down properly. When it does, it lands in a chat thread or a scratch file that nobody, including me, can find three months later. AI coding assistants don’t help here on their own: every session starts from zero, and you explain the same context again.</p><p>Andrej Karpathy described a simple alternative: let an LLM maintain a personal wiki for you. You drop rough notes into a folder, and the model “compiles” them into linked, well-structured pages with an index. You then ask questions against that wiki rather than against your memory. No vector database, no embeddings, just markdown and a good index.</p><p>I built this with <strong>Claude Code</strong> as the compiler and <strong>Obsidian</strong> as the viewer, and then did what I do for a living: I tested it. This article gives you every file and command you need to set it up yourself, plus what I learned from testing it.</p><blockquote><strong><em>Before you use this at work:</em></strong><em> check your employer’s policy. Use only an AI tool your organisation has approved for internal material, keep the folder on approved storage, and never put customer data, credentials or production details into it. Everything in this article was built and tested on my own machine with made-up notes.</em></blockquote><h3>The idea in QA terms</h3><p>If you work in test automation, the pattern maps neatly onto things you already know:</p><p>Two rules come straight from that table:</p><ol><li><strong>Raw notes are append-only.</strong> The model never edits them. They’re your source of truth.</li><li><strong>The wiki is disposable.</strong> Anything in wiki/ can be regenerated from raw/, so the model can rewrite it freely, and you never edit it by hand.</li></ol><h3>Two ways to build it, and why I chose the manual one</h3><p>There is a popular open-source kit, <a href="https://github.com/coleam00/claude-memory-compiler">claude-memory-compiler</a> by Cole Medin, that does this automatically. Claude Code hooks capture each session when it ends, a background job extracts the lessons into a daily log, and a nightly step compiles the wiki. I installed it on a personal project and it’s clever.</p><p>When I tested it, though, <strong>every session was being saved as “nothing worth saving”</strong>. Root cause: the background summariser was itself a Claude session, so the kit’s own start-up hook injected old log text into it, including the literal marker FLUSH_OK. The model echoed the marker, and the code checked whether the reply <em>contained</em> FLUSH_OK rather than whether it <em>was</em> FLUSH_OK, so it threw away every real summary. Fixing it took two small changes: skip the start-up hook inside the summariser, and match the marker exactly. That&#39;s a classic QA lesson. The code ran without errors and still did nothing useful. Only checking the actual output caught it.</p><p>For work, I still chose a <strong>manual</strong> design, for three reasons:</p><ul><li><strong>Nothing runs in the background.</strong> Auto-capture sends whole session transcripts to the model provider. At work I want to decide exactly what goes in.</li><li><strong>Every compile is guarded.</strong> A plain script scans the notes for secrets <em>before</em> the model reads them.</li><li><strong>It’s easy to audit.</strong> Four slash commands, three small Python scripts, one rules file. No packages to install.</li></ul><p>The rest of this article builds the manual version, which I call a <strong>Work Brain</strong>.</p><h3>What you need</h3><ul><li><strong>Claude Code</strong>, signed in with an account you’re allowed to use for this material (claude in a terminal, or the IntelliJ or VS Code extension).</li><li><strong>Python 3.8 or newer.</strong> Only the standard library is used. On Windows the command is often py.</li><li><strong>Obsidian</strong> (optional, but it’s what makes the wiki pleasant to read).</li><li><strong>About 30 minutes.</strong></li></ul><p>The finished folder looks like this:</p><pre>work-brain/ ├── CLAUDE.md &lt;- the rules Claude Code follows ├── .claude/ │ ├── settings.json &lt;- permissions: what Claude may and may not touch │ └── commands/ │ ├── compile.md &lt;- /compile │ ├── query.md &lt;- /query │ ├── lint.md &lt;- /lint │ └── ingest.md &lt;- /ingest ├── tools/ │ ├── guard.py &lt;- secret scanner (runs before every compile) │ ├── lint.py &lt;- structural checks + change detection │ └── new_note.py &lt;- safe note writer (never overwrites) ├── raw/ &lt;- your notes └── wiki/ ├── index.md &lt;- the retrieval entry point └── log.md &lt;- append-only build log</pre><p>You can download the whole template from my GitHub repository (link at the end), or create the files yourself from the snippets below.</p><h3>Step 1: Create the folder</h3><pre>mkdir -p work-brain/{.claude/commands,tools,raw,wiki} &amp;&amp; cd work-brain git init</pre><p>Git is optional but useful: it gives you history for raw/ and lets you see exactly what each compile changed in wiki/, the same way you&#39;d review a diff.</p><p>Create the two starting files in wiki/:</p><pre>printf &#39;# Index\n\n| Page | Type | Summary | Updated |\n|---|---|---|---|\n&#39; &gt; wiki/index.md printf &#39;# Build log (append only)\n&#39; &gt; wiki/log.md</pre><h3>Step 2: Write the rules file, CLAUDE.md</h3><p>Claude Code reads CLAUDE.md automatically at the start of every session in that folder. This is where the whole design lives: who owns which folder, what may never be copied, and what a page looks like. Here&#39;s the core of mine (the full file is in the repository):</p><pre># CLAUDE.md: Work Brain (LLM knowledge base, Karpathy pattern) You (Claude Code) are the compiler and librarian of this knowledge base. The human writes rough notes; you turn them into a linked, queryable wiki. ## Ownership rule (non-negotiable) | Path | Only writer | Rule | |---|---|---| | raw/ | human | Never edit, rename or delete. Read only. | | wiki/ | Claude | Rewrite freely. Everything can be regenerated from raw/. | | wiki/index.md | Claude | Updated on every compile. The retrieval entry point. | | wiki/log.md | Claude | Append only. | | CLAUDE.md, tools/, .claude/ | human | Do not modify. | ## Data rules (these override everything) 1. No client or customer data (names, account numbers, sort codes, IBANs, card numbers, addresses, dates of birth). 2. No credentials (passwords, tokens, keys, connection strings, cookies). 3. No production data or production hostnames. Test environments by role only. 4. Colleagues are referred to by role, not name. 5. If a raw note contains any of the above, do not copy it into the wiki. Write the knowledge without the value (e.g. &quot;the SIT DB user is in the team vault&quot;) and report the file and line to the human. 6. Never use web tools in this repo. Knowledge comes from raw/ only. ## Page types (folders under wiki/) | Folder | One page per | |---|---| | systems/ | service, component or environment | | howto/ | repeatable procedure | | decisions/ | decision with its reason (ADR-style) | | defects/ | recurring failure pattern and its fix | | concepts/ | idea, pattern or domain term | | qa/ | answered question filed back by /query | ## Page format Every page has YAML front matter (title, type, tags, sources, created, updated, status: current | needs-check | superseded), then: a 2-4 sentence summary, Key points, Details, Related ([[links]]), Sources. Rules: - Links are Obsidian [[folder/slug]]. Every page links to at least one other page. - Prefer updating an existing page over creating a near-duplicate. - If two sources disagree, keep both claims and mark status: needs-check. Never resolve a contradiction by guessing. - Write only what the sources say. Label your own inferences &quot;(inferred)&quot;.</pre><p>The page types are the QA-specific part. A general-purpose second brain has “concepts” and “people”. A testing one needs <strong>defects</strong> (recurring failure patterns and their fixes), <strong>how-tos</strong> (repeatable procedures like resetting test data) and <strong>decisions</strong> (why the suite is configured the way it is). Those three are where most lost knowledge comes from.</p><h3>Step 3: Lock down permissions, .claude/settings.json</h3><p>This is the part most guides skip. Instructions in CLAUDE.md are requests. Permissions in settings.json are enforced by Claude Code itself. I let Claude write only to wiki/, run only the three helper scripts, and I deny web access and any edits to my notes, the rules or the tools:</p><pre>{ &quot;permissions&quot;: { &quot;allow&quot;: [ &quot;Read(./**)&quot;, &quot;Edit(./wiki/**)&quot;, &quot;Bash(python3 tools/guard.py:*)&quot;, &quot;Bash(python3 tools/lint.py:*)&quot;, &quot;Bash(python3 tools/new_note.py:*)&quot;, &quot;Bash(python tools/guard.py:*)&quot;, &quot;Bash(python tools/lint.py:*)&quot;, &quot;Bash(python tools/new_note.py:*)&quot;, &quot;Bash(py tools/guard.py:*)&quot;, &quot;Bash(py tools/lint.py:*)&quot;, &quot;Bash(py tools/new_note.py:*)&quot; ], &quot;deny&quot;: [ &quot;WebFetch&quot;, &quot;WebSearch&quot;, &quot;Edit(./raw/**)&quot;, &quot;Edit(./CLAUDE.md)&quot;, &quot;Edit(./tools/**)&quot;, &quot;Edit(./.claude/**)&quot; ] } }</pre><p>The three spellings of Python ( python3, python, py) cover Linux, macOS and Windows. One detail I learned the hard way: in Claude Code, Edit(path) rules cover every file-writing tool, so don&#39;t add a separate Write(path) rule. Claude Code warns that it isn&#39;t matched.</p><h3>Step 4: The guard, tools/guard.py</h3><p>Before the model reads a single note, a plain script scans raw/ for things that must never leave your machine. A regex gives the same answer every time; a model &quot;being careful&quot; might not. It exits with code 1 if it finds anything, and /compile refuses to continue. It never prints the full value, only the first three characters.</p><pre>#!/usr/bin/env python3 &quot;&quot;&quot;Sensitive-data guard. Stdlib only, Python 3.8+. Exit 0 = clean, 1 = findings (compile must stop).&quot;&quot;&quot; import re import sys from pathlib import Path ROOT = Path(__file__).resolve().parent.parent PATTERNS = [ (&quot;private key&quot;, re.compile(r&quot;-----BEGIN [A-Z ]*PRIVATE KEY-----&quot;)), (&quot;AWS access key&quot;, re.compile(r&quot;\b(AKIA|ASIA)[0-9A-Z]{16}\b&quot;)), (&quot;JWT / bearer token&quot;, re.compile(r&quot;\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{5,}&quot;)), (&quot;GitLab/GitHub token&quot;, re.compile(r&quot;\b(glpat-[A-Za-z0-9_-]{20,}|gh[pousr]_[A-Za-z0-9]{30,})\b&quot;)), (&quot;password/secret assignment&quot;, re.compile(r&quot;(?i)\b(password|passwd|pwd|secret|api[_-]?key|token|client[_-]?secret)\b\s*[:=]\s*\S{4,}&quot;)), (&quot;connection string with credentials&quot;, re.compile(r&quot;(?i)\b[a-z][a-z0-9+.-]*://[^\s:/@]+:[^\s@]+@&quot;)), (&quot;IBAN&quot;, re.compile(r&quot;\b[A-Z]{2}\d{2}(?: ?[A-Z0-9]{4}){3,7}(?: ?[A-Z0-9]{1,4})?\b&quot;)), (&quot;sort code&quot;, re.compile(r&quot;\b\d{2}-\d{2}-\d{2}\b&quot;)), (&quot;email address&quot;, re.compile(r&quot;\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b&quot;)), (&quot;UK National Insurance number&quot;, re.compile(r&quot;\b[A-CEGHJ-PR-TW-Z]{2}\s?\d{2}\s?\d{2}\s?\d{2}\s?[A-D]\b&quot;)), ] CARD = re.compile(r&quot;\b(?:\d[ -]?){13,19}\b&quot;) def luhn_ok(digits: str) -&gt; bool: &quot;&quot;&quot;Only flag card-like numbers that pass the Luhn check (fewer false positives).&quot;&quot;&quot; total, alt = 0, False for ch in reversed(digits): d = int(ch) if alt: d *= 2 if d &gt; 9: d -= 9 total += d alt = not alt return total % 10 == 0 def load_allow(): &quot;&quot;&quot;Known false positives: one regex per line in tools/guard-allow.txt.&quot;&quot;&quot; f = ROOT / &quot;tools&quot; / &quot;guard-allow.txt&quot; if not f.exists(): return [] return [re.compile(x.strip()) for x in f.read_text(encoding=&quot;utf-8&quot;).splitlines() if x.strip() and not x.startswith(&quot;#&quot;)] def mask(s: str) -&gt; str: s = s.strip() return s[:3] + &quot;...&quot; if len(s) &gt; 3 else &quot;...&quot; def scan(folder: Path): allow = load_allow() findings = [] for path in sorted(folder.rglob(&quot;*.md&quot;)): for n, line in enumerate(path.read_text(encoding=&quot;utf-8&quot;, errors=&quot;replace&quot;).splitlines(), 1): if any(a.search(line) for a in allow): continue for label, rx in PATTERNS: for m in rx.finditer(line): findings.append((path, n, label, mask(m.group(0)))) for m in CARD.finditer(line): digits = re.sub(r&quot;\D&quot;, &quot;&quot;, m.group(0)) if 13 &lt;= len(digits) &lt;= 19 and luhn_ok(digits): findings.append((path, n, &quot;card number (Luhn valid)&quot;, mask(digits))) return findings def main(): target = &quot;wiki&quot; if &quot;--wiki&quot; in sys.argv else &quot;raw&quot; folder = ROOT / target if not folder.exists(): print(f&quot;guard: {target}/ not found&quot;) return 0 findings = scan(folder) if not findings: print(f&quot;guard: {target}/ clean&quot;) return 0 print(f&quot;guard: {len(findings)} finding(s) in {target}/. Remove these before compiling:&quot;) for path, n, label, shown in findings: print(f&quot; {path.relative_to(ROOT)}:{n} {label} ({shown})&quot;) return 1 if __name__ == &quot;__main__&quot;: sys.exit(main())</pre><p>Add patterns for your own organisation’s identifiers, such as internal ticket formats or hostname conventions you don’t want in prompts. Be honest about its limits, though: a regex can’t recognise a client’s name or a production hostname that looks like any other word. The guard is a safety net, not permission to be careless.</p><h3>Step 5: Change detection, tools/lint.py</h3><p>This script does two jobs where you want exact bookkeeping rather than the model’s judgement.</p><p><strong>Job 1: which notes need compiling?</strong> Each time Claude compiles a note, it writes the note’s fingerprint (a short SHA-256 hash) into wiki/log.md. Next time, the script compares fingerprints. A note it has never seen is new. A note whose content has changed, such as an Obsidian daily note you added to in the afternoon, is changed. Anything else is skipped. This is what makes /compile safe to run as often as you like.</p><pre>SOURCE = re.compile(r&quot;^- Source:\s*(raw/\S+?)(?:\s*\(sha ([0-9a-f]{6,})\))?\s*$&quot;, re.M) def sha(path: Path) -&gt; str: return hashlib.sha256(path.read_bytes()).hexdigest()[:12] def compiled_sources() -&gt; dict: &quot;&quot;&quot;raw path -&gt; set of hashes already compiled, read from wiki/log.md.&quot;&quot;&quot; log = WIKI / &quot;log.md&quot; out = {} if log.exists(): for path, h in SOURCE.findall(log.read_text(encoding=&quot;utf-8&quot;)): out.setdefault(path, set()).add(h or &quot;&quot;) return out def uncompiled(): &quot;&quot;&quot;List of (raw path, current sha, &#39;new&#39; | &#39;changed&#39;). Empty notes are skipped.&quot;&quot;&quot; done = compiled_sources() raws = sorted(p for p in RAW.rglob(&quot;*.md&quot;) if p.name.lower() != &quot;readme.md&quot;) if RAW.exists() else [] todo = [] for p in raws: if not p.read_text(encoding=&quot;utf-8&quot;, errors=&quot;replace&quot;).strip(): continue rel, h = p.relative_to(ROOT).as_posix(), sha(p) seen = done.get(rel) if seen is None: todo.append((rel, h, &quot;new&quot;)) elif h not in seen and &quot;&quot; not in seen: todo.append((rel, h, &quot;changed&quot;)) return todo</pre><p><strong>Job 2: is the wiki healthy?</strong> Running it with no arguments checks for broken [[links]], orphan pages (nothing links to them), pages missing from the index, missing front matter, and very thin pages. It exits with code 1 on errors, so you could run it in CI if the wiki lives in a shared repository. The full script (about 140 lines) is in the repository.</p><pre>python3 tools/lint.py --uncompiled # what needs compiling python3 tools/lint.py # full health report</pre><h3>Step 6: The safe note writer, tools/new_note.py</h3><p>When you’d rather paste a note into Claude Code than open Obsidian, /ingest uses this script. It opens the file in exclusive-create mode (&quot;x&quot;), so it physically cannot overwrite an existing note:</p><pre>#!/usr/bin/env python3 &quot;&quot;&quot;Create a NEW raw note from stdin. Refuses to overwrite: raw/ is append-only.&quot;&quot;&quot; import re import sys from datetime import date from pathlib import Path RAW = Path(__file__).resolve().parent.parent / &quot;raw&quot; def main(): if len(sys.argv) &lt; 2: print(&quot;usage: new_note.py &lt;topic&gt; (text on stdin)&quot;) return 2 topic = &quot; &quot;.join(sys.argv[1:]).strip() body = sys.stdin.read().strip() if not body: print(&quot;new_note: empty text, nothing saved&quot;) return 2 slug = re.sub(r&quot;[^a-z0-9]+&quot;, &quot;-&quot;, topic.lower()).strip(&quot;-&quot;)[:50] or &quot;note&quot; RAW.mkdir(exist_ok=True) base = f&quot;{date.today().isoformat()}-{slug}&quot; path, n = RAW / f&quot;{base}.md&quot;, 2 while path.exists(): path, n = RAW / f&quot;{base}-{n}.md&quot;, n + 1 with open(path, &quot;x&quot;, encoding=&quot;utf-8&quot;) as f: # &quot;x&quot; = fail if it exists f.write(f&quot;# {topic}\n\n{body}\n&quot;) print(f&quot;saved {path.relative_to(RAW.parent).as_posix()}&quot;) return 0 if __name__ == &quot;__main__&quot;: sys.exit(main())</pre><h3>Step 7: The four slash commands</h3><p>Any markdown file in .claude/commands/ becomes a slash command in Claude Code. The front matter limits which tools that command may use, and $ARGUMENTS is whatever you type after the command.</p><p><strong>.claude/commands/compile.md</strong>, the build:</p><pre>--- description: Compile uncompiled raw notes into wiki pages (guard runs first) allowed-tools: Read, Write, Edit, Glob, Grep, Bash(python tools/guard.py:*), Bash(python3 tools/guard.py:*), Bash(python tools/lint.py:*), Bash(python3 tools/lint.py:*) --- Follow CLAUDE.md exactly. 1. Run `python3 tools/guard.py` (use `python` if `python3` is not found). - If it exits non-zero, **stop**. Show the findings and tell the human to remove those values from the raw notes. Do not compile anything. 2. Run `python3 tools/lint.py --uncompiled`. Each line is `raw/&lt;file&gt; (sha &lt;hash&gt;) new|changed`. If it prints &quot;Nothing to compile&quot;, say so and stop. - `new`: compile the whole note. - `changed`: the note was compiled before and has had text added (e.g. an Obsidian daily note). Read it in full, then fold only the new material into the pages. 3. Read `wiki/index.md`, then the existing pages it points to that look relevant. 4. For each uncompiled raw file, oldest first: - Extract systems, how-tos, decisions, defects and concepts. - Update existing pages where they cover the topic; create new pages only for new topics. - Apply the data rules: never carry a sensitive value into the wiki. - Mark disagreements between sources `status: needs-check`. 5. Update `wiki/index.md` (one row per page, sorted by type then page). 6. Append one entry per raw file to `wiki/log.md` with `- Source:`, `- Created:`, `- Updated:` and `- Withheld:` lines. The Source line must copy the hash exactly as listed in step 2: `- Source: raw/&lt;file&gt; (sha &lt;hash&gt;)`. Without it the note is offered for compile again. 7. Run `python3 tools/lint.py` and fix any broken links you introduced. 8. Report: files compiled, pages created, pages updated, anything withheld, anything marked needs-check. Keep it short. $ARGUMENTS</pre><p><strong>.claude/commands/query.md</strong>, grounded answers:</p><pre>--- description: Answer a question from the wiki, cited to pages allowed-tools: Read, Glob, Grep, Write, Edit --- Question: $ARGUMENTS Follow CLAUDE.md. 1. Read `wiki/index.md` first. Pick the 3-10 pages most likely to answer the question. 2. Read those pages in full. Use `raw/` only if the wiki is silent, and say so. 3. Answer in plain language. After each claim, cite the page as `[[folder/slug]]`. 4. If the wiki does not contain the answer, say **&quot;The wiki does not cover this&quot;** and name the closest pages. Do not answer from general knowledge without labelling it `(not from wiki)`. 5. If any cited page has `status: needs-check`, say so. 6. End by asking: &quot;File this answer to wiki/qa/? (yes/no)&quot;. If the human says yes, write the `qa/` page, add it to `wiki/index.md`, and append a `query` entry to `wiki/log.md`.</pre><p>Step 4 is the line I care about most as a tester. An assistant that says “I don’t know” when it doesn’t know is worth far more than one that answers everything confidently.</p><p><strong>.claude/commands/lint.md</strong>, the test suite:</p><pre>--- description: Health-check the wiki (structure + contradictions) allowed-tools: Read, Glob, Grep, Edit, Bash(python tools/lint.py:*), Bash(python3 tools/lint.py:*), Bash(python tools/guard.py:*), Bash(python3 tools/guard.py:*) --- 1. Run `python3 tools/guard.py --wiki` (or `python`) and report any sensitive values found in `wiki/`. 2. Run `python3 tools/lint.py` and show its report. 3. Read the pages and look for **contradictions** between them (different values, steps or decisions for the same thing). For each one, list both pages and the conflicting claims. Do not fix contradictions; mark both pages `status: needs-check`. 4. List pages whose `updated` date is more than 90 days old as &quot;possibly stale&quot;. 5. Offer fixes for broken links and orphan pages. Apply them only if the human says yes. $ARGUMENTS</pre><p>The script handles what can be checked mechanically. The model handles what needs reading comprehension, such as two pages giving different thread limits for the same suite.</p><p><strong>.claude/commands/ingest.md</strong>, quick capture:</p><pre>--- description: Save a new raw note (new file only, never edits) allowed-tools: Bash(python tools/new_note.py:*), Bash(python3 tools/new_note.py:*), Bash(python tools/guard.py:*), Bash(python3 tools/guard.py:*) --- Save the text below as a new raw note. Do not use Write or Edit on `raw/`; use the script, which refuses to overwrite: python3 tools/new_note.py &quot;&lt;short topic&gt;&quot; &lt;&lt;&#39;EOF&#39; &lt;the text, verbatim&gt; EOF (Use `python` if `python3` is not found.) Then run `python3 tools/guard.py` and report any findings. Do not compile. Reply with the saved file name in one line. Text: $ARGUMENTS</pre><h3>Step 8: Connect Obsidian</h3><ol><li>In Obsidian, use <strong>Open folder as vault</strong> and choose work-brain, or put work-brain inside your existing vault as one folder.</li><li>Go to <strong>Settings → Core plugins → Daily notes</strong> and set <strong>New file location</strong> to work-brain/raw and <strong>Date format</strong> to YYYY-MM-DD.</li><li>In <strong>Settings → Files and links</strong>, turn on <strong>Use [[Wikilinks]]</strong>.</li></ol><p>Now your daily note <em>is</em> a raw note. Write rough bullets during the day and they’re picked up at the next compile, including anything you add after the last one, thanks to the fingerprints from step 5.</p><p>If your vault syncs through OneDrive or a similar service, mark the folder <strong>Always keep on this device</strong> so the scripts read real files rather than cloud placeholders. Remember that synced storage keeps old versions, so a secret you delete later still exists in the file history. That’s another reason the guard runs <em>before</em> anything is written.</p><h3>Step 9: First run</h3><p>Start Claude Code in the folder:</p><pre>cd work-brain python3 tools/lint.py # expect: Pages: 0 Errors: 0 python3 tools/guard.py # expect: guard: raw/ clean claude</pre><p>Inside Claude Code, type / and check that compile, query, lint and ingest appear. Then add a note. Here&#39;s one of the made-up notes I tested with:</p><pre># karate parallel runs Karate suite was slow (40 min). Switched runner to Runner.path(&quot;classpath:features&quot;).parallel(6). Now 9 min on GitLab runner. Gotcha: features that share the same test customer collide in parallel. Tag them @serial and run them in a separate job. Decision: max 6 threads, because the SIT payments stub rate-limits above ~8 concurrent calls.</pre><p>Then run:</p><p>From three short notes like this one, Claude produced five linked pages: a how-to ( <em>Run Karate in parallel</em>), a decision ( <em>Karate max six threads</em>), a defect ( <em>Flaky Playwright login</em>), another how-to ( <em>Reset SIT test data</em>) and a system page ( <em>SIT environment</em>) that combined facts from all three notes. It also filled in wiki/index.md:</p><pre>| Page | Type | Summary | Updated | |---|---|---|---| | [[decisions/karate-max-six-threads]] | decision | Karate runs capped at 6 threads because the SIT payments stub rate-limits above ~8 concurrent calls | 2026-10-21 | | [[defects/flaky-playwright-login]] | defect | Login test flaked 1 in 10 on CI because of a late SSO redirect; fixed by waiting for the dashboard locator | 2026-10-21 | | [[howto/run-karate-in-parallel]] | howto | Parallel Karate runner (6 threads, 40 to 9 min); tag shared-customer features @serial in a separate job | 2026-10-21 | | [[systems/sit-environment]] | system | Shared SIT test environment: 08:00 batch job, payments stub limit, DB access via the team vault | 2026-10-21 |</pre><p>That index is the whole retrieval system. When you run /query, Claude reads these one-line summaries first, opens only the relevant pages, and answers from those. Karpathy&#39;s point is that at personal scale, a few hundred pages, an LLM reading a well-kept index works better than a vector database, and there&#39;s nothing to keep in sync. Beyond that size you&#39;d add search.</p><p>Now ask it something:</p><pre>/query Why is the Karate suite limited to 6 threads, and what do I do with features that share a test customer?</pre><h3>Daily routine</h3><h3>Testing it like a QA engineer</h3><p>I don’t trust a tool because its output looks plausible. Before using this for anything real, I wrote down what <em>should</em> happen and checked each case. These are the tests I ran, all with made-up notes.</p><p><strong>1. Negative test: does the guard block a secret?</strong> I put a fake password line in one note and ran/compile. The guard reported the file, line number and the type of finding ( password/secret assignment), showing only the first three characters. Claude stopped, told me what to fix, and <strong>wrote nothing to </strong><strong>wiki/</strong>. Pass.</p><p><strong>2. Does the knowledge survive without the secret?</strong> I replaced the line with “credentials are in the team vault (SIT entry)” and compiled again. The SIT environment page kept the useful fact (“SIT DB credentials are in the team vault, under the SIT entry. Ask the env team for a read-only DB role.”) without any value. Afterwards I searched the whole folder for the fake password: zero hits. Pass.</p><p><strong>3. Idempotence: does a second compile duplicate anything?</strong> Running/compile again with no new notes returned &quot;Nothing to compile&quot;. Pass.</p><p><strong>4. Change detection: is a growing daily note picked up?</strong> I added a line to a note that had already been compiled. lint.py --uncompiled listed it once as changed, Claude folded in only the new material, and the next check listed nothing. Pass.</p><p><strong>5. Contradictions: does it guess?</strong> The added line said a flaky test had come back, contradicting an earlier “no more flakes in 50 runs”. Claude kept both statements, explained the conflict, and marked the page status: needs-check instead of picking a winner. Pass.</p><p><strong>6. Grounding: does it refuse when the wiki is silent?</strong> I asked how to reset Kafka consumer group offsets in UAT, which none of my notes mention. The answer began “The wiki does not cover this” and named the closest pages. Pass.</p><p><strong>7. Structure: is the build clean?</strong>lint.py reported 0 errors after the compile, and guard.py --wiki reported the wiki clean.</p><p>These are manual checks on a tiny sample, not a benchmark. They tell me the controls work as designed, not that the model will summarise every note perfectly. That’s why the wiki cites its sources, so you can always check a page against the note it came from.</p><h3>Rules I’d keep</h3><ul><li><strong>Ask first.</strong> Check your organisation’s AI and data policy before you put any work notes into an AI tool, and use only the tools and accounts it approves.</li><li><strong>Never write a secret in a note in the first place.</strong> The guard is a net, not a licence.</li><li><strong>Enforce, don’t just ask.</strong> Put the important rules in settings.json permissions, not only in CLAUDE.md.</li><li><strong>Keep raw notes append-only.</strong> They’re your source of truth; the wiki is a build artefact.</li><li><strong>Never let the model settle a contradiction.</strong> Mark it and let a human decide.</li><li><strong>Prefer “I don’t know” to a confident guess.</strong> Make refusal an explicit step in /query.</li><li><strong>Test the controls yourself.</strong> Plant a fake secret and confirm the compile stops before you trust it with real notes.</li></ul><h3>Limits</h3><ul><li>The guard catches patterns (keys, tokens, card numbers, IBANs, sort codes, emails, NI numbers). It can’t recognise client names, internal project names or production hostnames.</li><li>Compile quality depends on the notes. Vague notes produce vague pages, and the model can still misread one, so check pages against their sources.</li><li>Index-based retrieval suits hundreds of pages, not tens of thousands.</li><li>Every compile and query uses your Claude Code plan or API budget.</li></ul><h3>Why this matters for QA</h3><p>Most of what makes a test automation engineer effective in a team is context, not code: why things are configured the way they are, which failures are known, and how to get unstuck. A second brain doesn’t replace a team wiki, but it gives you a private place where that context accumulates instead of evaporating.</p><p>Building it was also good practice for the job I want next, testing AI systems. The same questions apply to any LLM feature: does it refuse when it should, does it stay grounded in its sources, does it leak what it shouldn’t, and do its controls hold when you deliberately try to break them?</p><h3>Credits and links</h3><ul><li><strong>Andrej Karpathy</strong> for the LLM knowledge-base idea: raw sources compiled by an LLM into a markdown wiki with an index, queried and linted by the same model.</li><li><strong>Cole Medin</strong> for <a href="https://github.com/coleam00/claude-memory-compiler">claude-memory-compiler</a> and his video <em>I Built Self-Evolving Claude Code Memory w/ Karpathy’s LLM Knowledge Bases</em>, which got me started.</li><li><strong>The Work Brain template</strong> from this article, with all files and the made-up example notes: <a href="https://github.com/mattkari/source-grounded-rag/tree/main/work-brain">github.com/mattkari/source-grounded-rag/tree/main/work-brain</a></li></ul><p><em>I’m a test automation engineer working towards AI quality and LLM evaluation. If you build your own version or find a hole in mine, I’d like to hear about it.</em></p><p><em>Originally published at </em><a href="https://mattkari.github.io/articles/claude-code-second-brain/"><em>https://mattkari.github.io</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e9fd96f22e99" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I let an AI agent file my dental insurance claim (without giving it my password)]]></title>
            <link>https://dkarimov.medium.com/how-i-let-an-ai-agent-file-my-dental-insurance-claim-without-giving-it-my-password-69e34eb09e18?source=rss-cc6215dc2535------2</link>
            <guid isPermaLink="false">https://medium.com/p/69e34eb09e18</guid>
            <dc:creator><![CDATA[Dusmamat Karimov, PhD]]></dc:creator>
            <pubDate>Thu, 22 Oct 2026 00:00:51 GMT</pubDate>
            <atom:updated>2026-10-22T19:53:53.368Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://mattkari.github.io/">Matt Karimov</a> · <a href="https://mattkari.github.io/writing">All writing</a></p><p><strong>Disclaimer: this article is for educational purposes only.</strong> It describes a personal experiment with AI agents and browser automation. It isn’t financial, legal or insurance advice, and it isn’t endorsed by any insurer. Always check your own policy terms and your insurer’s rules on automated access, and make sure everything you submit is accurate. You are responsible for any claim made in your name.</p><p>A recent root canal left me with a dental insurance claim to make. A workplace dental plan covers part of the cost, but only if someone sits down with the insurer’s claim portal, splits the dentist’s statement into the right benefit categories, uploads the evidence and gets it all in before the deadline. I wasn’t looking forward to that job.</p><p>So I handed it to the AI agent I run at home. It did most of the work, and it left me a saved draft where all I had to do was enter my bank details and press Submit. This guide covers how I set that up, what went wrong along the way, and the rules I’d keep next time. I’ve left out the insurer’s name and any personal details. Most claim portals work in a similar way, so the steps should carry over.</p><h3>What you need</h3><ul><li><strong>An agent that can drive a real browser.</strong> I use a self-hosted agent on a Raspberry Pi with a browser automation tool. Any agent that can open pages, read the DOM, fill fields and upload files will do.</li><li><strong>A password vault the agent can use but can’t read.</strong> This is the important part, and step 2 covers it.</li><li><strong>The paperwork:</strong> your policy terms (the PDF with the “what is covered / not covered” tables), the itemised statement from the dentist, and any supporting letter.</li><li><strong>About 30 minutes of your attention</strong>, mostly at the start and at the end.</li></ul><h3>Step 1: Let the agent read the policy before it touches the portal</h3><p>Give the agent the policy terms and the dentist’s statement first, and ask for a written plan before it does anything: which statement line goes under which benefit, at what percentage, against how much of each annual limit you have left, and what refund to expect.</p><p>For us, the plan put the first appointment under the <em>emergency</em> benefit (paid at 100%, because it was for pain and hadn’t been booked in advance) and the rest of the root canal under <em>routine and restorative</em> (paid at 80%, up to what was left of the annual limit). Having the expected refund written down at the start gave me something to check the insurer’s eventual payout against.</p><p>The emergency benefit needed proof that the visit really was an emergency, and the dentist’s statement didn’t say so. I asked the agent to draft a short, polite email to the practice requesting written confirmation, which I sent myself. The dentist replied the same evening. <strong>Sort out missing evidence before you start the claim, not halfway through it.</strong></p><h3>Step 2: Put the login in a vault, never in the chat</h3><p>This is the rule I care about most. <strong>Never type your password into the conversation with your agent.</strong> Chat history gets logged, summarised, sent to model providers and kept for a long time.</p><p>My agent has a local encrypted vault. I add a login on the Pi’s terminal, and the password goes into a hidden prompt:</p><pre>hermes vault add --kind login Label: Insurer Site origin: https://www.example-insurer.co.uk Identifier type (email/phone/username) [email]: &lt;- just press Enter Identifier: me@example.com Password: ********</pre><p>The agent only ever sees a handle such as vault_a1b2... and the username. When it reaches the login page, it types the username itself and asks the vault to fill the password field. The vault checks the page&#39;s origin first and won&#39;t fill the password on any other site. The password never shows up in the model&#39;s context.</p><p>Two things caught me out:</p><ul><li><strong>“Identifier type” means the kind of identifier, not the value.</strong> I typed my email address there four times before I worked that out. The prompt wants email, or just Enter.</li><li><strong>Use the bare origin, not the full login URL.</strong> https://www.example-insurer.co.uk, not .../employees/default.aspx. The vault matches on the origin.</li></ul><h3>Step 3: Expect the login to fight back a bit</h3><p>The first time the agent asked the vault to fill the password, it came back with “no fillable login field matched”. The portal had marked its login boxes as autocomplete=&quot;new-password&quot;, which made them look like a sign-up form. The agent changed the attributes on the page to username and current-password, and the fill then worked. All this changes is the label the browser uses to classify the field. It doesn&#39;t get around any security, and the server sees an ordinary login.</p><p>The next attempt failed with “we cannot match the details you have entered”. I’d changed my password on the website but hadn’t updated the vault. <strong>Rule: two failed logins and the agent stops.</strong> A third could lock the account. It told me what it thought was wrong and waited. I logged in by hand on my phone to confirm the new password, saved it in the vault again, and the next attempt worked first time.</p><h3>Step 4: Enter one statement line per claim line, using the statement’s own wording</h3><p>The portal wanted every treatment as a separate line: name, type (routine, injury or emergency), NHS or private, date, amount. The agent typed in each line from the dentist’s statement. Some points I’d recommend:</p><ul><li><strong>Use the statement’s exact names</strong> (“Endodontic exploratory appointment fee”, not “root canal assessment”). The person assessing the claim compares your lines with the receipt, and identical wording makes that quick.</li><li><strong>Show discounts in the line itself.</strong> Our root canal was £687 with a £340 discount, so the line says “£687.00 less £340.00 discount” and claims £347. That’s what we actually paid.</li><li><strong>Leave out £0 lines.</strong> The statement had an X-ray marked “plan patient” with no charge. I asked whether adding it would get us more money. It wouldn’t: insurers refund what you paid, and claiming for something free is a false claim.</li><li><strong>Re-read the list after every edit.</strong> At one point the portal quietly changed a line’s type from Routine to Emergency while the agent was renaming it. The agent spotted it because it read the saved table back after every change, and it fixed it.</li><li><strong>Watch out for characters the portal strips.</strong> Ours silently removed opening brackets, so “X-ray (intraoral)” was saved as “X-ray intraoral)”. Hyphens worked fine.</li></ul><p>Before you move on, check that the claim total exactly matches what you paid on the statement.</p><h3>Step 5: Don’t stretch the categories</h3><p>Partway through, I asked the agent whether the second appointment could also go in as an emergency, since emergencies pay 100%. It said no, and quoted the policy back to me: the emergency benefit covers “treatment carried out at an emergency appointment which was not pre-planned” and excludes “any treatment carried out at a follow up appointment.”</p><p>It also did the sums. Our restorative allowance was already used up by the main treatment, and the emergency benefit has its own cap, so moving the line would have gained us about £120 at most, and that was the sort of change that gets a whole claim queried. I was glad it said no. <strong>An agent that only does what you ask isn’t enough. You want one that checks your request against the policy wording and pushes back.</strong></p><h3>Step 6: Uploading evidence: check the formats and save often</h3><p>This step took the longest:</p><ul><li>The original PDF was rejected as “potentially malicious content”. Scanned PDFs often trip these filters. We used an image of the statement instead.</li><li>Then the portal looked as if it had accepted PNG files, but the Next button did nothing, with no error message. Further down, the page listed the accepted formats: JPEG, TIFF, BMP, PDF and Word. <strong>No PNG.</strong> The agent converted the files to JPG and the step went through.</li><li>The evidence was in an email, so the agent made a clean one-page image of the dentist’s reply, including the sender, date and subject. Assessors want to see who said what, and when.</li><li>The agent’s browser crashed once and we lost the unsaved draft. After that, it used the portal’s <strong>“Save claim &amp; return later”</strong> button after each major step. Most portals have one.</li></ul><h3>Step 7: The human submits</h3><p>When it got to the bank details page, the agent stopped. That was what we’d agreed at the start, for two reasons:</p><ol><li><strong>Bank details stay with me.</strong> I don’t type my sort code and account number into the chat, for the same reason as the password.</li><li><strong>Submitting means signing a declaration that the claim is true.</strong> I’m the one making that declaration, so I should be the one pressing the button.</li></ol><p>The agent saved the draft and sent me a summary: every line, the total, the two attached files, and what each portal page should show when I open it. I logged in, checked the four lines against the statement, added my bank details and pressed Submit. That took about two minutes.</p><h3>The rules I’d keep</h3><ol><li>The agent reads the policy and writes a plan with an expected refund before opening the portal.</li><li>Passwords go in a vault, never in the chat. Bank details are entered by you.</li><li>Two failed logins means stop and ask.</li><li>Claim lines use the statement’s exact wording, one per charged item. No £0 lines, nothing invented.</li><li>The agent checks your requests against the policy wording and refuses anything that would make the claim untrue.</li><li>Save the draft after every major step.</li><li>The agent stops before Submit. You check and sign.</li></ol><p>Total time from me: about 30 minutes over an evening, most of it spent saving the login and answering the agent’s questions. The admin I’d normally put off until the deadline was finished in one sitting.</p><p><em>Educational purposes only: this is an account of one experiment, not advice. Check your own policy and your insurer’s terms before trying anything similar.I’m a test automation engineer working on how to check AI systems properly, so I treated this partly as a test of where an agent needs hard limits. The answers were the password, the bank details, the declaration, and the honesty of the claim itself.</em></p><p><em>Originally published at </em><a href="https://mattkari.github.io/articles/ai-agent-dental-insurance-claim/"><em>https://mattkari.github.io</em></a><em> on October 22, 2026.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=69e34eb09e18" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Two Gates and a Rule: Building a Review-Only RAG Pipeline That Drafts API and UI Tests]]></title>
            <link>https://dkarimov.medium.com/two-gates-and-a-rule-building-a-review-only-rag-pipeline-that-drafts-api-and-ui-tests-812ba9fc5285?source=rss-cc6215dc2535------2</link>
            <guid isPermaLink="false">https://medium.com/p/812ba9fc5285</guid>
            <dc:creator><![CDATA[Dusmamat Karimov, PhD]]></dc:creator>
            <pubDate>Tue, 13 Oct 2026 00:00:31 GMT</pubDate>
            <atom:updated>2026-10-30T17:09:49.760Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://mattkari.github.io/">Matt Karimov</a> · <a href="https://mattkari.github.io/writing">All writing</a><em>All system, service, endpoint, ticket and field names in this article, its screenshots and its diagram are illustrative placeholders. The screenshots are mock-ups that reproduce the layout of the tool, not captures of it.</em></p><h3>Why I built it</h3><p>Writing test cases for an API is rarely difficult. Finding everything a good test case depends on is the hard part. The requirement sits in one story, the acceptance criteria in another, the design in a wiki page, the contract in an OpenAPI file, the routing rules in a gateway repository, and the existing tests in a third repository. A language model can draft test cases in seconds, but only from what it is given. If the evidence is incomplete, the draft is confident and wrong.</p><p>This article describes the pipeline I built to deal with that problem: a retrieval-augmented (RAG) test assistant that gathers the evidence first, shows it to a person twice, and only then asks a model to draft candidate tests. Today I moved its flow onto LangGraph, and the first real end-to-end run completed. The article explains the design, the rules behind it, and what I found while building it.</p><p>It should be noted at the outset that this is not a tool that writes tests for you. Rather, it is a tool that prepares evidence and drafts candidates for an engineer to review. Nothing it produces is published anywhere.</p><h3>The design in one sentence</h3><p><strong>Gather evidence deterministically, let a human approve it twice, block generation when anything is missing, and keep everything the model saw.</strong></p><p>In other words, the model is the smallest part of the system. It is called once, at step 9 of 11. The other ten steps exist to decide whether it should be called at all.</p><h3>The sources: local, read-only, pinned</h3><p>The pipeline reads from four places (Figure 1, top row):</p><ol><li><strong>The issue tracker and the wiki</strong>, through an <strong>Atlassian MCP server</strong>.</li><li><strong>Source repositories</strong>, through a <strong>GitLab MCP server</strong>: the gateway, the service under test (here, “Service A”) and the existing automated tests.</li><li><strong>The OpenAPI contract</strong> for the target operation.</li><li><strong>A hosted language model</strong>, through an approved enterprise endpoint.</li></ol><p>Both MCP servers run <strong>locally in Docker containers</strong>. MCP (Model Context Protocol) is a standard way for an AI application to call tools; here the tools are “get this story”, “get this page” and “read this file”. Running the servers locally means the pipeline talks to containers on my own machine rather than to a third-party integration, and I control exactly which tools are exposed. Both are used <strong>read-only</strong>.</p><p>Three rules govern the sources:</p><ul><li><strong>Explicit wiki pages only.</strong> The pipeline retrieves the page IDs it is given. It does not search the whole wiki and guess.</li><li><strong>Committed content only.</strong> Every file is read from committed content at a named reference (for example HEAD), never from uncommitted local changes. The limit is stated honestly: freshness is <em>unverified</em>, because the pipeline does not fetch, so the local reference may be behind the remote.</li><li><strong>An anchor match is a relevance signal, not proof of sufficiency.</strong> Finding the endpoint path in a wiki page tells you the page is relevant. It does not tell you the page contains enough to test it.</li></ul><h3>The flow: eleven steps, two gates</h3><p>LangGraph lets me express the pipeline as a fixed graph of steps instead of a free-roaming agent. The order is deterministic: the same request walks the same path every time.</p><ol><li><strong>Load</strong> the request and validate it against a schema.</li><li><strong>Preflight</strong>: check inputs and configuration, and show a summary (target, repositories, limits).</li><li><strong>Gate 1</strong>: a person approves the scope, or the run stops.</li><li><strong>Check</strong> that the live MCP clients respond. (In “fakes” mode, used for offline tests, this step is skipped and no model is called.)</li><li><strong>Acquire evidence</strong>: stories, wiki pages, the contract with every $ref resolved, the gateway&#39;s routing and validation, the controller and its call chain, and the existing tests.</li><li><strong>Build the evidence pack</strong>: remove duplicates, fix the order, enforce size and item limits, and <em>record</em> what was truncated.</li><li><strong>Gate 2</strong>: a person reviews the evidence, its size and its limitations, or the run stops.</li><li><strong>Check sufficiency</strong>: every required item must be present.</li><li><strong>Generate</strong>: the model drafts candidate tests from the exact prompt measured before Gate 2.</li><li><strong>Write</strong> the outputs.</li><li><strong>End</strong>.</li></ol><p>A request is a small JSON payload (schema version 1.1). An API request looks like this, with every value a placeholder:</p><pre>{ &quot;schemaVersion&quot;: &quot;1.1&quot;, &quot;qaStoryKey&quot;: &quot;PROJ-102&quot;, &quot;baStoryKey&quot;: &quot;PROJ-103&quot;, &quot;featureKey&quot;: &quot;PROJ-101&quot;, &quot;workItemType&quot;: &quot;API&quot;, &quot;sourceMode&quot;: &quot;LIVE&quot;, &quot;reviewOnly&quot;: true, &quot;target&quot;: { &quot;method&quot;: &quot;PATCH&quot;, &quot;path&quot;: &quot;/api/records/{recordId}/items&quot; }, &quot;confluencePageIds&quot;: [&quot;100000001&quot;], &quot;repositorySelection&quot;: { &quot;mode&quot;: &quot;EXPLICIT&quot;, &quot;repositories&quot;: [ { &quot;role&quot;: &quot;API_AUTOMATION&quot;, &quot;root&quot;: &quot;C:/projects/api-tests&quot;, &quot;contentMode&quot;: &quot;COMMITTED&quot;, &quot;reference&quot;: &quot;HEAD&quot;, &quot;searchPaths&quot;: [ &quot;api-tests/src/test/resources/features/records/item-update.feature&quot; ] } ] }, &quot;candidateLimits&quot;: { &quot;coreRequired&quot;: 5, &quot;recommendedRiskBased&quot;: 0, &quot;optionalExploratory&quot;: 0, &quot;maximumTotal&quot;: 5 } }</pre><p>A UI request uses the same shape without a target, because a UI change has no single endpoint:</p><pre>{ &quot;schemaVersion&quot;: &quot;1.1&quot;, &quot;qaStoryKey&quot;: &quot;PROJ-202&quot;, &quot;baStoryKey&quot;: &quot;PROJ-203&quot;, &quot;featureKey&quot;: &quot;PROJ-201&quot;, &quot;workItemType&quot;: &quot;UI&quot;, &quot;sourceMode&quot;: &quot;LIVE&quot;, &quot;reviewOnly&quot;: true, &quot;repositorySelection&quot;: { &quot;mode&quot;: &quot;EXPLICIT&quot;, &quot;repositories&quot;: [ { &quot;role&quot;: &quot;UI_AUTOMATION&quot;, &quot;root&quot;: &quot;C:/projects/ui-tests&quot;, &quot;contentMode&quot;: &quot;COMMITTED&quot;, &quot;reference&quot;: &quot;HEAD&quot;, &quot;searchPaths&quot;: [ &quot;ui-tests/src/test/resources/features/records/view-toggle-ui.feature&quot; ] } ] }, &quot;candidateLimits&quot;: { &quot;coreRequired&quot;: 5, &quot;recommendedRiskBased&quot;: 0, &quot;optionalExploratory&quot;: 0, &quot;maximumTotal&quot;: 5 } }</pre><p>Four fields carry most of the safety:</p><ol><li><strong>reviewOnly: true</strong> keeps every output as a draft for a person.</li><li><strong>repositorySelection.mode: &quot;EXPLICIT&quot;</strong> with <strong>searchPaths</strong> limits the repository search to named feature files, so the scope stays focused and existing-test evidence cannot flood the pack.</li><li><strong>contentMode: &quot;COMMITTED&quot;</strong> with <strong>reference: &quot;HEAD&quot;</strong> reads committed content only, never uncommitted changes in a working copy.</li><li><strong>candidateLimits</strong> caps how many candidates of each tier the model may return. The values above are the ones the first runs used; the risk tier at 0 is one of the limits discussed later.</li></ol><p>One small habit has also proved useful. When a story key has not been verified yet, the request carries an obvious placeholder such as &lt;QA_STORY_KEY&gt; instead of a plausible key. A placeholder fails validation at step 1; a wrong but valid key would quietly pull evidence from an unrelated task.</p><h3>The rule that does the most work: missing evidence blocks generation</h3><p>For API work, the pipeline will not generate until all six items are present:</p><ol><li>The feature, BA and QA stories.</li><li>At least one design page with relevant anchors.</li><li>The contract: target operation found and every $ref resolved.</li><li>The gateway’s routing and validation configuration.</li><li>The controller and its call chain.</li><li>A completed, bounded search of the existing tests.</li></ol><p>If the contract cannot be interpreted, for example because of a circular or broken $ref, the run blocks. There is deliberately no fallback to &quot;send the raw operation and hope&quot;. To put it simply, a model that is not given the contract will invent one, and the invented version will look plausible.</p><h3>Budget control: measure the prompt before anyone approves it</h3><p>The exact prompt is built <strong>once, before Gate 2</strong>, so the person approving the evidence is approving what the model will actually see. Generation reuses that same prompt text; it is not rebuilt afterwards. A hard cap on prompt size applies: if the cap is missing or exceeded, the run blocks. The prompt’s SHA-256 hash is written with the outputs, so any candidate can be traced to the exact prompt that produced it.</p><p>The token count is currently an estimate (characters divided by four). The diagram labels it as uncalibrated, because structured text such as YAML and JSON usually tokenises less efficiently than prose, so the estimate can under-count.</p><h3>The outputs</h3><p>Each run writes a folder of five files:</p><p>candidate-tests.json</p><p>the drafted candidates, machine-readable</p><p>candidate-review.md</p><p>the same candidates, laid out for a human reviewer</p><p>coverage-summary.md</p><p>what the candidates cover, against the evidence</p><p>open-questions.md</p><p>what the model could not determine from the evidence</p><p>generation-manifest.json</p><p>the run record, including the prompt hash</p><p>The open-questions file is, interestingly, the most useful of the five. It shows where the evidence ran out, which is usually where a conversation with the business analyst or developer should start. The next section explains why.</p><p>A local web page (/graph) drives all of this: a form or JSON input, presets, an interactive view of the graph, panels for both gates, and artefact download.</p><h3>What a run looks like</h3><p>The three screens below follow one request through the graph. The step bar at the top of each screen shows where the run is: green steps are complete, and the red outline marks the current step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*V_c9U_HZsscJ5i6J.png" /></figure><p><em>Figure 1. Request, preflight and Gate 1 (mock-up). The engineer fills in the target, the three story keys, the design page and an explicit repository selection. Preflight validates the request and states openly that repository freshness is unverified. Nothing is read until the scope is approved.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cXVJf-Mx_iqeWmbD.png" /></figure><p><em>Figure 2. Evidence pack, Gate 2 and the sufficiency check (mock-up). The pack shows each category’s item count, source and status, including the truncated design page and existing tests taking 85% of the pack. The prompt is measured and hashed before approval. With the contract missing, check 3 fails and generation is blocked, which is the behaviour the first real run showed was not yet enforced.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*43SbuABqq3YHiAnJ.png" /></figure><p><em>Figure 3. Results after a re-run with the contract supplied (mock-up). Five review-only candidates, now including two risk-based ones, each with a count of the questions blocking it. On the right, the open questions are grouped by topic and labelled: “needs decision” goes to the BA, while “should come from a document” points back to a gap in the evidence.</em></p><h3>Open questions as a BA-ready agenda</h3><p>The first real run produced five candidate tests and, alongside them, a list of open questions. Each question sits under the candidate test it blocks. The questions fell into a small number of recurring kinds. Illustrative versions, with placeholder field names, look like this:</p><ul><li><strong>Field mapping:</strong> “Which response field maps to the business term <em>Category</em>, and is the mapping one-to-one?”</li><li><strong>Derived values:</strong> “Should each amount field in the response equal the stored value, or a value derived from it (for example a calculated total)?”</li><li><strong>Timing:</strong> “When should startDate be populated in this response, and in what format?&quot;</li><li><strong>Interacting flags:</strong> “How do the item-level includeInTotal flag and the record-level includeInTotal flag relate, and which one wins?&quot;</li><li><strong>Contract facts:</strong> “What HTTP status code does the documented success response use?”</li></ul><p>In other words, the model separated what it could test from what only a person can decide, and it wrote the second part as questions a business analyst can answer. This changes the value of the pipeline. It drafts test candidates, but it also prepares the requirements conversation, and it does so before any test exists, which is when gaps in requirements are cheapest to fix.</p><p>Three practices make the BA meeting efficient:</p><ol><li><strong>Group the questions by topic</strong> (status codes, field mapping, dates, flags) rather than by test, so one answer can unblock several candidates.</li><li><strong>Mark each question as either answerable from a document or needing a decision.</strong> The first kind should have come from the evidence, not from the BA.</li><li><strong>Record each answer in the story’s acceptance criteria.</strong> The next run then finds the answer as evidence instead of asking the same question again.</li></ol><p>The second practice matters more than it first appears. A question such as “what is the success status code?” is not a business decision; the OpenAPI contract answers it. When a contract fact reaches the BA as an open question, it is a signal that the contract did not reach the model. That signal led to the most important finding below.</p><h3>What I found while building it</h3><p>Building the pipeline was also a review of it. Four findings are worth recording.</p><p><strong>First, a rejected run is a successful run.</strong> One early run was rejected at Gate 1 and wrote nothing. That is the design working: a wrong scope cost one click, not a folder of misleading tests.</p><p><strong>Second, the sufficiency gate let a run through without its contract.</strong> The design says an unresolved contract blocks generation. Yet in the first real run, the open questions asked for the success status code and whether an OpenAPI definition existed for the endpoint, which are both facts the contract would have supplied. It can therefore be assumed that the contract was either not retrieved or cut from the evidence pack, and that the sufficiency check at step 8 did not enforce the rule. A gate that can be bypassed is the main risk in a design that depends on gates. The fix is twofold: confirm from the run manifest and evidence pack whether a contract item was present or truncated, and add a test proving that a run with no contract stops at step 8. That test must fail on the current code before the fix is accepted.</p><p><strong>Third, existing tests can crowd out the requirements.</strong> In the same run, 22 of the 26 evidence items were existing automated tests, and only 4 were requirements, design or QA scope. That is roughly 85% of the evidence describing what is already tested. Existing tests are useful context, but they describe what is already tested, not what should be. The planned fix is to pass existing coverage as a compact index (feature and scenario titles) and spend the budget on requirements and design.</p><p><strong>Fourth, long design pages get truncated silently unless you record it.</strong> A very long wiki page can lose most of its content to a per-item size limit. Because the evidence pack records truncation, the loss was visible at Gate 2 rather than hidden in a weak output. The better fix is to split long pages into sections and keep the sections that mention the target operation.</p><h3>Limits</h3><p>This article does not claim the pipeline produces good tests. Rather, it claims the pipeline produces <em>reviewable</em> candidates from <em>recorded</em> evidence. Four limits remain:</p><ol><li><strong>Quality is not yet measured.</strong> The first real run produced five candidates, all in the core category. Whether they are right is a separate question.</li><li><strong>The sufficiency gate needs a test of its own</strong>, because one run passed it without contract evidence.</li><li><strong>The token estimate is uncalibrated.</strong></li><li><strong>Repository freshness is unverified</strong>, because the pipeline does not fetch.</li><li><strong>No negative or risk-focused candidates</strong> were requested (the run used 5 core, 0 risk, 0 exploratory). For an API, error and boundary cases are where defects usually hide, so these limits need widening. Interestingly, one core candidate still covered an empty-result case.</li></ol><h3>Next steps</h3><p>First, close the gate: prove with a failing-then-passing test that a run without a resolved contract stops at step 8. Second, add the scoring step below.</p><h3>A twelfth node that scores the output</h3><p>The missing piece is a step after “Write”: compare the candidates with a set of trusted, hand-written tests for the same endpoints, and count how many candidates are correct, how many are wrong, and what was missed. Run that across ten endpoints and the pipeline has a measured result instead of a demonstration. It is the same principle the pipeline already applies to the model: do not trust the summary, check the evidence.</p><h3>Rules I would keep</h3><ul><li>The model is one step of eleven. Put the effort into the other ten.</li><li>Two human gates: approve the scope, then approve the evidence.</li><li>Missing evidence blocks generation. No fallbacks that guess.</li><li>Measure the prompt before approval, and store its hash with the result.</li><li>Read committed content at a named reference, and say plainly what is unverified.</li><li>Use an obvious placeholder for any unverified key, never a plausible guess.</li><li>Review-only by default: a person decides what becomes a real test.</li><li>Treat open questions as a BA agenda, and treat a contract fact in that agenda as a bug.</li><li>Test the gates themselves. A gate nobody has tried to bypass is an assumption.</li></ul><h3>Summary and conclusion</h3><p>This article set out to describe a pipeline that drafts API and UI test candidates without trusting the model more than it deserves. The approach is to gather evidence deterministically through local, read-only MCP servers, to place two human gates around that evidence, and to block generation whenever a required item is missing. The main finding so far is that the safety of such a system comes less from the model than from the structure around it: the gates, the sufficiency rule and the recorded evidence. A second finding is that the open questions are as valuable as the candidate tests, because they turn gaps in the requirements into a ready agenda for the business analyst, and, read carefully, they also expose gaps in the pipeline itself. The structure, however, is only as strong as its weakest gate, so the gates must be tested, and the quality of the output still has to be measured. Those are the next steps.</p><p><em>If you build something similar at work, ask your employer first, use only approved tools and model endpoints, and keep real system names, tickets and data out of anything you publish.</em></p><h3>Appendix: the whole process</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dYqZKxS_PvuYi5qL.png" /></figure><p><em>Figure 4. The pipeline end to end: inputs and the local, read-only MCP sources (top), the deterministic eleven-step flow with its two human gates (middle), and the API/UI differences, budget control, sufficiency rule and outputs (bottom).</em></p><p><em>Originally published at </em><a href="https://mattkari.github.io/articles/gated-rag-test-generation/"><em>https://mattkari.github.io</em></a><em> on October 13, 2026.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=812ba9fc5285" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Transformative Power of Justice: Insights from the Qur'an and Nursi]]></title>
            <link>https://dkarimov.medium.com/the-transformative-power-of-justice-insights-from-the-quran-and-nursi-c2b00ce604bd?source=rss-cc6215dc2535------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2b00ce604bd</guid>
            <category><![CDATA[religion]]></category>
            <category><![CDATA[quran]]></category>
            <category><![CDATA[justice]]></category>
            <dc:creator><![CDATA[Dusmamat Karimov, PhD]]></dc:creator>
            <pubDate>Sun, 10 Nov 2024 08:38:34 GMT</pubDate>
            <atom:updated>2024-11-10T08:38:34.625Z</atom:updated>
            <content:encoded><![CDATA[<p>The Transformative Power of Justice: Insights from the Qur&#39;an and Nursi</p><p>In an era marked by social upheaval and inequality, the concept of justice (al-ʿadl) stands as a crucial pillar for fostering equity and moral integrity. Drawing from my PhD thesis, The Qur&#39;anic Concept of Justice (al-ʿAdl) from a Nursian Perspective, this article explores how the teachings of Said Nursi can illuminate pathways toward social justice in contemporary society.</p><p>Understanding Justice in the Qur&#39;an</p><p>Justice is not merely a legalistic term; it embodies a profound ethical principle that permeates every aspect of life. In the Qur&#39;an, al-ʿadl is presented as a divine command that governs relationships between individuals, communities, and even between humanity and the cosmos. This holistic understanding of justice calls for a balance that transcends mere compliance with laws, urging individuals to cultivate fairness and compassion in their daily interactions.</p><p>Nursi&#39;s Vision of Social Reform</p><p>Said Nursi, a prominent Islamic scholar, recognized the pressing need for social reform during a time of great turmoil in the Ottoman Empire. His teachings emphasized that justice is not just an obligation but a moral imperative that requires active engagement in addressing societal issues. Nursi advocated for an educational system that integrates both religious and scientific knowledge, fostering a generation capable of understanding and implementing justice in their communities.</p><p>Relevance to Modern Social Issues</p><p>The insights from Nursi&#39;s work are strikingly relevant today. As we confront systemic inequalities—be it racial injustice, economic disparity, or environmental degradation—the call for justice resonates across various movements advocating for change. By applying Nursi&#39;s principles, we can develop a framework for social action that emphasizes responsibility and moral commitment to uplift marginalized communities.</p><p>A Framework for Action</p><p>Education as Empowerment: Integrating social justice into educational curricula is essential. Just as Nursi envisioned a system that nurtures both faith and intellect, modern education must equip students with the tools to recognize and combat injustices.</p><p>Community Engagement: Active participation in community initiatives can bridge gaps between different social groups. By fostering dialogue and collaboration, we can create inclusive environments where diverse voices are heard and valued.</p><p>Moral Responsibility: Embracing our duty as caretakers of society means recognizing our role in advocating for those who are voiceless. Nursi&#39;s teachings remind us that true justice involves sacrifice and dedication to the greater good.</p><p>Interfaith Dialogue: Engaging with diverse perspectives enriches our understanding of justice. By promoting interfaith discussions, we can build solidarity among different communities striving for similar goals.</p><p>Conclusion: A Call to Action</p><p>As we navigate the complexities of modern society, the teachings of Said Nursi offer invaluable guidance on how to approach justice not just as an ideal but as a lived reality. By drawing on these insights, we can inspire collective action toward creating equitable systems that honor the dignity of all individuals.In this transformative journey toward justice, let us remember that each step taken is a contribution to a more just world—a world where fairness prevails, and every voice matters. Join me in this endeavor to uphold justice as both a personal commitment and a communal responsibility. Together, we can pave the way for meaningful change rooted in compassion and equity.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2b00ce604bd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tamerlane’s Religious Belief: Between Devotion and Controversy]]></title>
            <link>https://dkarimov.medium.com/tamerlanes-religious-belief-between-devotion-and-controversy-b7ca9ceb28a?source=rss-cc6215dc2535------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7ca9ceb28a</guid>
            <category><![CDATA[central-asia]]></category>
            <category><![CDATA[samarkand]]></category>
            <category><![CDATA[uzbekistan]]></category>
            <category><![CDATA[islam]]></category>
            <category><![CDATA[ottoman-empire]]></category>
            <dc:creator><![CDATA[Dusmamat Karimov, PhD]]></dc:creator>
            <pubDate>Mon, 08 Apr 2024 23:52:54 GMT</pubDate>
            <atom:updated>2024-04-10T15:37:22.562Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QDvKoTOg9uNYRTzOUBVbNQ.jpeg" /><figcaption>The depiction of Tamerlane praying the Juma prayer in the grand mosque of Samarkand, surrounded by his sheikhs and advisors</figcaption></figure><p>Tamerlane, or Timur, remains one of history’s most enigmatic and fascinating figures. His vast empire, built on conquests that spanned from the steppes of Central Asia to the heart of the Ottoman Empire, has been a subject of both awe and scrutiny. Central to understanding Timur’s complex legacy is his religious belief, a facet that intertwines with both his personal devotion and the broader socio-political landscapes of the era.</p><p>Timur’s adherence to Islam is often highlighted by his burial next to his spiritual mentor, Sheikh Sayyid Baraka. This act is not merely symbolic but speaks volumes about the conqueror’s personal conviction and reverence for his faith. Such gestures cemented Timur’s image as a devout Muslim, further evidenced by his patronage of Islamic architecture and scholarship. His mausoleum in Samarkand, alongside its religious significance, stands as a testament to Islamic art and culture, embodying the era’s architectural and spiritual zenith.</p><p>However, Timur’s religious journey is not devoid of controversy. His conflict with Sultan Bayezid I of the Ottoman Empire showcases a darker side of religious interpretation and historical narrative. The Battle of Ankara in 1402 not only resulted in a significant setback for the Ottomans but also painted Timur in a controversial light within some Turkish historical narratives. The capture and subsequent treatment of Sultan Bayezid have been sources of contention, leading to an array of interpretations regarding Timur’s character and religious affiliations.</p><p>This discord has permeated into the realm of religious interpretation, with some Turkish scholars and religious movements going as far as labeling Timur as Dajjal — a figure synonymous with deception and chaos in Islamic eschatology. Such interpretations, while not universally accepted, underscore the complex legacy of Timur’s conquests and their impact on Islamic societies. The labeling of Timur as Dajjal reflects not only historical grievances but also the intricate ways in which religious narratives are woven through the fabric of political and cultural conflicts.</p><p>Timur’s legacy, therefore, is a mosaic of devout faith, monumental achievements, and contentious narratives. His personal devotion to Islam, as demonstrated by his burial practices and patronage of Islamic arts, paints a picture of a ruler deeply rooted in his faith. Yet, the shadows cast by his military campaigns and the subsequent interpretations of his actions within Islamic eschatology highlight the multifaceted nature of historical legacy. These narratives, while contrasting, are not mutually exclusive but rather complementary, offering a nuanced view of Timur’s relationship with his faith and its reception across different cultures and epochs.</p><p>In conclusion, Tamerlane’s religious belief and its historical interpretation present a rich tapestry of devotion, conflict, and controversy. His legacy, as seen through the lens of his faith, is a testament to the complexities of historical figures and the diverse ways in which they are remembered and interpreted across time and cultures. Whether revered or reviled, Timur’s impact on the Islamic world and beyond is undeniable, leaving a legacy that continues to inspire debate and fascination.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b7ca9ceb28a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What should I have done during my PhD study?]]></title>
            <link>https://dkarimov.medium.com/what-should-i-have-done-during-my-phd-study-1a7e48016c1f?source=rss-cc6215dc2535------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a7e48016c1f</guid>
            <category><![CDATA[academia]]></category>
            <category><![CDATA[phd]]></category>
            <category><![CDATA[life-lessons]]></category>
            <dc:creator><![CDATA[Dusmamat Karimov, PhD]]></dc:creator>
            <pubDate>Tue, 06 Jul 2021 01:11:41 GMT</pubDate>
            <atom:updated>2021-07-06T01:11:41.917Z</atom:updated>
            <content:encoded><![CDATA[<p>What should I have done during my PhD study?</p><p>1. Engage with a paid job or do a part-time job<br>2. Do not detach yourself from real life and make a bridge between real life and PhD life<br>3. Publish or perish. <br>4. Engage with teaching even if it is non paid<br>5. Make regular and consistent supervisory meetings <br>6. Avoid being isolated. Do regular visits to friends and family.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a7e48016c1f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fear and Death]]></title>
            <link>https://dkarimov.medium.com/fear-and-death-28ae7e106c23?source=rss-cc6215dc2535------2</link>
            <guid isPermaLink="false">https://medium.com/p/28ae7e106c23</guid>
            <category><![CDATA[fear]]></category>
            <category><![CDATA[quran]]></category>
            <category><![CDATA[covid19]]></category>
            <category><![CDATA[death]]></category>
            <dc:creator><![CDATA[Dusmamat Karimov, PhD]]></dc:creator>
            <pubDate>Sat, 18 Apr 2020 22:31:35 GMT</pubDate>
            <atom:updated>2022-02-15T22:13:02.513Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/200/0*vTvUJxLjEFdiWgD9.jpg" /></figure><p>I started to fear Corona virus even before it was announced as pandemic by WHO. As it became pandemic, I started to suffer from anxiety and fear about my own life. I believe that many of us have similar worry and unease about Covid 19 these days. Let us think about fear of death or our own life.</p><p>As Muslims, we believe that our death is already destined and pre-ordained by Allah. The Quran constantly reminds me of death will capture me wherever I go as Allah asserts: “”Indeed, the death from which you flee — indeed, it will meet you” (the Quran 62:8). It comes to me as if this verse was telling me “you will die when your time is up. It does not matter what causes to this as it will happen within the realm of God’s power will.” It means what increase me anxiety is not my destined death or life but fear. In fact, fear is given to us to protect our life. Fear is not meant to make our life miserable or unbearable.</p><p><em>Originally published at </em><a href="https://dkarimov.wordpress.com/2020/04/18/fear-and-death/"><em>http://dkarimov.wordpress.com</em></a><em> on April 18, 2020.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=28ae7e106c23" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>