<kb-pool name="kos-tools" version="1" title="Assay tool definitions" lang="en" address="mr://kos/tools/" kind="pack">
<schema name="kb-block" strict-children="true">
<require attr="key"/>
<require attr="kind"/>
<require attr="stamp"/>
<child tag="title" min="1" max="1"/>
<child tag="dried" min="1" max="1"/>
<allow tag="body"/>
<allow tag="quote"/>
<allow tag="proof"/>
<allow tag="source"/>
<allow tag="link"/>
<allow tag="tag"/>
<allow tag="rel"/>
<allow tag="score"/>
<allow tag="comment"/>
</schema>
<spine title="Assay tool definitions">
<part id="tools" title="Tools">
<dried>One definition each, with declared effects and the hosts each may reach.</dried>
<ref key="tool-doi-resolve"/>
<ref key="tool-wayback-lookup"/>
<ref key="tool-diff-captures"/>
<ref key="tool-sql-query"/>
<ref key="tool-replay-run"/>
<ref key="tool-watch-url"/>
</part>
</spine>

<block key="tool-doi-resolve" kind="tool" version="1.0.0" stamp="VP" id="sha256:9d56f0433c90c168da4e43f70579bc0ce897cbc49e85fb307b382b136a78fe58">
<title>Resolve a DOI to its registry record</title>
<dried>Looks up a DOI at Crossref and returns authors, title, venue, issue date and the publisher's URL.</dried>
<body><definition name="doi_resolve" effects="network" hosts="api.crossref.org" needs="cloudflare" surfaces="frame"><description>Return the Crossref record for one DOI. Use when a claim cites a paper by DOI, or when the date and venue of a primary source must be confirmed against the registry rather than a secondary account.</description><input><![CDATA[{"type":"object","properties":{"doi":{"type":"string","description":"A DOI such as 10.1007/BF01840446, with or without https://doi.org/"}},"required":["doi"],"additionalProperties":false}]]></input><output><![CDATA[{"type":"object","properties":{"doi":{"type":"string"},"title":{"type":"string"},"authors":{"type":"array","items":{"type":"string"}},"venue":{"type":"string"},"issued":{"type":"string"},"url":{"type":"string"},"rawSha256":{"type":"string"}},"required":["doi","title","issued"],"additionalProperties":false}]]></output></definition><p>Implementation: baked into the Assay 1.1 build (services/tools.ts); it moves into this block at Stage 6. Declared effects: network; hosts: api.crossref.org.</p></body>
<source status="VP" href="https://www.crossref.org/documentation/retrieve-metadata/rest-api/">Crossref REST API, works route (no sign-up)</source>
<tag>tool</tag><tag>effects:network</tag>
</block>

<block key="tool-wayback-lookup" kind="tool" version="1.0.0" stamp="VP" id="sha256:a85c04ab0cdb60cf7dd12394c442ccfec6999b01f7347bcae8853e09035539c1">
<title>Find the closest archived copy of a URL</title>
<dried>Asks the Internet Archive's availability API for the archived snapshot of a URL closest to a given time.</dried>
<body><definition name="wayback_lookup" effects="network" hosts="archive.org" needs="cloudflare" surfaces="frame"><description>Return the Wayback Machine snapshot closest to a timestamp. Use it as an external timestamp for a capture: it shows what a page said at a date fixed by a third party. An archive copy is never counted as independent corroboration.</description><input><![CDATA[{"type":"object","properties":{"url":{"type":"string","description":"http(s) URL"},"timestamp":{"type":"string","description":"YYYYMMDD[hhmmss], optional"}},"required":["url"],"additionalProperties":false}]]></input><output><![CDATA[{"type":"object","properties":{"available":{"type":"boolean"},"archivedUrl":{"type":"string"},"archivedAt":{"type":"string"}},"required":["available"],"additionalProperties":false}]]></output></definition><p>Implementation: baked into the Assay 1.1 build (services/tools.ts); it moves into this block at Stage 6. Declared effects: network; hosts: archive.org.</p></body>
<source status="VP" href="https://archive.org/help/wayback_api.php">Internet Archive, Wayback Machine availability JSON API</source>
<tag>tool</tag><tag>effects:network</tag>
</block>

<block key="tool-diff-captures" kind="tool" version="1.0.0" stamp="VP" id="sha256:eaf160be883cb6c86f76b825f0fcff64b17b556bf969ba1020956905ae033215">
<title>Compare two captures sentence by sentence</title>
<dried>Computes the shortest edit script between the readable texts of two captures (Myers 1986), sentence by sentence.</dried>
<body><definition name="diff_captures" effects="read-only" needs="any" surfaces="frame"><description>Compare two captured texts, typically two captures of one URL at different times, and list the sentences removed and added.</description><input><![CDATA[{"type":"object","properties":{"a":{"type":"string","description":"capture or source key (older)"},"b":{"type":"string","description":"capture or source key (newer)"}},"required":["a","b"],"additionalProperties":false}]]></input><output><![CDATA[{"type":"object","properties":{"equal":{"type":"integer"},"removed":{"type":"integer"},"added":{"type":"integer"}},"required":["equal","removed","added"],"additionalProperties":false}]]></output></definition><p>Implementation: baked into the Assay 1.1 build (services/tools.ts); it moves into this block at Stage 6. Declared effects: read-only.</p></body>
<source status="VP" href="https://doi.org/10.1007/BF01840446">E. W. Myers, “An O(ND) Difference Algorithm and Its Variations”, Algorithmica 1(1–4), 251–266, Nov 1986</source>
<tag>tool</tag><tag>effects:read-only</tag>
</block>

<block key="tool-sql-query" kind="tool" version="1.0.0" stamp="VP" id="sha256:f6a49e81a846f20c73e662fa8c7bb823053d57ccbc05802b20bf557d3d26618e">
<title>Query the pool with SQL</title>
<dried>Runs SQL against an in-memory SQLite index rebuilt from the pool; every row carries the hash of the block it came from.</dried>
<body><definition name="sql_query" effects="read-only" needs="any" surfaces="frame"><description>Answer questions across the pool (claims by stamp, standards by use, sources by publisher, answers by model) with SQLite. The index is disposable and rebuilt from the pool, so a query can always be checked against the blocks.</description><input><![CDATA[{"type":"object","properties":{"sql":{"type":"string"}},"required":["sql"],"additionalProperties":false}]]></input><output><![CDATA[{"type":"object","properties":{"columns":{"type":"array","items":{"type":"string"}},"rows":{"type":"array"}},"required":["columns","rows"],"additionalProperties":false}]]></output></definition><p>Implementation: baked into the Assay 1.1 build (services/tools.ts); it moves into this block at Stage 6. Declared effects: read-only.</p></body>
<source status="VP" href="https://sqlite.org/wasm/doc/trunk/index.md">SQLite (public domain), compiled to WebAssembly by the SQLite project; @sqlite.org/sqlite-wasm 3.53.4</source>
<tag>tool</tag><tag>effects:read-only</tag>
</block>

<block key="tool-replay-run" kind="tool" version="1.0.0" stamp="VP" id="sha256:e83859cddc596f415ddd0530eb5c2365eedf241d93e3aa71ae7e96d94f8e127a">
<title>Replay an assay: audit, fresh or drift</title>
<dried>Audit re-derives every stamp from recorded answers without Claude; fresh asks Claude again; drift re-captures the source.</dried>
<body><definition name="replay_run" effects="writes-pool" needs="any" surfaces="frame"><description>Replay the assay of one source. audit: feed the recorded answers through the same checks and stamp rule and report any difference (a difference is a defect). fresh: call the model again on the same capture and report which stamps change (fragile claims). drift: fetch the URL again and report which quotes are no longer in the page.</description><input><![CDATA[{"type":"object","properties":{"source":{"type":"string","description":"source key (src-…)"},"mode":{"type":"string","enum":["audit","fresh","drift"]}},"required":["source","mode"],"additionalProperties":false}]]></input><output><![CDATA[{"type":"object","properties":{"ok":{"type":"boolean"},"summary":{"type":"string"}},"required":["ok","summary"],"additionalProperties":false}]]></output></definition><p>Implementation: baked into the Assay 1.1 build (services/tools.ts); it moves into this block at Stage 6. Declared effects: writes-pool.</p></body>
<source status="VP" href="https://doi.org/10.1007/BF00196791">Haber &amp; Stornetta, “How to time-stamp a digital document”, J. Cryptology 3(2), 99–111, 1991 (hash-chained records)</source>
<tag>tool</tag><tag>effects:writes-pool</tag>
</block>

<block key="tool-watch-url" kind="tool" version="1.0.0" stamp="VP" id="sha256:a0a5209a02fa3fe5775a9340dea4bac12fdd762082a1e421a894d531fc99a18b">
<title>Watch a source for changes</title>
<dried>Registers a URL with the deployment's D1 store; a Cron Trigger (Workers) or the desk (Pages) re-fetches it on a timetable and records any change.</dried>
<body><definition name="watch_url" effects="writes-pool network" hosts="(the watched URL)" needs="server-store" surfaces="frame"><description>Re-check a captured source on a timetable and record each check (status, raw hash, text hash) in the server store. A recorded change is the cue for a drift replay.</description><input><![CDATA[{"type":"object","properties":{"url":{"type":"string"},"every_hours":{"type":"integer","minimum":1,"maximum":720}},"required":["url"],"additionalProperties":false}]]></input><output><![CDATA[{"type":"object","properties":{"url":{"type":"string"},"every_hours":{"type":"integer"}},"required":["url"],"additionalProperties":false}]]></output></definition><p>Implementation: baked into the Assay 1.1 build (services/tools.ts); it moves into this block at Stage 6. Declared effects: writes-pool, network; hosts: (the watched URL).</p></body>
<source status="VP" href="https://developers.cloudflare.com/workers/configuration/cron-triggers/">Cloudflare Cron Triggers (scheduled handler) and D1 (GA 1 April 2024)</source>
<tag>tool</tag><tag>effects:writes-pool</tag><tag>effects:network</tag>
</block>

<manifest pack="kos-tools" title="Assay tool definitions" version="1.0.0" format="kos-pack-1" created="2026-10-02T12:00:00Z" root="sha256:bc382302e823e1f917fed6146e5fcc669e09e8218d7207c3bc152d70dee8928a" blocks="6">
<who>
<identity root="sha256:bc382302e823e1f917fed6146e5fcc669e09e8218d7207c3bc152d70dee8928a"/>
<author name="Rob Anderson" org="Memeroot Ltd" role="commissioning author and publisher"/>
<builder name="Claude" org="Anthropic" model="claude-opus-5-5" role="collated, checked and compiled under the author’s instruction"/>
</who>
<where>
<derived-from kind="release" date="2026-10-02">Assay 1.1 tool definitions (kernel/tools.ts), as seeded by the build</derived-from>
<source href="https://www.crossref.org/documentation/retrieve-metadata/rest-api/" status="P" checked="2026-09-27"/>
<source href="https://archive.org/help/wayback_api.php" status="P" checked="2026-09-27"/>
<source href="https://doi.org/10.1007/BF01840446" status="P" checked="2026-09-27"/>
<source href="https://sqlite.org/wasm/doc/trunk/index.md" status="P" checked="2026-09-27"/>
<source href="https://doi.org/10.1007/BF00196791" status="P" checked="2026-09-27"/>
<source href="https://developers.cloudflare.com/workers/configuration/cron-triggers/" status="P" checked="2026-09-27"/>
<build tool="build_packs.py" sha256="sha256:6a8f4d9eb8f927aa16729fe8ab00ace73bd9f11981ccbb95070296dbeb52ece1" canonical="C14N-MR 1.0"/>
</where>
<what kind="tools" effects="network" install="register">
<purpose>The six tool definitions built into Assay 1.1, as tool blocks. Installing registers the definitions for reading and pin comparison; the code stays in the build until Stage 6.</purpose>
</what>
<list>
<item key="tool-doi-resolve" hash="sha256:9d56f0433c90c168da4e43f70579bc0ce897cbc49e85fb307b382b136a78fe58"/>
<item key="tool-wayback-lookup" hash="sha256:a85c04ab0cdb60cf7dd12394c442ccfec6999b01f7347bcae8853e09035539c1"/>
<item key="tool-diff-captures" hash="sha256:eaf160be883cb6c86f76b825f0fcff64b17b556bf969ba1020956905ae033215"/>
<item key="tool-sql-query" hash="sha256:f6a49e81a846f20c73e662fa8c7bb823053d57ccbc05802b20bf557d3d26618e"/>
<item key="tool-replay-run" hash="sha256:e83859cddc596f415ddd0530eb5c2365eedf241d93e3aa71ae7e96d94f8e127a"/>
<item key="tool-watch-url" hash="sha256:a0a5209a02fa3fe5775a9340dea4bac12fdd762082a1e421a894d531fc99a18b"/>
</list>
<signature role="build" author="053e9aeda20e5e82" fp256="053e9aeda20e5e828b1d52e17e059831a6027575527f95784ad3dcc9f7c2bd01" name="build" pubkey="MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAERAfIy1J/nZ89pbXm2hSF+bJLCRrBqGwYITNRDVpMyADN89jqwG5o+ZGsRyt9SM8xRk8KInUMMEIyzo/dCfMdQA==" value="Qid+owqftLarMiMlXPbhdYhBfUdB57susu2NHXQyYOmiA4ndb3Ib+fU3kuz1jb9ZdeZYyLC4tXTMM1+lEeN/gg==" algo="ECDSA-P256-SHA256" timestamp="2026-10-02T12:30:10.323Z"/></manifest>
</kb-pool>