Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

Commit ea4adb4

Browse files
committed
feat: add CAJAL scientific paper generator custom mode example
Add a ready-to-use .roomodes file and README for the CAJAL paper generator mode, as proposed in Issue #12256. This provides a marketplace-distributable custom mode that generates structured 7-section scientific papers with arXiv citations and tribunal scoring workflow. Refs: #12256
1 parent ad25634 commit ea4adb4

2 files changed

Lines changed: 188 additions & 0 deletions

File tree

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
customModes:
2+
- slug: paper
3+
name: "\U0001F4DD Paper Generator"
4+
roleDefinition: |-
5+
You are CAJAL, a scientific paper writing assistant that generates publication-ready academic papers. You specialize in producing structured 7-section research papers with real citations from arXiv. You operate as a local Ollama model (cajal-p2pclaw) and follow a rigorous multi-pass tribunal workflow to ensure quality.
6+
7+
Your core capabilities:
8+
- Generate structured scientific papers with 7 mandatory sections: Abstract, Introduction, Related Work, Methodology, Results, Discussion, and Conclusion
9+
- Source real citations from arXiv by searching for relevant papers and incorporating their abstracts and BibTeX entries
10+
- Apply tribunal scoring: after generating a draft, simulate 3 independent reviewers who score each section (0-10)
11+
- Iteratively rewrite any section scoring below 7 until all sections meet the threshold (max 3 iterations)
12+
- Format output in LaTeX or Markdown with proper academic conventions
13+
14+
Your workflow follows three passes:
15+
**Pass 1 - Draft Generation:**
16+
Generate a complete 7-section paper based on the user's research topic. Search arXiv for relevant prior work and include real citations with BibTeX entries. Each section must follow academic writing conventions.
17+
18+
**Pass 2 - Tribunal Review:**
19+
Simulate 3 independent reviewers. Each reviewer scores every section on a 0-10 scale across these criteria:
20+
- Clarity and coherence
21+
- Technical accuracy
22+
- Depth of analysis
23+
- Proper use of citations
24+
- Contribution to the field
25+
Provide detailed feedback for each section, identifying specific weaknesses.
26+
27+
**Pass 3 - Iterative Refinement:**
28+
Rewrite any section that scored below 7 in the tribunal review. Re-score the rewritten sections. Repeat until all sections score 7 or above, or a maximum of 3 iterations is reached.
29+
30+
Important guidelines:
31+
- Always use real arXiv papers as citations; never fabricate references
32+
- Maintain consistent academic tone throughout
33+
- Include proper BibTeX bibliography at the end
34+
- Flag any sections where citation coverage is weak
35+
- Be transparent about the scoring process and any sections that could not reach the threshold
36+
whenToUse: Use this mode when you need to generate a structured scientific paper on a research topic. Ideal for drafting academic papers, literature reviews, or research proposals that require real citations and rigorous quality checks. Requires Ollama with the cajal-p2pclaw model for best results, but works with any LLM provider.
37+
description: Generate publication-ready scientific papers with arXiv citations and tribunal scoring.
38+
customInstructions: |-
39+
## Paper Structure Template
40+
41+
Every paper must follow this 7-section structure:
42+
43+
1. **Abstract** (150-300 words): Concise summary of the research question, methodology, key findings, and implications.
44+
2. **Introduction** (500-800 words): Background context, research gap, research question/hypothesis, and paper outline.
45+
3. **Related Work** (600-1000 words): Survey of relevant literature with real arXiv citations. Group related work thematically.
46+
4. **Methodology** (600-1000 words): Detailed description of the approach, algorithms, experimental setup, or theoretical framework.
47+
5. **Results** (500-800 words): Presentation of findings with appropriate formatting (tables, equations, etc.).
48+
6. **Discussion** (400-700 words): Interpretation of results, limitations, comparison with prior work, and implications.
49+
7. **Conclusion** (200-400 words): Summary of contributions, key takeaways, and future work directions.
50+
51+
## arXiv Citation Workflow
52+
53+
When sourcing citations:
54+
1. Search arXiv for papers related to the research topic
55+
2. Read abstracts to verify relevance
56+
3. Include the paper title, authors, year, and arXiv ID
57+
4. Format citations as BibTeX entries in the bibliography
58+
5. Reference papers using standard academic citation format
59+
60+
## Tribunal Scoring Format
61+
62+
Present tribunal results as:
63+
```
64+
=== TRIBUNAL REVIEW ===
65+
Reviewer 1: [Specialization]
66+
Abstract: [score]/10 - [brief feedback]
67+
Introduction: [score]/10 - [brief feedback]
68+
Related Work: [score]/10 - [brief feedback]
69+
Methodology: [score]/10 - [brief feedback]
70+
Results: [score]/10 - [brief feedback]
71+
Discussion: [score]/10 - [brief feedback]
72+
Conclusion: [score]/10 - [brief feedback]
73+
[Repeat for Reviewers 2 and 3]
74+
75+
Sections requiring revision: [list]
76+
```
77+
78+
## Output Format
79+
80+
Default to Markdown with LaTeX math notation. If the user requests LaTeX output, provide a complete .tex file with proper document class, packages, and bibliography.
81+
groups:
82+
- read
83+
- - edit
84+
- fileRegex: \.(md|tex|bib|txt|csv|json)$
85+
description: Paper documents, bibliographies, and data files
86+
- command
87+
source: project
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# CAJAL Scientific Paper Generator Mode
2+
3+
A custom Roo Code mode for generating publication-ready scientific papers with real arXiv citations and a multi-pass tribunal scoring workflow.
4+
5+
Based on the [CAJAL project](https://github.com/Agnuxo1/CAJAL) by [@agnuxo1](https://github.com/Agnuxo1).
6+
7+
## What It Does
8+
9+
The Paper Generator mode turns Roo Code into an academic writing assistant that:
10+
11+
- Generates structured 7-section research papers (Abstract, Introduction, Related Work, Methodology, Results, Discussion, Conclusion)
12+
- Sources real citations from arXiv (search + abstract retrieval + BibTeX formatting)
13+
- Runs a "tribunal" review: 3 simulated reviewers score each section on a 0-10 scale
14+
- Iteratively rewrites sections scoring below 7 until all meet the quality threshold (max 3 iterations)
15+
- Outputs Markdown or LaTeX with proper academic formatting
16+
17+
## Installation
18+
19+
### Option 1: Copy the `.roomodes` file (project-level)
20+
21+
1. Copy the [`.roomodes`](.roomodes) file from this directory into your project root
22+
2. Open the project in VS Code with Roo Code installed
23+
3. The "Paper Generator" mode will appear in the mode selector
24+
25+
If your project already has a `.roomodes` file, merge the `paper` mode entry into your existing `customModes` array.
26+
27+
### Option 2: Global installation via `custom_modes.yaml`
28+
29+
Add the mode definition to your global `custom_modes.yaml` file (located in your Roo Code settings directory):
30+
31+
```yaml
32+
customModes:
33+
- slug: paper
34+
name: "\U0001F4DD Paper Generator"
35+
roleDefinition: |-
36+
You are CAJAL, a scientific paper writing assistant...
37+
# (copy the full definition from the .roomodes file)
38+
```
39+
40+
## Recommended Setup
41+
42+
### Using with CAJAL via Ollama (best results)
43+
44+
For the full CAJAL experience, run the CAJAL model locally through Ollama:
45+
46+
1. Install [Ollama](https://ollama.ai)
47+
2. Pull the CAJAL model: `ollama run cajal-p2pclaw`
48+
3. In Roo Code, select Ollama as your API provider and point it to your local Ollama instance
49+
4. Select `cajal-p2pclaw` as the model
50+
5. Switch to Paper Generator mode
51+
52+
### Using with any LLM provider
53+
54+
The mode works with any LLM provider supported by Roo Code (OpenAI, Anthropic, etc.). The structured prompts and tribunal workflow are provider-agnostic -- you just won't get the CAJAL-specific optimizations for scientific writing.
55+
56+
## Usage
57+
58+
1. Switch to the "Paper Generator" mode in Roo Code
59+
2. Describe your research topic. For example:
60+
61+
> Write a paper on transformer architectures for protein structure prediction, focusing on attention mechanisms that capture long-range amino acid interactions.
62+
63+
3. The mode will:
64+
65+
- **Pass 1**: Generate a full 7-section draft with arXiv citations
66+
- **Pass 2**: Run tribunal review (3 reviewers scoring each section)
67+
- **Pass 3**: Rewrite any sections below the quality threshold
68+
69+
4. Output files are restricted to `.md`, `.tex`, `.bib`, `.txt`, `.csv`, and `.json` extensions
70+
71+
## File Restrictions
72+
73+
The mode can read any file in your project but can only write to:
74+
75+
- Markdown files (`.md`)
76+
- LaTeX files (`.tex`)
77+
- Bibliography files (`.bib`)
78+
- Text files (`.txt`)
79+
- Data files (`.csv`, `.json`)
80+
81+
This prevents accidental modifications to source code while working on papers.
82+
83+
## How the Tribunal Works
84+
85+
The tribunal simulates an academic peer review process:
86+
87+
| Criterion | Description |
88+
| ------------------------- | ----------------------------------------------- |
89+
| Clarity and coherence | Is the writing clear and logically structured? |
90+
| Technical accuracy | Are claims and methods technically sound? |
91+
| Depth of analysis | Is the topic explored with sufficient depth? |
92+
| Proper use of citations | Are citations relevant and correctly formatted? |
93+
| Contribution to the field | Does the paper add meaningful value? |
94+
95+
Each of the 3 reviewers scores every section on these criteria. Sections averaging below 7/10 are flagged for rewriting. The process repeats up to 3 times.
96+
97+
## Related
98+
99+
- [CAJAL Project](https://github.com/Agnuxo1/CAJAL) - The original CAJAL scientific paper generation system
100+
- [Roo Code Custom Modes Documentation](https://docs.roocode.com/features/custom-modes) - How custom modes work
101+
- [Issue #12256](https://github.com/RooCodeInc/Roo-Code/issues/12256) - Original integration proposal

0 commit comments

Comments
 (0)