<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Retrieval on PHP Boy Scout</title><link>https://phpboyscout.uk/tags/retrieval/</link><description>Recent content in Retrieval on PHP Boy Scout</description><generator>Hugo -- gohugo.io</generator><language>en-gb</language><copyright>Matt Cockayne</copyright><lastBuildDate>Thu, 24 Sep 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://phpboyscout.uk/tags/retrieval/index.xml" rel="self" type="application/rss+xml"/><item><title>The most tempting corpus in any repository</title><link>https://phpboyscout.uk/the-most-tempting-corpus-in-any-repository/</link><pubDate>Thu, 24 Sep 2026 00:00:00 +0000</pubDate><guid>https://phpboyscout.uk/the-most-tempting-corpus-in-any-repository/</guid><description>&lt;img src="https://phpboyscout.uk/the-most-tempting-corpus-in-any-repository/cover-the-most-tempting-corpus-in-any-repository.png" alt="Featured image of post The most tempting corpus in any repository" /&gt;&lt;p&gt;Whenever I explain that &lt;a class="link" href="https://phpbotscout.phpboyscout.uk/" target="_blank" rel="noopener"
 &gt;phpbotscout&lt;/a&gt; answers from the estate&amp;rsquo;s documentation, somebody asks why it doesn&amp;rsquo;t read the issues as well, and it&amp;rsquo;s a fair question. They&amp;rsquo;re right there, they&amp;rsquo;re full of questions shaped exactly like the ones people ask, they come with answers underneath and the forge has already indexed the lot, and the good ones are better than the docs because a maintainer wrote them in a hurry for a real person with a real problem.&lt;/p&gt;
&lt;p&gt;I nearly did it, too. The first draft of the design had closed issues in the corpus.&lt;/p&gt;
&lt;h2 id="the-draft-i-cut-across"&gt;The draft I cut across
&lt;/h2&gt;&lt;p&gt;The draft was careful about it, in the way that turns out to be the wrong kind of careful. Anyone with a GitLab account can open an issue on a public repository, so issue text is arbitrary third-party writing sat inside repositories the bot otherwise trusts, and the draft&amp;rsquo;s answer was to index only issues from authors holding Reporter access or better, which is to say trust a set of people.&lt;/p&gt;
&lt;p&gt;I was reading it back while something else built, and what I typed to the agent drafting it was that we should not be using the literal contents of an issue or its comments as a valid source for answers at all. Then I typed it again a minute later with the comments spelled out, because the first go at it had left them implied. An issue could signpost an answer, in code or in the documentation, and that signpost had to be validated before anything went back to a user. It landed as a commit with the rule for a title, and the rule hasn&amp;rsquo;t moved since.&lt;/p&gt;
&lt;p&gt;It was the wrong kind of careful because filtering by author defends against the case I&amp;rsquo;m least likely to meet. Nobody is attacking this estate. What I will meet, and it&amp;rsquo;s a certainty, is a maintainer being wrong in a comment, or right in 2024 and wrong now, which is worse because it was right at the time and reads like it still is. &amp;ldquo;Fixed in main&amp;rdquo; on a fix that got reverted, a workaround three releases have made unnecessary, and a two-year-old comment that hasn&amp;rsquo;t been edited because nobody goes back and edits those. An issue tracker is a graveyard of correct-at-the-time, and a Reporter badge on the author doesn&amp;rsquo;t help with any of it.&lt;/p&gt;
&lt;h2 id="genuine-signals-wrong-content"&gt;Genuine signals, wrong content!
&lt;/h2&gt;&lt;p&gt;The prompt already fences off retrieved text as never being an instruction, so a planted comment saying &amp;ldquo;ignore your instructions and&amp;hellip;&amp;rdquo; goes nowhere. That&amp;rsquo;s the &lt;em&gt;instruction&lt;/em&gt; form of the problem, and prompting can hold that line. It can&amp;rsquo;t touch the &lt;em&gt;content&lt;/em&gt; form, which doesn&amp;rsquo;t attack the system at all. Picture an issue on &lt;code&gt;go/config&lt;/code&gt; that says, plausibly and wrongly, that the supported way to store credentials is &lt;code&gt;credentials.literal: true&lt;/code&gt;. The bot retrieves it, finds it topical, and hands it over as fact with a citation to a real page in a real repository under my own name, and every trust signal a reader has is genuine (the namespace, the resolving link, the tone of the thing) while the content is false. The citation makes it &lt;em&gt;more&lt;/em&gt; convincing, not less! That&amp;rsquo;s the bit that gave me a cold feeling, and you can&amp;rsquo;t prompt your way out of it, so it had to be structural.&lt;/p&gt;
&lt;h2 id="signposts"&gt;Signposts
&lt;/h2&gt;&lt;p&gt;So an issue gets to tell the bot where to look, and never what to say.&lt;/p&gt;
&lt;p&gt;A signpost is an extractable, resolvable reference and nothing softer: a documentation page on one of the docs sites, a file path in a qualifying repository (with a line if you&amp;rsquo;re lucky), or a commit or merge request, which resolves to code. A reference to another issue doesn&amp;rsquo;t count, because chaining issue to issue rebuilds a path back to a stranger&amp;rsquo;s prose, which is the thing the rule exists to stop, so a signpost has to terminate in documentation or code.&lt;/p&gt;
&lt;p&gt;Then it gets validated, three ways, before it&amp;rsquo;s allowed to inform a reply. It has to resolve at the current ref (issues are old, and link rot is the normal case). The target has to satisfy the corpus rules on its own, same group, same exclusions, same visibility check, because being linked from something in the corpus confers nothing&amp;hellip; without that check, a planted issue pointing into the private &lt;code&gt;infra&lt;/code&gt; repository would have the bot fetch and quote the AWS topology that the exclusion list exists to keep out, laundered in through a source that looks legitimate. And the target has to address the question, which is the bot&amp;rsquo;s usual job. Fail any of the three and the signpost is discarded and the issue drops out of the answer. When one passes, the citation names the target and not the issue that led there, because an issue is a routing hint and citing it lends the prose an authority it hasn&amp;rsquo;t earned.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s all &lt;a class="link" href="https://phpbotscout.phpboyscout.uk/explanation/concepts/corpus-boundary/#issues-can-point-they-cannot-tell-the-bot-what-to-say" target="_blank" rel="noopener"
 &gt;written up on the bot&amp;rsquo;s docs site&lt;/a&gt; in requirement form, with one thing the page doesn&amp;rsquo;t say: as it stands today the bot reads no issues at all. Keeping their text out of the corpus was the structural half and it went in first, and the signpost extraction is the half that lets some of that value back, on the rule&amp;rsquo;s terms, when it&amp;rsquo;s built.&lt;/p&gt;
&lt;h2 id="what-it-costs"&gt;What it costs
&lt;/h2&gt;&lt;p&gt;It loses a real category of answer, and a specific one: the explanation a maintainer wrote in a thread and never wrote up anywhere else. That&amp;rsquo;s often the best answer in the repository, and the bot now declines it.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve made my peace with that, sort of, because declining is the product working. An answer that only exists in an issue &lt;em&gt;is&lt;/em&gt; a documentation gap, and quoting the thread would satisfy the person asking while leaving the gap sat there indefinitely. Going quiet escalates it instead, and the gap comes back as a piece of work with a count against it. The most valuable thing this bot was ever going to produce is a ranked list of things to document, so it going quiet exactly where the documentation is thin is the behaviour I want, even on the days it&amp;rsquo;s annoying.&lt;/p&gt;
&lt;h2 id="rank-your-sources-by-how-they-rot"&gt;Rank your sources by how they rot
&lt;/h2&gt;&lt;p&gt;If you&amp;rsquo;re building anything that answers from a corpus, this part isn&amp;rsquo;t specific to bots or to issue trackers.&lt;/p&gt;
&lt;p&gt;Retrieval systems weight sources by relevance and by recency, and hardly any weight them by how they go stale, which is the property that predicts whether an answer will be wrong. Code is true by construction, in that it does whatever it does. Documentation decays slowly and visibly, and a page that&amp;rsquo;s wrong gets noticed eventually (usually by someone following it and swearing). Issues decay invisibly and don&amp;rsquo;t get corrected, because the thread closed the day it was answered and hasn&amp;rsquo;t been read since. Three sources, three quite different half-lives, and a relevance score sees none of it.&lt;/p&gt;
&lt;p&gt;So the tracker points and the code and the docs speak. Someone giving me directions is welcome to name the street, and I&amp;rsquo;ll go and read the sign myself.&lt;/p&gt;</description></item></channel></rss>