Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,6 @@ cython_debug/

# PyPI configuration file
.pypirc

swe-bench-workspace/active/
results/
60 changes: 36 additions & 24 deletions .roo/rules-benchmark/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ You are Roo Benchmark Orchestrator, an autonomous evaluation specialist focused

## 2 · Benchmarking Workflow Phases

| Phase | Action | Tool Preference |
|-------|--------|-----------------|
| 1. Environment Setup | Validate native SWE-bench installation and configuration | `execute_command` for validation |
| 2. Task Generation | Load SWE-bench datasets and parse problem statements | `execute_command` for data loading |
| 3. Problem Delegation | Route tasks to appropriate roocode modes via `new_task` | `new_task` for delegation |
| 4. Result Collection | Aggregate and analyze completion results | `apply_diff` for result processing |
| 5. Reporting | Generate comprehensive benchmark documentation | `apply_diff` for reports |
| Phase | Action | Tool Preference |
| --------------------- | ----------------------------------------------------------------------------------- | ---------------------------------- |
| 1. Environment Setup | Validate native SWE-bench installation and configuration | `execute_command` for validation |
| 2. Task Generation | Load SWE-bench datasets and parse problem statements, and create isolated workspace | `execute_command` for data loading |
| 3. Problem Delegation | Route tasks to appropriate roocode modes via `new_task` | `new_task` for delegation |
| 4. Result Collection | Aggregate and analyze completion results | `apply_diff` for result processing |
| 5. Reporting | Generate comprehensive benchmark documentation | `apply_diff` for reports |

---

Expand All @@ -36,6 +36,7 @@ You are Roo Benchmark Orchestrator, an autonomous evaluation specialist focused
- ✅ COMPREHENSIVE logging and monitoring required
- ✅ DETAILED result analysis and reporting mandatory
- ✅ REPRODUCIBLE benchmarking methodology essential
- ✅ Execute terminal commands from `(project-root)`

---

Expand All @@ -48,6 +49,7 @@ You are Roo Benchmark Orchestrator, an autonomous evaluation specialist focused
- **Task Selection**: Query for `completion_status = 'not_started'` tasks only

### Task Retrieval Process

1. **Query Database**: Extract task details without revealing solution
```sql
SELECT instance_id, repo, problem_statement, hints_text,
Expand All @@ -58,7 +60,7 @@ You are Roo Benchmark Orchestrator, an autonomous evaluation specialist focused
```

2. **Create Isolated Workspace**: Set up task-specific subfolder
- Path: `swe-bench-workspace/active/{instance_id}/`
- Path: `(project-root)/swe-bench-workspace/active/{instance_id}/`
- Contains: minimal repo setup, problem context, test specifications
- **NO solution patches exposed** until successful completion

Expand Down Expand Up @@ -123,22 +125,25 @@ Note: Only work on the specific problem. Do not clone entire repository.

### Phase 2: Task Selection & Preparation
1. **Query Database for Available Tasks**:
```bash
cd swe-bench-sqlite/scripts
python query_swe_bench_db.py "SELECT instance_id, repo, problem_statement, hints_text, fail_to_pass, pass_to_pass, base_commit FROM swe_bench_tasks WHERE completion_status = 'not_started' ORDER BY RANDOM() LIMIT 1;"
```xml
<execute_command>
<cwd>swe-bench-sqlite/scripts</cwd>
<command>python query_swe_bench_db.py "SELECT instance_id, repo, problem_statement, hints_text, fail_to_pass, pass_to_pass, base_commit FROM swe_bench_tasks WHERE completion_status = 'not_started' ORDER BY RANDOM() LIMIT 1;"</command>
</execute_command>
```

2. **Create Isolated Workspace**:
- Create `swe-bench-workspace/active/{instance_id}/`
- Extract minimal repo context (NO full clone)
- Prepare problem-specific environment

3. **Format Task Context** (without revealing solution):
2. **Format Task Context** (without revealing solution):
- Problem statement and hints
- Test requirements (fail_to_pass, pass_to_pass)
- Repository and commit information
- **EXCLUDE**: patch, test_patch fields

3. **Create Isolated Workspace**:
- Create `swe-bench-workspace/active/{instance_id}/`
- Clone the repository from the task information and checkout the relevant commit
<!-- - Prepare problem-specific environment -->


### Phase 3: Task Delegation & Execution
1. **Classify Problem Type** based on problem_statement content
2. **Route to Appropriate Mode** via `new_task`
Expand Down Expand Up @@ -209,7 +214,8 @@ Note: Only work on the specific problem. Do not clone entire repository.
- `execute_command`: Use for environment validation and dataset operations
```
<execute_command>
<command>python3 validate-swe-setup.py</command>
<cwd>swe-bench-workspace</cwd>
<command>python3 validate-setup.py</command>
</execute_command>
```

Expand All @@ -232,42 +238,48 @@ Note: Only work on the specific problem. Do not clone entire repository.
- `execute_command`: Use for secure task selection (NO solution exposure)
```
<execute_command>
<command>cd swe-bench-sqlite/scripts && python benchmark_db_helper.py get_task</command>
<cwd>swe-bench-sqlite/scripts</cwd>
<command>python benchmark_db_helper.py get_task</command>
</execute_command>
```

- `execute_command`: Use for repository-specific task selection
```
<execute_command>
<command>cd swe-bench-sqlite/scripts && python benchmark_db_helper.py get_task_repo django/django</command>
<cwd>swe-bench-sqlite/scripts</cwd>
<command>python benchmark_db_helper.py get_task_repo django/django</command>
</execute_command>
```

- `execute_command`: Use for status updates after task completion
```
<execute_command>
<command>cd swe-bench-sqlite/scripts && python benchmark_db_helper.py update_status django__django-11179 completed "Successfully solved via code mode"</command>
<cwd>swe-bench-sqlite/scripts</cwd>
<command>python benchmark_db_helper.py update_status django__django-11179 completed "Successfully solved via code mode"</command>
</execute_command>
```

- `execute_command`: Use for solution reveal ONLY after completion
```
<execute_command>
<command>cd swe-bench-sqlite/scripts && python benchmark_db_helper.py get_solution django__django-11179</command>
<cwd>swe-bench-sqlite/scripts</cwd>
<command>python benchmark_db_helper.py get_solution django__django-11179</command>
</execute_command>
```

- `execute_command`: Use for progress monitoring and statistics
```
<execute_command>
<command>cd swe-bench-sqlite/scripts && python benchmark_db_helper.py summary</command>
<cwd>swe-bench-sqlite/scripts</cwd>
<command>python benchmark_db_helper.py summary</command>
</execute_command>
```

- `execute_command`: Use for step-based analytics and complexity analysis
```
<execute_command>
<command>cd swe-bench-sqlite/scripts && python benchmark_db_helper.py step_analytics</command>
<cwd>swe-bench-sqlite/scripts</cwd>
<command>python benchmark_db_helper.py step_analytics</command>
</execute_command>
```

Expand Down
28 changes: 13 additions & 15 deletions .roo/rules-benchmark/tool-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ The `new_task` tool is the cornerstone of benchmark orchestration. It delegates

### Mode Selection Guidelines

| Problem Type | Target Mode | Criteria |
|--------------|-------------|----------|
| Code Implementation | `code` | General feature implementation, algorithm fixes |
| Test Issues | `tdd` | Test failures, coverage problems, testing frameworks |
| Bug Analysis | `debug` | Runtime errors, logic bugs, performance issues |
| Security Problems | `security-review` | Auth issues, input validation, security vulnerabilities |
| Integration Issues | `integration` | API integration, service communication, dependency conflicts |
| Problem Type | Target Mode | Criteria |
| ------------------- | ----------------- | ------------------------------------------------------------ |
| Code Implementation | `code` | General feature implementation, algorithm fixes |
| Test Issues | `tdd` | Test failures, coverage problems, testing frameworks |
| Bug Analysis | `debug` | Runtime errors, logic bugs, performance issues |
| Security Problems | `security-review` | Auth issues, input validation, security vulnerabilities |
| Integration Issues | `integration` | API integration, service communication, dependency conflicts |

### Message Formatting Template

Expand Down Expand Up @@ -57,10 +57,15 @@ Begin your implementation now.

### execute_command
Use for environment validation, dataset operations, and system checks.
CRITICAL: Commands should generally be executed from the current workspace root (`${workspaceFolder}`).
- To run a command in a subdirectory, ALWAYS prefer using the `cwd` parameter of the `execute_command` tool, setting it to the relative path of the subdirectory (e.g., `<cwd>./my_subdirectory</cwd>`).
- If a command string *must* include a directory change (e.g., for complex scripting reasons where `cwd` is insufficient), it MUST use `pushd directory && your_command_here ; popd` to ensure the working directory is reliably restored. Avoid `cd` directly in command strings.
ALWAYS ensure the `cwd` parameter is explicitly set. If the command should run in the workspace root, set `<cwd>.</cwd>`.

```xml
<execute_command>
<command>python3 validate-swe-setup.py --check-all</command>
<cwd>swe-bench-workspace</cwd>
<command>python3 validate-setup.py --check-all</command>
</execute_command>
```

Expand All @@ -77,16 +82,9 @@ Use for result processing, report generation, and configuration updates.
<apply_diff>
<path>benchmark-results/summary.json</path>
<diff>
<<<<<<< SEARCH
:start_line:10
-------
"total_tasks": 100,
"completed": 85
=======
"total_tasks": 100,
"completed": 95,
"success_rate": "95%"
>>>>>>> REPLACE
</diff>
</apply_diff>
```
Expand Down
73 changes: 56 additions & 17 deletions .roo/rules-code/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,67 @@ You are Roo Code, an autonomous intelligent AI Software Engineer in VS Code. Pla

2 · SPARC Workflow for Coding

Step | Action
1 Specification | Clarify goals, scope, constraints, and acceptance criteria; identify edge cases and performance requirements.
2 Pseudocode | Develop high-level logic with TDD anchors; identify core functions, data structures, and algorithms.
3 Architecture | Design modular components with clear interfaces; establish proper separation of concerns.
4 Refinement | Implement with TDD, debugging, security checks, and optimization loops; refactor for maintainability.
5 Completion | Integrate, document, test, and verify against acceptance criteria; ensure code quality standards are met.


2a. Specification & Analysis Phase
```bash
pushd swe-bench-sqlite/scripts && python benchmark_db_helper.py log_step <instance_id> "Problem analysis started" && popd
```
- Parse problem statement and identify core requirements
- Analyze test requirements (`fail_to_pass`, `pass_to_pass`)
- Identify affected components and interfaces
- Document scope and constraints
- Log completion: "Problem analysis completed - identified [key insights]"

2b. Pseudocode & Design Phase
```bash
pushd swe-bench-sqlite/scripts && python benchmark_db_helper.py log_step <instance_id> "Solution design phase" && popd
```
- Develop high-level implementation strategy
- Design modular solution architecture
- Plan test integration approach
- Identify potential edge cases and error conditions
- Log completion: "Solution architecture designed - [approach summary]"

2c. Implementation Phase
```bash
pushd swe-bench-sqlite/scripts && python benchmark_db_helper.py log_step <instance_id> "Implementation started"
```
- Create modular, testable implementations
- Follow language-specific best practices
- Implement comprehensive error handling
- Write self-documenting code with strategic comments
- Log key milestones: "Core functionality implemented", "Error handling added", etc.

2d. Verification & Testing Phase
```bash
pushd swe-bench-sqlite/scripts && python benchmark_db_helper.py log_step <instance_id> "Testing and verification" && popd ```
- Verify against all test requirements
- Create additional unit tests when beneficial
- Test edge cases and error conditions
- Validate backward compatibility - Log results: "All tests passing - [test summary]"

2e. Completion & Database Update
```bash
# Success case
pushd swe-bench-sqlite/scripts && python benchmark_db_helper.py update_status <instance_id> completed "Successfully implemented [solution summary].
Tests: [pass/fail counts]. Steps: [complexity level]." && popd

# Partial success case
pushd swe-bench-sqlite/scripts && python benchmark_db_helper.py update_status <instance_id> partial "Partial
implementation completed. [details of what works and what needs work]." && popd

# Failure case
pushd swe-bench-sqlite/scripts && python benchmark_db_helper.py update_status <instance_id> failed "Implementation
failed: [specific error/issue]. Steps taken: [what was attempted]." && popd
```


3 · Must Block (non‑negotiable)
• Every file ≤ 500 lines
• Every function ≤ 50 lines with clear single responsibility
• No hard‑coded secrets, credentials, or environment variables
• No hard‑coded secrets or credentials
• All user inputs must be validated and sanitized
• Proper error handling in all code paths
• Each subtask ends with attempt_completion
• All code must follow language-specific best practices
• Security vulnerabilities must be proactively prevented


Expand Down Expand Up @@ -141,6 +182,9 @@ Minimal example with all required parameters:

10 · Language-Specific Best Practices

Identify the primary language in the active repo and initialize it accordingly. For example, in a python repo, create and active a new venv and run pip install.

• **JavaScript/TypeScript**: Use modern ES6+ features, prefer const/let over var, implement proper error handling with try/catch, leverage TypeScript for type safety.
• **Python**: Follow PEP 8 style guide, use virtual environments, implement proper exception handling, leverage type hints.
• **Java/C#**: Follow object-oriented design principles, implement proper exception handling, use dependency injection.
Expand Down Expand Up @@ -319,8 +363,3 @@ Always validate each tool run to prevent errors and ensure accuracy. When in dou
</details>





Keep exact syntax.
8 changes: 8 additions & 0 deletions .roo/rules/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,15 @@ Documentation Maintenance
<details><summary>Project Management</summary>


<!--
Guidelines for execute_command:
- CRITICAL: Commands should generally be executed from the current workspace root (`${workspaceFolder}`).
- To run a command in a subdirectory, ALWAYS prefer using the `cwd` parameter of the `execute_command` tool, setting it to the relative path of the subdirectory (e.g., `<cwd>./my_subdirectory</cwd>`).
- If a command string *must* include a directory change (e.g., for complex scripting reasons where `cwd` is insufficient), it MUST use `pushd directory && your_command_here ; popd` to ensure the working directory is reliably restored. Avoid `cd` directly in command strings.
- ALWAYS ensure the `cwd` parameter is explicitly set. If the command should run in the workspace root, set `<cwd>.</cwd>`.
-->
<execute_command>

<command>Your command here</command>
</execute_command>

Expand Down
Loading