From 13e4502e86ba98461d56508118bcc51682536d75 Mon Sep 17 00:00:00 2001 From: Sahasra Keerthi Kodiganti Date: Tue, 20 Oct 2026 17:16:17 +0530 Subject: [PATCH 1/2] fix(wiley-nexus): keep NexusWriter citations aligned with evidence numbers NexusWriter renumbered citations by first appearance in its own answer, so [n] in research_response.md did not match [n] in evidence_passages.md. - NexusWriter reuses each publication's evidence number, matches analysis files by DOI, keeps gaps, orders References by evidence number, and never reuses a number that belongs to another paper. - NexusSearch writes a "## Index" ([n] DOI - Title) at the top of evidence_passages.md so the writer sees every number even when a long file is only partly read; NexusWriter takes its numbers from it. - Task 1 asks for and validates the Index; Task 3 no longer asks for first-appearance numbering; the pipeline README lists the Index. --- agents/wiley-nexus/tasks/README.md | 2 +- agents/wiley-nexus/tasks/nexus-research-task.md | 5 +++-- agents/wiley-nexus/tasks/nexus-search-agent.md | 7 ++++++- agents/wiley-nexus/tasks/nexus-writer-agent.md | 6 +++--- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/agents/wiley-nexus/tasks/README.md b/agents/wiley-nexus/tasks/README.md index 121f7bfe..28a4ae41 100644 --- a/agents/wiley-nexus/tasks/README.md +++ b/agents/wiley-nexus/tasks/README.md @@ -42,7 +42,7 @@ the instructions. | File | Written by | Contents | | --- | --- | --- | -| `evidence_passages.md` | Task 1 | Every unique publication found, with its labeled metadata (DOI, authors, journal, full-text availability, Wiley Online Library link) and verbatim passages, plus a note on what each search angle covered. | +| `evidence_passages.md` | Task 1 | An index of every publication's citation number and DOI, then every unique publication found, with its labeled metadata (DOI, authors, journal, full-text availability, Wiley Online Library link) and verbatim passages, plus a note on what each search angle covered. | | `fulltext_shortlist.json` | Task 1 | The 3–5 papers most worth reading in full, each with its DOI, title, a one-line rationale, and its download token. | | `analysis_.json` | Task 2, one per shortlisted paper | That paper's status, contribution, key findings, methods, and limitations — or a status of `unavailable` with a reason if it could not be retrieved. | | `research_response.md` | Task 3 | **The deliverable** — a structured answer with IEEE-numbered citations linked to Wiley Online Library. | diff --git a/agents/wiley-nexus/tasks/nexus-research-task.md b/agents/wiley-nexus/tasks/nexus-research-task.md index d646ff9a..e710f7c9 100644 --- a/agents/wiley-nexus/tasks/nexus-research-task.md +++ b/agents/wiley-nexus/tasks/nexus-research-task.md @@ -27,7 +27,7 @@ Search Wiley Nexus from multiple distinct angles and build the evidence base tha Produce two files. -File 1 - evidence_passages.md (markdown). Open with a "## Search coverage" section containing one bullet per search angle, giving the query used, what it supported, and any facet that returned little or nothing. Then a "## Publications" section with one "### [n] Title" entry per unique publication, deduplicated by DOI, each carrying these labeled fields, using exactly these names: DOI, Authors, Journal, Full Text Available, Wiley Online Library. Under each entry, include that publication's passages quoted verbatim as blockquotes. +File 1 - evidence_passages.md (markdown). Open with a "## Index" section listing every publication on one line as "[n] DOI — Title", using the same numbers as the Publications section below. Then a "## Search coverage" section containing one bullet per search angle, giving the query used, what it supported, and any facet that returned little or nothing. Then a "## Publications" section with one "### [n] Title" entry per unique publication, deduplicated by DOI, each carrying these labeled fields, using exactly these names: DOI, Authors, Journal, Full Text Available, Wiley Online Library. Under each entry, include that publication's passages quoted verbatim as blockquotes. File 2 - fulltext_shortlist.json (JSON), of the form {"shortlist":[{"doi":"...","title":"...","rationale":"...","full_text_token":"..."}]}, listing the 3 to 5 publications most worth reading in full. Only shortlist papers whose search hit carried a full_text_token, and copy each token verbatim. @@ -42,6 +42,7 @@ In your reply, list every shortlisted paper's DOI and title, one per line. The n 3. evidence_passages.md includes a search coverage section that names each angle searched and flags any facet with little or no evidence. 4. fulltext_shortlist.json exists and contains 3 to 5 entries, each with a doi, a title, a rationale, and a non-empty full_text_token. 5. The task result text lists the DOI and title of every shortlisted paper. +6. evidence_passages.md opens with an Index that lists every publication's number and DOI, matching the "### [n]" entries. ``` --- @@ -100,7 +101,7 @@ Research question: {{RESEARCH_QUESTION}} The upstream tasks produced evidence_passages.md, containing passage-level evidence and metadata for every publication found, and one analysis file per shortlisted paper, marked unavailable if it could not be retrieved. The number of analysis files varies per run, so list the available resources and read every analysis file present rather than assuming a single one. Do not search or download anything; work only from these files. -Write research_response.md: a structured, chat-style answer to the research question, not a formal report. Lead with the direct answer in the first paragraph or two, then develop detail under headings, using a table where comparing studies or outcomes is clearer than prose. Cite in IEEE style, numbering sources in order of first appearance with bracketed inline markers tied to a "## References" list whose entries are built only from metadata in these files and linked to Wiley Online Library. Give more weight to findings from papers read in full than to passage-only evidence, state plainly what the retrieved literature does not establish, including any paper marked unavailable, and close with a one-line evidence basis. +Write research_response.md: a structured, chat-style answer to the research question, not a formal report. Lead with the direct answer in the first paragraph or two, then develop detail under headings, using a table where comparing studies or outcomes is clearer than prose. Cite in IEEE style, reusing each publication's number from the "### [n]" headings in evidence_passages.md (never renumbering by first appearance) as bracketed inline markers tied to a "## References" list whose entries are built only from metadata in these files and linked to Wiley Online Library. Give more weight to findings from papers read in full than to passage-only evidence, state plainly what the retrieved literature does not establish, including any paper marked unavailable, and close with a one-line evidence basis. ``` **Validation Criteria** diff --git a/agents/wiley-nexus/tasks/nexus-search-agent.md b/agents/wiley-nexus/tasks/nexus-search-agent.md index 827877fa..49ca3938 100644 --- a/agents/wiley-nexus/tasks/nexus-search-agent.md +++ b/agents/wiley-nexus/tasks/nexus-search-agent.md @@ -40,6 +40,11 @@ Persist both files with the data-handling tools, then list the shortlist in your ``` # Evidence — +## Index +- [1] — +- [2] <doi> — <Title> +- ... (one line per publication, same numbers as the Publications section) + ## Search coverage - **<angle>** — query: "<query text>" — coverage: <what it supported; note any facet that returned little or nothing> - ... (one bullet per angle) @@ -62,7 +67,7 @@ Passages: - ... (same fields) ``` -One `###` entry per UNIQUE publication (dedupe by DOI), numbered in listing order. Set **Full Text Available: Yes** when the hit carried a `full_text_token`. Quote passages verbatim under `>` blockquotes (trim obvious boilerplate, never paraphrase — downstream stages need the actual evidence). Record any thin/empty facet in the Search coverage bullets. +One `###` entry per UNIQUE publication (dedupe by DOI), numbered in listing order. The `## Index` at the top lists every publication's number, DOI and title in one line each, with exactly the same numbers as the `###` entries; keep it first, because downstream readers of a long file may only see its opening lines. Set **Full Text Available: Yes** when the hit carried a `full_text_token`. Quote passages verbatim under `>` blockquotes (trim obvious boilerplate, never paraphrase — downstream stages need the actual evidence). Record any thin/empty facet in the Search coverage bullets. **2. `fulltext_shortlist.json`** — the 3–5 publications MOST worth reading in full (most on-point and substantive; prefer complementary coverage over near-duplicates). This one stays **JSON** because the next stage parses it to pass each paper's token to a full-text analyzer. A JSON object: diff --git a/agents/wiley-nexus/tasks/nexus-writer-agent.md b/agents/wiley-nexus/tasks/nexus-writer-agent.md index d4b6c4a2..bc2a8c1d 100644 --- a/agents/wiley-nexus/tasks/nexus-writer-agent.md +++ b/agents/wiley-nexus/tasks/nexus-writer-agent.md @@ -17,7 +17,7 @@ The research question (plus any format or length constraints) arrives in the tas ## Method -1. **Source list first:** Collect every unique publication across the evidence file and the analyses — DOI, title, authors, journal, year, wol_link — and note for each whether it was read in full text (an `analysis_<doi>.json` with `status: "analyzed"`) or is supported by search passages only (present in `evidence_passages.md` but not analyzed, or analyzed as `"unavailable"`). That weighting runs through the whole answer. +1. **Source list first:** Collect every unique publication across the evidence file and the analyses — DOI, title, authors, journal, year, wol_link — and note for each whether it was read in full text (an `analysis_<doi>.json` with `status: "analyzed"`) or is supported by search passages only (present in `evidence_passages.md` but not analyzed, or analyzed as `"unavailable"`). That weighting runs through the whole answer. Before writing, take every publication's number and DOI from the `## Index` at the top of `evidence_passages.md` — it lists all of them, including entries near the end of a long file that a read may not reach. If the file has no Index, read the Publications section to the end and list every `### [n]` entry with its DOI instead. For each analysis file, find its DOI in that list (compare case-insensitively, ignoring any `https://doi.org/` prefix) and use that `[n]`. 2. **Themes from the evidence:** Group findings by facet of the research question, not paper by paper. Let the evidence set the structure; never impose sections the sources don't fill. @@ -29,11 +29,11 @@ Persist the finished answer as `research_response.md` and share it as the pipeli - Lead with the direct answer in the first paragraph or two — a reader who stops there should leave correctly informed. Scale the structure to the content: a focused question may need only a few paragraphs; a broader one takes ## headings for distinct facets. Use a markdown table to compare studies, methods, or outcomes; use lists where they are clearer than prose. -- Cite in IEEE style. Number sources in order of first appearance and mark each claim inline with its bracketed number — [1], [2], [3] — linking every marker to its matching entry in the reference list. +- Cite in IEEE style, reusing the numbers the search stage already assigned. Every publication in the Publications section of `evidence_passages.md` carries a number in its heading (`### [n] Title`) — cite that paper as [n] everywhere: inline and in the reference list. Match an analysis file to its number by DOI, using the list from step 1. Never renumber by order of first appearance in your own answer, and never give an evidence-file paper a different number. Only if a cited publication's DOI appears nowhere in `evidence_passages.md`, Index included, do you give it a new number, one greater than the highest `[n]` in that file — never reuse a number that already belongs to another evidence entry. Mark each claim inline with its bracketed number, linking every marker to its matching entry in the reference list. Because you cite only the papers you use, the numbers will not be consecutive (e.g. [2], [5], [9]) — that is expected and keeps the answer cross-checkable against the evidence; do not close the gaps. - Treat gaps as part of the answer: say plainly what the retrieved literature does not establish, which facets the search found thin, and which shortlisted papers could not be read in full (the analyses marked `unavailable`). -- End with a `## References` section — a numbered list matching the inline markers, each entry built only from the metadata in the pipeline files (authors, title, publication name, year, DOI) and linked to the paper via its `wol_link`; omit fields the files don't carry rather than inventing them, and note which references were read in full versus cited from a passage. Format each entry like: `[1] A. Author, B. Author, and C. Author, "Title of the paper," *Publication Name*, 2024, doi: 10.xxxx/xxxxx. [Wiley Online Library](wol_link)`. +- End with a `## References` section — a list matching the inline markers, ordered by those evidence-file numbers ascending, each entry built only from the metadata in the pipeline files (authors, title, publication name, year, DOI) and linked to the paper via its `wol_link`; omit fields the files don't carry rather than inventing them, and note which references were read in full versus cited from a passage. Format each entry like: `[1] A. Author, B. Author, and C. Author, "Title of the paper," *Publication Name*, 2024, doi: 10.xxxx/xxxxx. [Wiley Online Library](wol_link)`. - Close with one line on the evidence basis: how many publications the answer draws on, and which were read in full versus search passages only. From e4837081994ab05a3d7e4b8b9a2e88aa31b6dfe4 Mon Sep 17 00:00:00 2001 From: Sahasra Keerthi Kodiganti <skodiganti@wiley.com> Date: Wed, 21 Oct 2026 12:50:12 +0530 Subject: [PATCH 2/2] fix(wiley-nexus): give each paper missing from the evidence its own number Addresses review feedback: two cited publications absent from evidence_passages.md could both receive the same new number. Each now gets the next unused number above the evidence maximum, and keeps it for every citation. --- agents/wiley-nexus/tasks/nexus-writer-agent.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agents/wiley-nexus/tasks/nexus-writer-agent.md b/agents/wiley-nexus/tasks/nexus-writer-agent.md index bc2a8c1d..4cc6ad21 100644 --- a/agents/wiley-nexus/tasks/nexus-writer-agent.md +++ b/agents/wiley-nexus/tasks/nexus-writer-agent.md @@ -29,7 +29,7 @@ Persist the finished answer as `research_response.md` and share it as the pipeli - Lead with the direct answer in the first paragraph or two — a reader who stops there should leave correctly informed. Scale the structure to the content: a focused question may need only a few paragraphs; a broader one takes ## headings for distinct facets. Use a markdown table to compare studies, methods, or outcomes; use lists where they are clearer than prose. -- Cite in IEEE style, reusing the numbers the search stage already assigned. Every publication in the Publications section of `evidence_passages.md` carries a number in its heading (`### [n] Title`) — cite that paper as [n] everywhere: inline and in the reference list. Match an analysis file to its number by DOI, using the list from step 1. Never renumber by order of first appearance in your own answer, and never give an evidence-file paper a different number. Only if a cited publication's DOI appears nowhere in `evidence_passages.md`, Index included, do you give it a new number, one greater than the highest `[n]` in that file — never reuse a number that already belongs to another evidence entry. Mark each claim inline with its bracketed number, linking every marker to its matching entry in the reference list. Because you cite only the papers you use, the numbers will not be consecutive (e.g. [2], [5], [9]) — that is expected and keeps the answer cross-checkable against the evidence; do not close the gaps. +- Cite in IEEE style, reusing the numbers the search stage already assigned. Every publication in the Publications section of `evidence_passages.md` carries a number in its heading (`### [n] Title`) — cite that paper as [n] everywhere: inline and in the reference list. Match an analysis file to its number by DOI, using the list from step 1. Never renumber by order of first appearance in your own answer, and never give an evidence-file paper a different number. Only if a cited publication's DOI appears nowhere in `evidence_passages.md`, Index included, do you give it a new number: the first such publication gets one greater than the highest `[n]` in that file, the next gets the number after that, and so on. Never reuse a number that already belongs to an evidence entry or to another newly numbered publication. Add each new number to your list from step 1 with its DOI, and use that same number every time the publication is cited. Mark each claim inline with its bracketed number, linking every marker to its matching entry in the reference list. Because you cite only the papers you use, the numbers will not be consecutive (e.g. [2], [5], [9]) — that is expected and keeps the answer cross-checkable against the evidence; do not close the gaps. - Treat gaps as part of the answer: say plainly what the retrieved literature does not establish, which facets the search found thin, and which shortlisted papers could not be read in full (the analyses marked `unavailable`).