wtf-p 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,184 @@
1
+ const https = require('https');
2
+ const querystring = require('querystring');
3
+
4
+ /**
5
+ * Semantic Scholar API Wrapper
6
+ *
7
+ * Provides search and lookup capabilities for Semantic Scholar Graph API v1.
8
+ * Handles rate limiting with exponential backoff.
9
+ *
10
+ * Env:
11
+ * - S2_API_KEY: Optional API key for higher rate limits.
12
+ */
13
+
14
+ const API_KEY = process.env.S2_API_KEY;
15
+ const BASE_HOST = 'api.semanticscholar.org';
16
+ const BASE_PATH = '/graph/v1';
17
+
18
+ const RETRY_CONFIG = {
19
+ maxRetries: 5,
20
+ baseDelay: 1000,
21
+ maxDelay: 16000
22
+ };
23
+
24
+ class SemanticScholarError extends Error {
25
+ constructor(message, statusCode, retryAfter) {
26
+ super(message);
27
+ this.name = 'SemanticScholarError';
28
+ this.statusCode = statusCode;
29
+ this.retryAfter = retryAfter;
30
+ }
31
+ }
32
+
33
+ /**
34
+ * Sleep helper
35
+ */
36
+ const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
37
+
38
+ /**
39
+ * Make an HTTP request with retry logic
40
+ */
41
+ async function request(endpoint, params = {}) {
42
+ const query = querystring.stringify(params);
43
+ const path = `${BASE_PATH}${endpoint}?${query}`;
44
+
45
+ let attempt = 0;
46
+
47
+ while (attempt <= RETRY_CONFIG.maxRetries) {
48
+ try {
49
+ return await doRequest(path);
50
+ } catch (error) {
51
+ if (error instanceof SemanticScholarError && error.statusCode === 429) {
52
+ attempt++;
53
+ if (attempt > RETRY_CONFIG.maxRetries) throw error;
54
+
55
+ // Use Retry-After header if available, else exponential backoff
56
+ const delay = error.retryAfter
57
+ ? parseInt(error.retryAfter, 10) * 1000
58
+ : Math.min(RETRY_CONFIG.maxDelay, RETRY_CONFIG.baseDelay * Math.pow(2, attempt - 1));
59
+
60
+ // console.error(`[S2] Rate limited. Retrying in ${delay}ms...`);
61
+ await sleep(delay);
62
+ continue;
63
+ }
64
+ throw error;
65
+ }
66
+ }
67
+ }
68
+
69
+ function doRequest(path) {
70
+ return new Promise((resolve, reject) => {
71
+ const options = {
72
+ hostname: BASE_HOST,
73
+ path: path,
74
+ method: 'GET',
75
+ headers: {
76
+ 'User-Agent': 'WTF-P/0.4.0 (citation-expert)',
77
+ }
78
+ };
79
+
80
+ if (API_KEY) {
81
+ options.headers['x-api-key'] = API_KEY;
82
+ }
83
+
84
+ const req = https.request(options, (res) => {
85
+ let data = '';
86
+
87
+ res.on('data', (chunk) => data += chunk);
88
+
89
+ res.on('end', () => {
90
+ if (res.statusCode === 429) {
91
+ const retryAfter = res.headers['retry-after'];
92
+ return reject(new SemanticScholarError('Rate limit exceeded', 429, retryAfter));
93
+ }
94
+
95
+ if (res.statusCode >= 400) {
96
+ return reject(new SemanticScholarError(`API Error: ${res.statusCode} ${data}`, res.statusCode));
97
+ }
98
+
99
+ try {
100
+ const json = JSON.parse(data);
101
+ resolve(json);
102
+ } catch (e) {
103
+ reject(new Error(`Failed to parse response: ${e.message}`));
104
+ }
105
+ });
106
+ });
107
+
108
+ req.on('error', (e) => reject(new Error(`Request failed: ${e.message}`)));
109
+ req.on('timeout', () => {
110
+ req.destroy();
111
+ reject(new Error('Request timed out'));
112
+ });
113
+
114
+ // Set a reasonable timeout (10s)
115
+ req.setTimeout(10000);
116
+ req.end();
117
+ });
118
+ }
119
+
120
+ /**
121
+ * Search for papers
122
+ * @param {string} query
123
+ * @param {Object} options
124
+ */
125
+ async function search(query, options = {}) {
126
+ const limit = Math.min(options.limit || 10, 100);
127
+ const fields = options.fields || [
128
+ 'paperId', 'externalIds', 'title', 'abstract', 'venue', 'year',
129
+ 'citationCount', 'influentialCitationCount', 'authors',
130
+ 'publicationTypes', 'openAccessPdf'
131
+ ];
132
+
133
+ const params = {
134
+ query,
135
+ limit,
136
+ fields: fields.join(',')
137
+ };
138
+
139
+ if (options.year) params.year = options.year;
140
+
141
+ const response = await request('/paper/search', params);
142
+ return response.data || [];
143
+ }
144
+
145
+ /**
146
+ * Get paper by ID
147
+ * @param {string} id - S2 PaperId, DOI, ArXivId, etc.
148
+ * @param {string[]} fields
149
+ */
150
+ async function getPaper(id, fields = []) {
151
+ const defaultFields = [
152
+ 'paperId', 'externalIds', 'title', 'abstract', 'venue', 'year',
153
+ 'citationCount', 'influentialCitationCount', 'authors',
154
+ 'publicationTypes', 'openAccessPdf'
155
+ ];
156
+
157
+ const params = {
158
+ fields: (fields.length > 0 ? fields : defaultFields).join(',')
159
+ };
160
+
161
+ return await request(`/paper/${id}`, params);
162
+ }
163
+
164
+ /**
165
+ * Get citations for a paper
166
+ * @param {string} paperId
167
+ * @param {number} limit
168
+ */
169
+ async function getCitations(paperId, limit = 20) {
170
+ const params = {
171
+ limit,
172
+ fields: 'title,year,citationCount,authors' // Minimal fields for citations
173
+ };
174
+
175
+ const response = await request(`/paper/${paperId}/citations`, params);
176
+ return response.data || [];
177
+ }
178
+
179
+ module.exports = {
180
+ search,
181
+ getPaper,
182
+ getCitations,
183
+ SemanticScholarError
184
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wtf-p",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "The G.O.A.T. meta-prompting system for 10x researchers who need to submit papers and projects and proposals YESTERDAY.",
5
5
  "bin": {
6
6
  "wtfp": "bin/install.js",
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: citation-expert
3
+ description: Academic citation specialist. Searches papers, manages BibTeX, and identifies literature gaps.
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ ---
9
+
10
+ # Citation Expert
11
+
12
+ You are a senior academic librarian and bibliometric specialist. Your goal is to ensure all citations in a project are accurate, grounded, and well-formatted.
13
+
14
+ ## Tools
15
+ You have access to specialized CLI tools for citation management:
16
+
17
+ 1. **Retrieval:** `node ~/.claude/bin/citation-fetcher.js "<query>"`
18
+ - Use this to find new papers and get their BibTeX.
19
+ - Source: CrossRef / Semantic Scholar.
20
+
21
+ 2. **Bibliography Management:** `node ~/.claude/bin/bib-index.js <command> ...`
22
+ - `index <file>`: List all keys in a bib file.
23
+ - `get <file> <key>`: Read a specific entry.
24
+ - `search <file> <query>`: Find entries by keyword.
25
+
26
+ ## Capabilities
27
+
28
+ 1. **Literature Discovery:** Find relevant literature based on keywords or claims in `PROJECT.md`.
29
+ 2. **Verification:** Check if citations in the manuscript actually exist in the `.bib` file.
30
+ 3. **Formatting:** Ensure BibTeX entries follow standard conventions.
31
+ 4. **Gap Analysis:** Compare current citations against the core argument.
32
+
33
+ ## Principles
34
+
35
+ - **Precision Over Recall:** Prefer a few highly relevant citations.
36
+ - **No Direct Writes:** NEVER overwrite the user's `references.bib`. Always create a `suggested.bib` or provide the BibTeX in the chat.
37
+ - **Grounding:** Always check the `PROJECT.md` context.
38
+ - **Deterministic:** Use the provided tools to verify facts. Do not hallucinate citations.
39
+
40
+ ## Workflow
41
+
42
+ 1. **Analyze:** Understand the user's need (search vs. fix).
43
+ 2. **Execute:** Use the appropriate script.
44
+ 3. **Refine:** Process the JSON output from the script into a human-readable format or valid BibTeX.
45
+ 4. **Report:** Present findings or suggested changes.
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: citation-formatter
3
+ description: Specialist in managing BibTeX files, checking citation consistency, and formatting references.
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ ---
9
+
10
+ # Citation Formatter
11
+
12
+ You are a bibliometric quality assurance specialist. Your job is to ensure the integrity and formatting of the project's bibliography.
13
+
14
+ ## Tools
15
+ You have access to the Bibliography Indexer:
16
+ - `node ~/.claude/bin/bib-index.js index <file>`: List all keys.
17
+ - `node ~/.claude/bin/bib-index.js get <file> <key>`: Get full BibTeX for a key.
18
+ - `node ~/.claude/bin/bib-index.js search <file> <query>`: Find entries.
19
+
20
+ ## Core Responsibilities
21
+
22
+ 1. **Validation:** Check if citations in the text (e.g., `\cite{foo}`) actually exist in the `.bib` file.
23
+ 2. **Formatting:** detailed formatting of BibTeX entries (e.g., ensuring curly braces around titles to preserve capitalization).
24
+ 3. **Deduplication:** Identify potential duplicate entries.
25
+
26
+ ## Critical Rules
27
+
28
+ 1. **Read-Only on Source:** You must **NEVER** overwrite the user's primary `.bib` file (usually `references.bib`).
29
+ 2. **Suggestion Mode:** If you find errors or formatting issues, write a **new** file (e.g., `references_suggested.bib`) or output the corrected BibTeX in the chat.
30
+ 3. **Deterministic:** Rely on the `bib-index.js` tool to verify existence. Do not guess.
31
+
32
+ ## Common Workflows
33
+
34
+ - **"Check references":**
35
+ 1. Read the latex/markdown files to find citations.
36
+ 2. Index the `.bib` file.
37
+ 3. Cross-reference and report missing keys.
38
+
39
+ - **"Fix formatting":**
40
+ 1. Read the entry using `get`.
41
+ 2. Apply formatting rules (e.g., standardizing conference names).
42
+ 3. Output the corrected block.
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: citation-retriever
3
+ description: Specialist in finding academic literature and generating BibTeX.
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ ---
8
+
9
+ # Citation Retriever
10
+
11
+ You are an expert at discovering academic literature. Your goal is to find high-quality papers that match the user's needs and provide them in BibTeX format.
12
+
13
+ ## Tools
14
+ You have access to a custom search tool via the command line:
15
+ `node ~/.claude/bin/citation-fetcher.js "<query>"`
16
+
17
+ This tool queries academic databases (like CrossRef) and returns a JSON list of papers, including a draft BibTeX entry.
18
+
19
+ ## Workflow
20
+ 1. **Analyze Request:** Understand what the user is looking for.
21
+ 2. **Contextualize:** If needed, read `.planning/PROJECT.md` to understand the broader research context.
22
+ 3. **Search:** Run the fetcher script with specific keywords.
23
+ 4. **Present:** Output the results. If the user asks for BibTeX, provide the entries generated by the tool.
24
+
25
+ ## Rules
26
+ - **No Hallucinations:** Only provide citations returned by the tool.
27
+ - **Verification:** If the tool returns no results, try broader keywords. Do not invent papers.
28
+ - **Output:** When presenting BibTeX, use a code block:
29
+ ```bibtex
30
+ @article{...}
31
+ ```
@@ -43,60 +43,51 @@ BibTeX file: $ARGUMENTS (optional - auto-detects .bib files if not provided)
43
43
  find . -name "*.bib" -type f 2>/dev/null | grep -v node_modules | grep -v .git | head -10
44
44
  ```
45
45
 
46
- If multiple found, use AskUserQuestion:
47
- - header: "BibTeX"
48
- - question: "Which bibliography file should I analyze?"
49
- - options: [list found files] + "Analyze all"
46
+ If multiple found, use AskUserQuestion.
47
+ If none found, exit with error.
48
+ </step>
50
49
 
51
- If none found:
52
- ```
53
- No .bib file found.
50
+ <step name="parse_entries">
51
+ **Parse BibTeX Index:**
52
+
53
+ Use the specialized indexer tool to get a structured JSON summary of the bibliography. This handles large files efficiently.
54
54
 
55
- Either:
56
- 1. Add your .bib file to the project
57
- 2. Specify path: /wtfp:analyze-bib path/to/refs.bib
55
+ ```bash
56
+ # Index the bibliography (returns JSON)
57
+ node ~/.claude/bin/bib-index.js index "$ARGUMENTS"
58
58
  ```
59
- Exit command.
59
+ *(If $ARGUMENTS is empty, use the file found in previous step)*
60
60
 
61
61
  </step>
62
62
 
63
- <step name="parse_entries">
64
- **Parse all BibTeX entries:**
63
+ <step name="impact_analysis">
64
+ **Impact Analysis:**
65
65
 
66
- Extract from each entry:
67
- - Citation key
68
- - Type (@article, @inproceedings, @book, etc.)
69
- - Authors
70
- - Title
71
- - Year
72
- - Venue (journal/booktitle)
73
- - Abstract (if present)
74
- - Keywords (if present)
66
+ Analyze citation metrics (citations, velocity, age) to identify seminal and rising papers.
75
67
 
76
- Build structured inventory of all references.
68
+ ```bash
69
+ node ~/.claude/bin/analyze-impact.js "$ARGUMENTS"
70
+ ```
71
+
72
+ Output sections:
73
+ 1. **Seminal Works** (>1000 citations)
74
+ 2. **Rising Stars** (High citation velocity)
75
+ 3. **Review Suggested** (Old, low impact)
77
76
 
78
77
  </step>
79
78
 
80
79
  <step name="temporal_analysis">
81
80
  **Temporal Analysis:**
82
81
 
83
- Categorize by publication year:
84
- - **Foundational** (10+ years old): Seminal works, established theory
85
- - **Established** (5-10 years): Mature approaches, proven methods
86
- - **Recent** (2-5 years): Current state of the art
87
- - **Cutting edge** (<2 years): Latest developments, concurrent work
82
+ Analyze the JSON output from the parse_entries step.
88
83
 
89
- ```markdown
90
- ## Temporal Distribution
91
-
92
- | Era | Count | Examples |
93
- |-----|-------|----------|
94
- | Foundational (pre-2015) | [N] | [key1], [key2] |
95
- | Established (2015-2019) | [N] | [key3], [key4] |
96
- | Recent (2020-2023) | [N] | [key5], [key6] |
97
- | Cutting edge (2024+) | [N] | [key7], [key8] |
98
- ```
84
+ Categorize entries by the `year` field in the JSON:
85
+ - **Foundational** (10+ years old)
86
+ - **Established** (5-10 years)
87
+ - **Recent** (2-5 years)
88
+ - **Cutting edge** (<2 years)
99
89
 
90
+ Produce the "Temporal Distribution" table based on these counts.
100
91
  </step>
101
92
 
102
93
  <step name="cluster_topics">
@@ -125,21 +116,16 @@ Analyze titles, abstracts, and keywords to cluster papers by theme:
125
116
  </step>
126
117
 
127
118
  <step name="identify_seminal">
128
- **Identify Seminal Works:**
119
+ **Verify Seminal Works:**
129
120
 
130
- Flag likely seminal papers based on:
131
- - High citation count (if DOI available, could fetch)
132
- - Foundational publication year
133
- - Appears in prestigious venue
134
- - Authors are field leaders
135
- - Title suggests foundational contribution
121
+ Review the "Seminal Works" list from the Impact Analysis step.
136
122
 
137
123
  ```markdown
138
- ## Seminal Works (Must Cite)
124
+ ## Seminal Works (Verified High Impact)
139
125
 
140
- | Key | Title | Why Seminal |
141
- |-----|-------|-------------|
142
- | [key] | [title] | [reason: foundational method, influential framework, etc.] |
126
+ | Key | Title | Citations | Why Seminal |
127
+ |-----|-------|-----------|-------------|
128
+ | [key] | [title] | [N] | [reason] |
143
129
  ```
144
130
 
145
131
  Use AskUserQuestion:
@@ -233,15 +219,18 @@ Write to `.planning/sources/REFS.md`:
233
219
  **Total entries:** [N]
234
220
  **Analysis date:** [date]
235
221
 
222
+ ## Impact Analysis
223
+ [From impact_analysis step]
224
+ - Seminal Works (>1000 citations)
225
+ - Rising Stars (High Velocity)
226
+ - Review Suggested (Low Impact/Old)
227
+
236
228
  ## Temporal Distribution
237
229
  [From temporal_analysis step]
238
230
 
239
231
  ## Topic Clusters
240
232
  [From cluster_topics step]
241
233
 
242
- ## Seminal Works
243
- [From identify_seminal step]
244
-
245
234
  ## Citation Map by Section
246
235
  [From map_to_sections step]
247
236
 
@@ -55,16 +55,18 @@ Create one or specify path: /wtfp:check-refs path/to/refs.bib
55
55
  </step>
56
56
 
57
57
  <step name="parse_bib">
58
- **Extract all BibTeX keys:**
58
+ **Extract BibTeX Keys:**
59
+
60
+ Use the deterministic indexer to get an accurate list of keys from the .bib file.
59
61
 
60
62
  ```bash
61
- grep -E "^@[a-zA-Z]+\{" *.bib | sed 's/.*{\([^,]*\),.*/\1/'
63
+ node ~/.claude/bin/bib-index.js index "$ARGUMENTS"
62
64
  ```
65
+ *(Use the file found/selected in step 1)*
63
66
 
64
- Build inventory:
67
+ Build inventory from the JSON output:
65
68
  - Entry key
66
- - Entry type (@article, @inproceedings, etc.)
67
- - Required fields present/missing
69
+ - Title
68
70
  - Year
69
71
  </step>
70
72
 
@@ -133,10 +135,10 @@ Use AskUserQuestion:
133
135
  - "Keep all" — Leave .bib unchanged
134
136
  - "Comment out" — Keep but mark as unused
135
137
 
136
- For missing entries, offer to:
137
- - Search for DOI/metadata (if WebFetch available)
138
- - Create skeleton entry for user to complete
139
- - Flag for manual resolution
138
+ For missing entries, offer to find them:
139
+ 1. **Search:** Run `node ~/.claude/bin/citation-fetcher.js "title or author"` (uses Semantic Scholar + CrossRef) to find the correct BibTeX.
140
+ 2. **Create:** If found, append the new entry to the .bib file.
141
+ 3. **Flag:** If not found, flag for manual resolution.
140
142
  </step>
141
143
 
142
144
  <step name="apply_fixes">
@@ -88,116 +88,77 @@ Exit command.
88
88
 
89
89
  </step>
90
90
 
91
- <step name="type">
91
+ <step name="initial_batch">
92
92
 
93
- **Ask paper type:**
93
+ **Gather Core Context (Batched):**
94
94
 
95
- Use AskUserQuestion:
96
- - header: "Paper Type"
97
- - question: "What type of document are you writing?"
95
+ Use AskUserQuestion to collect the foundational pillars in one turn.
96
+
97
+ - header: "Paper Foundations"
98
+ - question: "To initialize the project, I need to understand 4 things. Answer what you can, and I'll infer or ask about the rest:\n\n1. **Type:** (Research paper, Grant, Thesis, etc.)\n2. **Venue:** (Target conference/journal, e.g., NeurIPS, CHI, Nature)\n3. **Core Argument:** (The one main thing you are proving/proposing)\n4. **Audience:** (Who is this for?)"
98
99
  - options:
99
- - "Research paper" — Journal article or conference paper
100
- - "Grant proposal" — Funding application (NSF, NIH, etc.)
101
- - "Thesis chapter" — Dissertation or thesis section
102
- - "Other" — Essay, report, or something else
100
+ - "I provided the details" — Continue with what I said
101
+ - "Guide me step-by-step" — I prefer individual questions
102
+
103
+ **If "Guide me step-by-step":**
104
+ Fall back to the sequential interview mode (ask Type, then Venue, then Argument).
103
105
 
104
- Store the document type for later structure decisions.
106
+ **If "I provided the details":**
107
+ Parse the response to extract: `document_type`, `target_venue`, `core_argument`, `target_audience`.
105
108
 
106
109
  </step>
107
110
 
108
111
  <step name="venue_template">
109
112
 
110
- **Select venue template (for research papers):**
113
+ **Select venue template (if not inferred):**
111
114
 
112
- If document type is "Research paper", ask for venue template:
115
+ If `document_type` or `target_venue` is ambiguous, ask specifically for the template:
113
116
 
114
117
  Use AskUserQuestion:
115
- - header: "Venue"
116
- - question: "What's your target venue or field?"
118
+ - header: "Venue Structure"
119
+ - question: "Based on your input, which structure fits best?"
117
120
  - options:
118
- - "ACM CS" — Systems, databases, architecture (SIGMOD, OSDI, SOSP)
119
- - "IEEE CS" — HPC, parallel systems, storage (SC, IPDPS, TPDS)
121
+ - "ACM CS" — Systems/Databases (SIGMOD, SOSP)
122
+ - "IEEE CS" — HPC/Systems (SC, IPDPS)
120
123
  - "ML/AI" — NeurIPS, ICML, ICLR style
121
- - "Nature/Science" — Classic IMRaD for life sciences
122
- - "Other" — Custom structure
124
+ - "Nature/Science" — Life Sciences IMRaD
125
+ - "Grant" — Funding Proposal
126
+ - "Thesis" — Dissertation Chapter
127
+ - "Other" — Custom
123
128
 
124
129
  **Load venue template:**
125
-
126
- Based on selection, read the corresponding venue template:
127
- - ACM CS → `~/.claude/write-the-f-paper/venues/acm-cs.yaml`
128
- - IEEE CS → `~/.claude/write-the-f-paper/venues/ieee-cs.yaml`
129
- - ML/AI → `~/.claude/write-the-f-paper/venues/arxiv-ml.yaml`
130
- - Nature/Science → `~/.claude/write-the-f-paper/venues/nature.yaml`
131
- - Other → Ask user to describe structure
132
-
133
- If document type is "Thesis chapter":
134
- - Load `~/.claude/write-the-f-paper/venues/thesis-chapter.yaml`
135
-
136
- Store the selected venue template for use in structure step.
130
+ (Load corresponding YAML from `~/.claude/write-the-f-paper/venues/`)
137
131
 
138
132
  </step>
139
133
 
140
- <step name="question">
141
-
142
- **1. Open (FREEFORM — do NOT use AskUserQuestion):**
143
-
144
- Ask inline: "What is the core argument or contribution of your paper?"
145
-
146
- Wait for their freeform response. This gives you the context needed to ask intelligent follow-up questions.
147
-
148
- **2. Follow the thread (NOW use AskUserQuestion):**
134
+ <step name="refine_argument">
149
135
 
150
- Based on their response, use AskUserQuestion with options that probe what they mentioned:
151
- - header: "[Topic they mentioned]"
152
- - question: "You mentioned [X] — how would you describe the key insight?"
153
- - options: 2-3 interpretations + "Something else"
136
+ **Sharpen the Core:**
154
137
 
155
- **3. Target venue:**
138
+ If `core_argument` was weak or missing in the batch, drill down now.
156
139
 
157
140
  Use AskUserQuestion:
158
- - header: "Venue"
159
- - question: "What's the target venue or format?"
160
- - options: Common venues for their field + "Undecided" + "Let me specify"
141
+ - header: "Refine Core"
142
+ - question: "Let's sharpen the core argument. If reviewers remember ONE thing, what is it?"
143
+ - options:
144
+ - "The Method" — A new way of doing X
145
+ - "The Findings" — We discovered Y
146
+ - "The Theory" — A new perspective on Z
147
+ - "The System" — We built system Q
148
+ - "Write my own" — (User types input)
161
149
 
162
- **4. Sharpen the core:**
150
+ </step>
163
151
 
164
- Use AskUserQuestion:
165
- - header: "Core"
166
- - question: "If reviewers remember one thing, what should it be?"
167
- - options: Key aspects they've mentioned + "The methodology" + "The findings" + "Something else"
152
+ <step name="constraints_batch">
168
153
 
169
- **5. Find boundaries:**
154
+ **Gather Constraints & Boundaries (Batched):**
170
155
 
171
156
  Use AskUserQuestion:
172
- - header: "Scope"
173
- - question: "What's explicitly NOT in this paper?"
174
- - options: Tempting tangents + "Nothing specific" + "Let me list them"
175
-
176
- **6. Constraints:**
177
-
178
- Use AskUserQuestion:
179
- - header: "Constraints"
180
- - question: "Any hard constraints?"
157
+ - header: "Scope & Limits"
158
+ - question: "Finally, define the box we are playing in:\n\n1. **Out of Scope:** What are we explicitly NOT doing?\n2. **Hard Constraints:** Page limits, deadlines, data restrictions?"
181
159
  - options:
182
- - "Page/word limit" — Strict length requirements
183
- - "Deadline" — Submission deadline pressure
184
- - "Data limitations" — Working with specific dataset
185
- - "None" — Flexible constraints
186
- - "Multiple constraints" — Let me explain
187
-
188
- **7. Decision gate:**
189
-
190
- Use AskUserQuestion:
191
- - header: "Ready?"
192
- - question: "Ready to create PROJECT.md, or explore more?"
193
- - options (ALL THREE REQUIRED):
194
- - "Create PROJECT.md" — Finalize and continue
195
- - "Ask more questions" — I'll dig deeper
196
- - "Let me add context" — You have more to share
197
-
198
- If "Ask more questions" → return to step 2.
199
- If "Let me add context" → receive input via their response → return to step 2.
200
- Loop until "Create PROJECT.md" selected.
160
+ - "Provided details" — Save and continue
161
+ - "No constraints" — Standard length, no specific exclusions
201
162
 
202
163
  </step>
203
164
 
@@ -73,10 +73,9 @@ Use AskUserQuestion:
73
73
  Based on scope, investigate:
74
74
 
75
75
  **Key Citations:**
76
- - Identify foundational papers
77
- - Find recent high-impact work
78
- - Note methodological papers
79
- - Track disagreements/debates
76
+ - **Foundational:** Use `node ~/.claude/bin/citation-fetcher.js "[topic]" --intent=seminal` to find high-impact papers.
77
+ - **Recent:** Use `node ~/.claude/bin/citation-fetcher.js "[topic]" --intent=recent --year=2023-2026` to find state-of-the-art.
78
+ - **Validation:** Use `node ~/.claude/bin/citation-fetcher.js "query"` to verify specific papers.
80
79
 
81
80
  **Standard Approaches:**
82
81
  - How do others structure similar sections?