The module digest and the discover tool: does the stdlib already do this? - #4019
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
There are a few concrete correctness/quality issues in the new discover tool and digest topic fallback handling that should be addressed before approval.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR adds a generated “module digest” for the daslang stdlib and a new MCP discover tool that intent-searches that digest, making it much easier to answer “does the stdlib already do this?” without knowing the exact symbol name.
Changes:
- Generate
skills/daslang/references/everything.mdas part ofdas2rstdocs generation (with optional--digestredirect) and improve topic fallback so promoted builtins can surface both extracted and handmade descriptions. - Add MCP
discovertool (ranking + optional FTS5 filtering), wire it into the MCP registry/README, and add ranking/behavior tests. - Update CI/shipped-skill gates and agent guidance to treat the digest as generated output while keeping other checks strict.
File summaries
| File | Description |
|---|---|
| utils/mcp/tools/discover.das | New MCP tool implementing digest parsing, ranking, and optional FTS5 filtering. |
| utils/mcp/test_tools.das | Adds discover tool tests (ranking, synonyms, filtering, limit/error cases). |
| utils/mcp/REVIEW.md | Updates review checklist wording for SDK install rules and comment-keeper tests. |
| utils/mcp/registry_das.das | Registers discover ToolDef (schema + handler wiring). |
| utils/mcp/README.md | Documents discover in the MCP tool list. |
| tests/daslib/test_rst_digest.das | New tests for digest generation behavior (first sentence, overload collapse, BOM stripping, grouping). |
| tests/daslib/_rst_digest_mod.das | New fixture module used by digest tests. |
| skills/mcp_tools.md | Adds discover to the MCP-first tool table. |
| skills/internal/documentation_rst.md | Documents digest generation and --digest flag behavior. |
| skills/dupe_audit.md | Updates dupe-audit procedure to read the digest and use discover. |
| skills/daslang/SKILL.md | References the new generated everything.md digest in the language skill index. |
| skills/daslang/references/modules-and-stdlib.md | Points readers to everything.md for intent-based stdlib lookup. |
| skills/daslang/README.md | Declares references/everything.md as generated and describes regeneration rules. |
| skills/comment_style_hygiene.md | Clarifies //! attachment rules and when to respell to //. |
| doc/source/stdlib/handmade/structure_annotation-rtti-CodeOfPolicies.rst | Removes stray BOM/formatting artifact in handmade RST content. |
| doc/source/stdlib/handmade/function-rst-write_digest-0x29996dc1390e7fee.rst | Adds handmade description for rst::write_digest. |
| doc/reflections/das2rst.das | Adds clargs support for --digest, documents write_digest, and calls it at end of generation. |
| daslib/rst.das | Implements digest generation (md_row, md_begin, write_digest) and handmade fallback via topic_path. |
| daslib/REVIEW.md | Clarifies the “topic key computation must match” rule and updates architecture doc list. |
| CLAUDE.md | Adds discover to the “ask before writing a helper” table and streamlines language-skill reference text. |
| ci/test_fix_md_ascii.py | Tests that the generated digest is treated as shipped output. |
| ci/test_check_shipped_skills.py | Tests that the generated digest skips purity bans but still enforces other checks. |
| ci/REVIEW.md | Tightens policy on when bundle-gate skips are allowed (must be justified for newly added file). |
| ci/fix_md_ascii.py | Exempts the digest by full path in shipped set so typography isn’t rewritten. |
| ci/check_shipped_skills.py | Adds GENERATED_DIGEST and exempts it from purity bans while keeping other validations. |
| .claude/agents/dupe-sweeper.md | Updates dupe-sweeper agent charter to read the digest before reviewing functions. |
| .claude/agents/dupe-auditor.md | Updates dupe-auditor agent charter to read the digest before verdicts. |
| .claude/agents/dragon.md | Clarifies that generated .md outputs (including the digest) aren’t audited as rule documents. |
Review details
- Files reviewed: 28/29 changed files
- Comments generated: 4
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
8c976bf to
fdc4a8c
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The new discover tool has verified query-handling issues (case sensitivity and FTS operator detection) that can cause expected searches/filters to fail.
Get a fresh assessment by requesting another Copilot review.
Review details
- Files reviewed: 28/29 changed files
- Comments generated: 3
- Review effort level: Lite
fdc4a8c to
306791e
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Digest row capture in daslib/rst.das currently reads function topic files before they’re written, which can produce stale or missing digest descriptions.
Get a fresh assessment by requesting another Copilot review.
Review details
- Files reviewed: 28/29 changed files
- Comments generated: 1
- Review effort level: Lite
306791e to
d379c4c
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The changes appear coherent and covered by targeted new tests, with only a minor test-helper robustness improvement suggested.
Review details
- Files reviewed: 28/29 changed files
- Comments generated: 1
- Review effort level: Lite
…his? das2rst writes skills/daslang/references/everything.md beside the RST - one section per module, every public symbol with the first sentence of its description, overloads collapsed to one row (a later overload fills a row the first left bare); a detail/ topic with no extracted file reads its handmade/ twin, which puts descriptions on 95 fio, ast and rtti symbols the RST pages printed bare. The dupe-auditor and dupe-sweeper read the digest whole before the first function. The MCP server gains discover: intent words ranked by coverage then by where they hit (name, group, description) with a synonym list and query-order tiebreak, FTS5 syntax filtered through daslib/fts5_query; every call logs its query, hit count and top answer. The shipped-skills gate skips its purity bans for the generated file. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
d379c4c to
acac3a2
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The changes are cohesive, well-tested (new digest and discover tests), and the remaining feedback is a minor performance optimization.
Review details
- Files reviewed: 28/29 changed files
- Comments generated: 1
- Review effort level: Lite
Why. An agent rolled its own
uri_to_file_namebecause nothing told ituriparseralready has one. Name-based search only finds what you already know the name of, and the manual's 3 MB of RST does not fit any context.What changes.
das2rstwritesskills/daslang/references/everything.mdbeside the RST: one section per module, every public symbol with the first sentence of its description, overloads collapsed to one row.detail/topic with no extracted file reads itshandmade/twin, so the promoted builtin modules (fio, ast, rtti) show both halves on their RST pages too.discover: intent words ranked by coverage, then by where they hit (name, group, description) with a small synonym list and a query-order tiebreak; FTS5 syntax filters throughdaslib/fts5_query; every call logs its query, hit count and top answer.CLAUDE.md's MCP-first table sends a writer todiscoverbefore any helper.Observable behavior.
daslang -documentation doc/reflections/das2rst.das-> also writes the digest (-- --digest <path>redirects it).mcp__daslang__discover("convert uri to file name")->uriparser::uri_to_file_namefirst; twelve intents measured, nine land the right symbol in the top three, the misses are description gaps.logs/mcp_server.log-> onemcp.discoverline per call.Where to look.
daslib/rst.das(md_row,topic_path,write_digest),utils/mcp/tools/discover.das(score_rowand the sort), and the two agent charters.Validation, claims, ledger
Validation
-W, no// stub, noUncategorized), tests-aot (fulltest_aot).tests/watchdog/test_watchdog.das, over the 60 s per-file cap (83 s) on a loaded box; tests-jit has the same cap hit plustests/jit_tests/jit_lib.das(7 cases that build a shared library throughdaslang -lib); tests-cpp failsstandalone_capi_dasbindon a fixture DLL this build dir never produced. No C++, interpreter or JIT surface changes here.examples/graphics/modules/; with it set aside all three compile against the in-treemodules/dasImgui.tests/daslib/test_rst_digest.das(7 cases) andtest_discoverinutils/mcp/test_tools.das(9 rank-asserting cases) pass;ci/test_check_shipped_skills.py(16) andci/test_fix_md_ascii.pypass.ci/fix_md_ascii.py's shipped set: its typography is the docs' own (257 em dashes from//!comments), a rewrite would be undone by the next regeneration; mojibake is still policed. A byte-order mark found in one handmade page is stripped both at the source and by the generator..mcp.jsonentry pointed at the deleted supervisor); lint and format ran through the CLI on the changed set..claude/skills/daslanginstall copy) is fixed.Claims - stated, not tested
discoverfalls back to.claude/skills/daslang/references/everything.mdwhenDAS_INSTALL_DOCDIRrelocates the docs. Verified by reading the twoinstall(DIRECTORY ...)rules; a break shows as "module digest not found" in a relocated SDK.digest_path(thevar publicindaslib/rst.dasthe new handmade doc names) exists andwrite_digestis a no-op while it is empty; checked by running the generator with and without it.document_*writers as the RST, so it resolves by construction; spot-checkeduri_to_file_name,fread,mkdir_rec,base_name.discoverToolDef'sarg_namesorder (query,limit,module) matches the handler; the tests calldo_discoverdirectly.ci/check_shipped_skills.pyskip names a file this diff adds. It cannot be fixed instead: its lines are the stdlib's own descriptions, and a lint module's description names lint rule IDs.Not done
//!backlog; the digest is the list.daslib/clargsanddaslib/fts5_queryhave nodocument_module_*entry indas2rst, so they are absent from the manual and from the digest.freadshows the binary overload's sentence because the string overload has no doc file..claude/agents/*.mdresolves; aREVIEW.dasgate that every mcpToolDefhas a README row and a test case; the key-spelling gate fordaslib/rst.das(everymd_rowtopic equals thedocument_topictopic beside it).daslib/REVIEW.md's 60-word "daslib fact decided outside the folder" rule (split trigger from duty?) andutils/REVIEW.md's 200-word definitions preamble.bin/daslang.exein this tree is a stale Sep 4 copy beside the realbin/Release/binary; two audits and the old MCP entry picked it up. Deleting it is a local cleanup, not part of the change.