Repository navigation
feat(sources): Ask the Library, standing Library rules, parity test and citation styles - #862
Open
yaacovcorcos wants to merge 1 commit into
Conversation
Contributor
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: unavailable · PR result: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
yaacovcorcos
force-pushed
the
claude/sources-ask-library-pr-20261111
branch
3 times, most recently
from
November 11, 2026 21:17
043925f to
38e3499
Compare
yaacovcorcos
force-pushed
the
claude/sources-ask-library-pr-20261111
branch
from
November 11, 2026 22:42
38e3499 to
b8bf533
Compare
yaacovcorcos
added a commit
that referenced
this pull request
Nov 12, 2026
The coverage gate compiles every apps/web source file; CitationStylePicker's try/catch/finally bailed out (BuildHIR::lowerStatement) and failed Test Web 5 on #862. setPending(false) now runs after the catch, on both paths. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
yaacovcorcos
force-pushed
the
claude/sources-ask-library-pr-20261111
branch
from
November 12, 2026 00:27
b8bf533 to
5c484b9
Compare
…refresh option, citation styles B1: the Library block of the agent awareness text carries the tested rules (answer from the Library, give paper and page, check quotes; +299 bytes), and "Ask the Library" is the first item of the Library menu, inserting the tested sentence at the start of the chat draft without sending it. B2: a typed table maps every Library change command and read endpoint to an agent tool or an allowed exemption, guarded by a test that fails when a command loses its tool. Also fixes the Library plugin listing, which was missing six registered tools (four Zotero tools, import file, export). B3: scient_sources_check gains an optional refresh input, reusing the interface button's code, so agents can refresh one Source's metadata from its registry or its PDF, then re-check it. The parity table has no gaps left. Tool list 110,355 -> 110,523 bytes. B4: one citation style per project, chosen from the whole CSL catalogue and saved in the project with its parent style. The copied reference and Word export use it; a missing or broken style is named, never replaced silently. Twenty styles and one locale are bundled under CC BY-SA 3.0 with attribution. Agents search styles through scient_sources_list and set one through scient_sources_bibliography. Tool list 110,523 -> 110,848 bytes. B6: with skills:read, the Library block ends by sending reference checks to the references skill by name. The turn's skill note carries only a count, and the plain request "Check the references in X" loaded the skill in 0 of 3 pilot runs; with the sentence, 3 of 3. +76 bytes of awareness text. B7: the references skill no longer fetches papers for a check-only request (scient_paper_get writes a PDF and a queue file into the project) and reads only what the Library already holds, reporting unheld papers as not read. Every page is written "PDF page N", or "printed page N" when only that is known. In three live runs on the shipped wording: no fetches, no files written, every page labelled (before: 4 fetches, 2 files, 0 of 21 pages labelled). Fix: CitationStylePicker's try/finally bailed out of the React Compiler (the coverage test compiles every apps/web source file and failed Test Web 5 on the previous head); setPending now runs after the catch. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
yaacovcorcos
force-pushed
the
claude/sources-ask-library-pr-20261111
branch
from
November 12, 2026 05:45
5c484b9 to
494c4c8
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #858 (which is stacked on #823). Review this one after those two.
This pull request holds Lane B items. Today: B1 (Ask the Library), B2 (interface/agent parity test), B3 (single-Source metadata refresh for agents), B4 (citation styles), B6 (reference checks reach the
referencesskill), B7 (a check-only reference review fetches nothing and labels its pages).Problem
A test of 30 literature questions against a private Library (
reviews/sources-roadmap-20261110/ask-my-library/REPORT.mdin the planning workspace) showed that agents already answer correctly from the Library, but rarely give the page (4 of 19 claims) and almost never check quotes (0 of 30 runs). One fixed sentence before the question changed that to 19 of 19 pages and quote checks in 26 of 30 runs. People should not have to type that sentence, and agents should follow the same rules without it.Separately, the owner's rule is that agents can do everything a person can in the Library. Today that is checked by hand; nothing fails when a new interface action ships without an agent tool — and the parity check found one that had already slipped: Refresh metadata on a Source.
Citations: the copied reference offered two fixed styles, and Word export used one style from Settings for every project. A journal's own style could not be chosen, and a project could not carry its style with it.
What changes
apps/server/src/provider/ScientAwareness.ts) now says: answer literature questions from the Library's papers, not from memory; search and read the full text; give the paper and page for each claim; check quotes withscient_sources_quote_checkbefore giving them; say when the Library does not answer, and say when the web was used instead. Every provider builds its instructions through the same function, so all get the new block.referencesskill (B6). When the session can also load skills, the Library block ends with: "To check or fix a document's references, load thereferencesskill first." The turn's skill note carries only a count, and an agent that already has the Library rules starts on the Library tools without listing skills. In the support-check pilot the plain request "Check the references in X" loaded the skill in 0 of 3 runs; with the sentence it loaded in 3 of 3.scient_paper_get, which saved a PDF and a queue file into the project, and no reply said whether a page number was the PDF page or the printed page. Thereferencesskill text (and its identical embedded copy) now says: never callscient_paper_getfor a check-only request; read what the Library already holds and report a paper it does not hold as not read; write every page as "PDF page N", or "printed page N" when only that is known. Only skill text and docs change; no tool, no budget file.insertTextAtStart(upstream fileChatComposer.tsx, four marked spots). It uses the composer's own insert path.apps/server/src/mcp/toolkits/sources/libraryParity.ts,libraryParity.test.ts): a typed table maps every Library change command and read endpoint to the agent tool that does the same thing, or an allowed exemption. A new command without an entry fails typecheck; the test also checks each named tool is registered and listed in the Library plugin, requiressources:writefor change commands, and has the named input. The failure message says what to do.BuiltInPlugins.ts): the Library plugin listing was missing six tools the Sources toolkit registers (the four Zotero tools, import file, export). Added.scient_sources_checkgains an optionalrefreshinput: it refreshes the named Source from its registry (DOI or PMID) or from its PDF when it has neither, then re-checks it and reports the changed fields. It reuses the interface button's code (refreshAndCheckSourceMetadata), crediting the agent. Withrefreshabsent the tool is unchanged. This closed the parity table's last gap..scient/citations/style.jsonand.scient/citations/styles/<id>.csl, with the parent style's file when the style is a dependent one. Owner:apps/server/src/scient/sources/CitationStyles.ts.csl:> the project's style > the Settings style > Pandoc's default.packages/scient-citations/src/cslStyle.ts). citeproc-js reports neither fault itself.packages/scient-citations/CSL-NOTICEandthird-party-licenses.config.json.citationStylesonscient_sources_listsearches styles (read),citationStyleonscient_sources_bibliographysets or clears the project's style (write). The parity table has entries for both; no new tool.Agent context
scientAwarenessAllCapabilitiesBytes4,940 → 5,239 → 5,315 andcodexAdditionalContextAllCapabilitiesBytes10,518 → 10,817 → 10,893 (+299 each for the standing rules, +76 each for the B6 sentence). The tool list grows 110,355 → 110,523 (+168, therefreshinput with its warning that a refresh can overwrite manual edits) → 110,848 (+325, the two citation-style inputs). This needs theagent-context-increaselabel.Size
B4 adds about 736 KB to the server bundle and 35 KB to the web bundle (the bundled styles and the catalogue code).
Verification
apps/serverandapps/web; server budget tests,ScientAwareness.test.ts,ScientAgentCopy.test.ts(5 files, 20 tests); webaskLibrary.test.ts,sourcesWorkflow.test.ts(27 tests): pass. The budget test failed with exactly +299 before the budget file was updated.apps/servertypecheck; parity, registration and both budget tests (7 tests): pass. Negative controls: a removed table entry fails typecheck and the test with the required message; restoring the old plugin listing fails the test.apps/servertypecheck; parity, registration, handlers, coordinator and both budget tests (6 files, 45 tests): pass. Negative control: the budget test failed with exactly +168 before the budget file was updated. New DOI and PDF refresh tests use a recorded registry response and a generated PDF.apps/server,apps/web,packages/contracts,packages/client-runtime,packages/scient-citations; serverCitationStyles,WordFileExport, sourceshandlers,libraryParity,registration,writeAuthorizationand both budget tests (8 files, 52 tests); webSourceReference.browser.test.tsxandSourceDetails.test.tsx(12 tests);scient-citations(25 tests); command permissions (2 tests); licence notices (20 tests): pass. Server tests use recorded catalogue and style responses, no network.apps/servertypecheck;ScientAwareness, both budget tests,ScientAgentCopyand the Claude, Codex and Grok adapter tests (8 files, 586 tests): pass. Negative control: with the skills condition forced off, the awareness test fails. Live: the three plain requests of the pilot, run again on claude-sonnet-5-5, loaded the skill in 3 of 3 runs (0 of 3 before).BuiltInSkillReleases,ScientSkillSession,ScientSkillRegistry(3 files, 16 tests): pass. Live, the pilot's three check-only requests on claude-sonnet-5-5 with the shipped wording: noscient_paper_getcall, no project file changed, every page mention labelled (21 of 21, 10 of 10, 17 of 17). Before: 4 fetches and 2 files written in one run, 0 of 21 pages labelled. A first wording labelled pages in only 2 of 3 runs and was tightened.Documentation impact
Updated —
docs/user/sources.md,docs/internals/scient-sources.md.Model and harness
Implemented by Claude Opus 5.5 (Claude agent) and Claude Fable 5.2 (Droid), reviewed by Codex gpt-6.1-sol, orchestrated in Scient.
Not done
referencesskill off, the load call returns a clear "not available" error; whether every provider's agent then carries on was not traced.scient_paper_gethas no check-only mode.