Skip to content

Commit c278bbd

Browse files
authored
add asta literature interactive: stateful multi-turn paper-finder via A2A (#52)
1 parent 08c0d8b commit c278bbd

20 files changed

Lines changed: 2664 additions & 654 deletions

File tree

plugins/asta-preview/skills/find-literature/SKILL.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ metadata:
55
internal: true
66
allowed-tools:
77
- Bash(asta literature find *)
8+
- Bash(asta literature interactive *)
89
- Bash(asta papers *)
910
- TaskOutput
1011
- Bash(jq *)
@@ -17,6 +18,65 @@ Search academic literature for papers relevant to a query. The search will retur
1718
This is an advanced search, so the query can be long and complex. You may ask the user
1819
questions to clarify the topic and refine the query before running the search.
1920

21+
## Choosing `find` vs `interactive`
22+
23+
Two entry points are available. Both run the same retrieval pipeline (criteria extraction,
24+
candidate retrieval, re-ranking). The significant difference is what happens around that
25+
pipeline — and the right choice is mostly driven by **what the session as a whole is about**,
26+
not by the complexity of any single query:
27+
28+
- **`asta literature interactive`** — default for literature-focused sessions. Use it when the
29+
**first interaction** in the session is about literature search or exploration, or when the
30+
**entire session** is focused on literature. It runs the full Asta paper-finder agent: better
31+
planning for complex or multi-faceted queries (decomposition, iterative search strategies) and
32+
a reasoning / results-verification loop that can re-run or refine the search when the initial
33+
results don't satisfy the criteria. It also maintains conversation state via a `thread_id`, so
34+
follow-ups can build on prior results: filtering ("now narrow to surveys from 2023+"),
35+
aggregating ("group by venue"), following relations ("expand on the third paper's citations"),
36+
or iterative refinement.
37+
38+
- **`asta literature find`** — one attempt, no agent loop. Use it primarily when literature
39+
search is **a sub-step inside some other multi-step flow** (data analysis, code generation,
40+
a broader research workflow, etc.) where the same flow may issue many unrelated searches and
41+
the latency of the full agent loop is not worth it for each one. Lower quality, much faster.
42+
Don't reach for `find` just because a single query "looks simple" — if the session is
43+
literature-centered, prefer `interactive`.
44+
45+
**Continuing a conversation — recommended pattern (`--thread-dir`):** for any
46+
multi-turn search session, pick a directory named `.asta/literature/threads/<YYYY-MM-DD>-<slug>/`
47+
(date-prefixed slug, matching the convention used by other agents) and pass it
48+
on every turn. The CLI auto-resumes the conversation, writes one artifact per
49+
turn with a `.NNN` index suffix, and maintains a `DIR/index.json` that records
50+
turn order, queries, narratives, paper counts, and the `thread_id`. Use a
51+
meaningful `-o` basename per turn — the CLI inserts the turn index for you.
52+
53+
```bash
54+
# Turn 1 — picks a thread dir; CLI creates DIR/index.json and DIR/transformer-survey.001.json
55+
asta literature interactive "transformer architecture survey" \
56+
--thread-dir .asta/literature/threads/2026-05-04-transformer-architectures \
57+
-o transformer-survey.json
58+
59+
# Turn 2 — same dir; thread_id auto-resumes from index.json.
60+
# Writes DIR/narrow-2023.002.json and appends a turn entry to DIR/index.json.
61+
asta literature interactive "narrow to 2023+ long-context surveys" \
62+
--thread-dir .asta/literature/threads/2026-05-04-transformer-architectures \
63+
-o narrow-2023.json
64+
```
65+
66+
Start a fresh conversation when the topic shifts substantially: pick a new
67+
`--thread-dir`. Reading the conversation back is straightforward — `jq` over
68+
`DIR/index.json` for the turn list, then open the per-turn JSON files referenced
69+
by `turns[].file`.
70+
71+
Without `--thread-dir`, an invocation is a one-shot turn that doesn't continue
72+
any prior conversation. Use that for ad-hoc single queries; for any multi-turn
73+
session, always pass `--thread-dir`.
74+
75+
Output deltas vs `find`: the `interactive` JSON adds `thread_id` and `narrative`
76+
(the agent's terminal response text). It does not currently populate
77+
`citationContexts` or `publicationDate` per paper; for those, use `find` or the
78+
`asta papers` commands.
79+
2080
## Installation
2181

2282
This skill requires the `asta` CLI:

plugins/asta-preview/skills/semantic-scholar/SKILL.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,43 @@ allowed-tools:
2020

2121
**Not for comprehensive reports** - use the Literature Report Generation skill for that.
2222

23+
## Related: Find Literature skill
24+
25+
`asta papers ...` (this skill) is for **mechanical, targeted lookups** against the Semantic
26+
Scholar API: fetch a known paper, list citations, search by keyword across titles / abstracts /
27+
bodies, look up an author. There is no agent-mediated reasoning beyond S2's own keyword ranking.
28+
29+
The **Find Literature skill** (`asta literature find` / `asta literature interactive`) is for
30+
**topic-driven, criterion-based search**, where the system extracts relevance criteria from the
31+
query, retrieves candidates, and ranks them against those criteria with per-paper relevance
32+
summaries — closer to "literature search as a graded judgement" than to a keyword match.
33+
34+
Use **this** skill (`asta papers`) when:
35+
36+
- The user names a specific paper, author, ID, or exact phrase to look up
37+
- You need raw metadata (citations, venue, fields of study, openAccessInfo)
38+
- You're navigating a citation graph (who cites what, who an author has cited)
39+
- You want to grep for a specific string in paper bodies (`snippet-search`)
40+
- You need a fast result and exhaustive coverage isn't required
41+
42+
Use the **Find Literature** skill instead when:
43+
44+
- The user asks "find papers on X", "what does the literature say about Y", "papers that argue Z"
45+
- The query is a research topic, not a string match — and ranked relevance with explanations matters
46+
- The work session is exploratory: filtering prior results, aggregating, following relations across
47+
multiple turns (use `asta literature interactive --thread-dir <dir>`)
48+
- A `find`-style one-shot or `interactive`-style multi-turn agent loop with verification will
49+
produce a better-ranked result than raw keyword search
50+
51+
The two are complementary. A common flow: use Find Literature to discover relevant papers on a
52+
topic, then `asta papers get` / `asta papers citations` to drill into specific ones.
53+
54+
**Session-level rule of thumb:** if the session as a whole is about literature
55+
search/exploration (e.g. the first user turn is "find papers on X"), default to
56+
`asta literature interactive` for the discovery work, even when individual queries look simple.
57+
Reach for `asta papers` when the session is about something else and a quick metadata or
58+
citation lookup is just one step inside it.
59+
2360
## Installation
2461

2562
This skill requires the `asta` CLI:

plugins/asta/skills/semantic-scholar/SKILL.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,43 @@ allowed-tools:
2020

2121
**Not for comprehensive reports** - use the Literature Report Generation skill for that.
2222

23+
## Related: Find Literature skill
24+
25+
`asta papers ...` (this skill) is for **mechanical, targeted lookups** against the Semantic
26+
Scholar API: fetch a known paper, list citations, search by keyword across titles / abstracts /
27+
bodies, look up an author. There is no agent-mediated reasoning beyond S2's own keyword ranking.
28+
29+
The **Find Literature skill** (`asta literature find` / `asta literature interactive`) is for
30+
**topic-driven, criterion-based search**, where the system extracts relevance criteria from the
31+
query, retrieves candidates, and ranks them against those criteria with per-paper relevance
32+
summaries — closer to "literature search as a graded judgement" than to a keyword match.
33+
34+
Use **this** skill (`asta papers`) when:
35+
36+
- The user names a specific paper, author, ID, or exact phrase to look up
37+
- You need raw metadata (citations, venue, fields of study, openAccessInfo)
38+
- You're navigating a citation graph (who cites what, who an author has cited)
39+
- You want to grep for a specific string in paper bodies (`snippet-search`)
40+
- You need a fast result and exhaustive coverage isn't required
41+
42+
Use the **Find Literature** skill instead when:
43+
44+
- The user asks "find papers on X", "what does the literature say about Y", "papers that argue Z"
45+
- The query is a research topic, not a string match — and ranked relevance with explanations matters
46+
- The work session is exploratory: filtering prior results, aggregating, following relations across
47+
multiple turns (use `asta literature interactive --thread-dir <dir>`)
48+
- A `find`-style one-shot or `interactive`-style multi-turn agent loop with verification will
49+
produce a better-ranked result than raw keyword search
50+
51+
The two are complementary. A common flow: use Find Literature to discover relevant papers on a
52+
topic, then `asta papers get` / `asta papers citations` to drill into specific ones.
53+
54+
**Session-level rule of thumb:** if the session as a whole is about literature
55+
search/exploration (e.g. the first user turn is "find papers on X"), default to
56+
`asta literature interactive` for the discovery work, even when individual queries look simple.
57+
Reach for `asta papers` when the session is about something else and a quick metadata or
58+
citation lookup is just one step inside it.
59+
2360
## Installation
2461

2562
This skill requires the `asta` CLI:

skills/find-literature/SKILL.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ metadata:
55
internal: true
66
allowed-tools:
77
- Bash(asta literature find *)
8+
- Bash(asta literature interactive *)
89
- Bash(asta papers *)
910
- TaskOutput
1011
- Bash(jq *)
@@ -17,6 +18,65 @@ Search academic literature for papers relevant to a query. The search will retur
1718
This is an advanced search, so the query can be long and complex. You may ask the user
1819
questions to clarify the topic and refine the query before running the search.
1920

21+
## Choosing `find` vs `interactive`
22+
23+
Two entry points are available. Both run the same retrieval pipeline (criteria extraction,
24+
candidate retrieval, re-ranking). The significant difference is what happens around that
25+
pipeline — and the right choice is mostly driven by **what the session as a whole is about**,
26+
not by the complexity of any single query:
27+
28+
- **`asta literature interactive`** — default for literature-focused sessions. Use it when the
29+
**first interaction** in the session is about literature search or exploration, or when the
30+
**entire session** is focused on literature. It runs the full Asta paper-finder agent: better
31+
planning for complex or multi-faceted queries (decomposition, iterative search strategies) and
32+
a reasoning / results-verification loop that can re-run or refine the search when the initial
33+
results don't satisfy the criteria. It also maintains conversation state via a `thread_id`, so
34+
follow-ups can build on prior results: filtering ("now narrow to surveys from 2023+"),
35+
aggregating ("group by venue"), following relations ("expand on the third paper's citations"),
36+
or iterative refinement.
37+
38+
- **`asta literature find`** — one attempt, no agent loop. Use it primarily when literature
39+
search is **a sub-step inside some other multi-step flow** (data analysis, code generation,
40+
a broader research workflow, etc.) where the same flow may issue many unrelated searches and
41+
the latency of the full agent loop is not worth it for each one. Lower quality, much faster.
42+
Don't reach for `find` just because a single query "looks simple" — if the session is
43+
literature-centered, prefer `interactive`.
44+
45+
**Continuing a conversation — recommended pattern (`--thread-dir`):** for any
46+
multi-turn search session, pick a directory named `.asta/literature/threads/<YYYY-MM-DD>-<slug>/`
47+
(date-prefixed slug, matching the convention used by other agents) and pass it
48+
on every turn. The CLI auto-resumes the conversation, writes one artifact per
49+
turn with a `.NNN` index suffix, and maintains a `DIR/index.json` that records
50+
turn order, queries, narratives, paper counts, and the `thread_id`. Use a
51+
meaningful `-o` basename per turn — the CLI inserts the turn index for you.
52+
53+
```bash
54+
# Turn 1 — picks a thread dir; CLI creates DIR/index.json and DIR/transformer-survey.001.json
55+
asta literature interactive "transformer architecture survey" \
56+
--thread-dir .asta/literature/threads/2026-05-04-transformer-architectures \
57+
-o transformer-survey.json
58+
59+
# Turn 2 — same dir; thread_id auto-resumes from index.json.
60+
# Writes DIR/narrow-2023.002.json and appends a turn entry to DIR/index.json.
61+
asta literature interactive "narrow to 2023+ long-context surveys" \
62+
--thread-dir .asta/literature/threads/2026-05-04-transformer-architectures \
63+
-o narrow-2023.json
64+
```
65+
66+
Start a fresh conversation when the topic shifts substantially: pick a new
67+
`--thread-dir`. Reading the conversation back is straightforward — `jq` over
68+
`DIR/index.json` for the turn list, then open the per-turn JSON files referenced
69+
by `turns[].file`.
70+
71+
Without `--thread-dir`, an invocation is a one-shot turn that doesn't continue
72+
any prior conversation. Use that for ad-hoc single queries; for any multi-turn
73+
session, always pass `--thread-dir`.
74+
75+
Output deltas vs `find`: the `interactive` JSON adds `thread_id` and `narrative`
76+
(the agent's terminal response text). It does not currently populate
77+
`citationContexts` or `publicationDate` per paper; for those, use `find` or the
78+
`asta papers` commands.
79+
2080
## Installation
2181

2282
This skill requires the `asta` CLI:

skills/semantic-scholar/SKILL.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,43 @@ allowed-tools:
2020

2121
**Not for comprehensive reports** - use the Literature Report Generation skill for that.
2222

23+
## Related: Find Literature skill
24+
25+
`asta papers ...` (this skill) is for **mechanical, targeted lookups** against the Semantic
26+
Scholar API: fetch a known paper, list citations, search by keyword across titles / abstracts /
27+
bodies, look up an author. There is no agent-mediated reasoning beyond S2's own keyword ranking.
28+
29+
The **Find Literature skill** (`asta literature find` / `asta literature interactive`) is for
30+
**topic-driven, criterion-based search**, where the system extracts relevance criteria from the
31+
query, retrieves candidates, and ranks them against those criteria with per-paper relevance
32+
summaries — closer to "literature search as a graded judgement" than to a keyword match.
33+
34+
Use **this** skill (`asta papers`) when:
35+
36+
- The user names a specific paper, author, ID, or exact phrase to look up
37+
- You need raw metadata (citations, venue, fields of study, openAccessInfo)
38+
- You're navigating a citation graph (who cites what, who an author has cited)
39+
- You want to grep for a specific string in paper bodies (`snippet-search`)
40+
- You need a fast result and exhaustive coverage isn't required
41+
42+
Use the **Find Literature** skill instead when:
43+
44+
- The user asks "find papers on X", "what does the literature say about Y", "papers that argue Z"
45+
- The query is a research topic, not a string match — and ranked relevance with explanations matters
46+
- The work session is exploratory: filtering prior results, aggregating, following relations across
47+
multiple turns (use `asta literature interactive --thread-dir <dir>`)
48+
- A `find`-style one-shot or `interactive`-style multi-turn agent loop with verification will
49+
produce a better-ranked result than raw keyword search
50+
51+
The two are complementary. A common flow: use Find Literature to discover relevant papers on a
52+
topic, then `asta papers get` / `asta papers citations` to drill into specific ones.
53+
54+
**Session-level rule of thumb:** if the session as a whole is about literature
55+
search/exploration (e.g. the first user turn is "find papers on X"), default to
56+
`asta literature interactive` for the discovery work, even when individual queries look simple.
57+
Reach for `asta papers` when the session is about something else and a quick metadata or
58+
citation lookup is just one step inside it.
59+
2360
## Installation
2461

2562
This skill requires the `asta` CLI:

src/asta/cli.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from asta.documents import documents
1111
from asta.experiment import experiment
1212
from asta.literature.find import find
13+
from asta.literature.interactive import interactive
1314
from asta.papers.author import author
1415
from asta.papers.citations import citations
1516
from asta.papers.get import get
@@ -61,6 +62,7 @@ def papers():
6162

6263
# Register literature subcommands
6364
literature.add_command(find)
65+
literature.add_command(interactive)
6466

6567
# Register papers subcommands
6668
papers.add_command(get)

0 commit comments

Comments
 (0)