From magi-researchers
Implements research code from research_plan.md in outputs directories. Locates plan, detects language/ecosystem from src/ or frontmatter, sets up workspace, uses MCP for implementation.
npx claudepluginhub axect/magi-researchers --plugin magi-researchersThis skill uses the workspace's default tool permissions.
Implements research code based on an existing research plan. Requires a `research_plan.md` to be present in the active research output directory.
Orchestrates end-to-end Research-Plan-Implement pipeline using parallel subagents per phase with file artifacts for communication. Use for complex features needing codebase research, planning, and implementation in one session.
Executes research code in src/ to generate artifacts in results/, reading commands from plan/research_plan.md YAML frontmatter or execution_manifest.json. Phase 3.5 of research pipeline with prerequisite checks.
Guides software development through six-phase workflow: Research, Plan, Iterate Plan, Experiment, Implement, Validate. Generates structured markdown docs via slash commands for auditable trails.
Share bugs, ideas, or general feedback.
Implements research code based on an existing research plan. Requires a research_plan.md to be present in the active research output directory.
/research-implement [path/to/research_plan.md]
$ARGUMENTS — Optional path to the research plan. If not provided, searches for the most recent outputs/*/plan/research_plan.md.Shared rules: Read
${CLAUDE_PLUGIN_ROOT}/shared/rules.mdbefore starting. §MCP, §Claude-Only apply to this skill. Inline fallback (if shared rules unavailable): Gemini models: gemini-3.1-pro-preview → gemini-2.5-pro → Claude. Codex: gpt-5.4. Use@filepathfor MCP file refs; subagents useReadtool.
See §Claude-Only in shared rules.
See §MCP in shared rules. Additionally:
$ARGUMENTS, use it directly.outputs/*/plan/research_plan.md/magi-researchers:research-brainstorm first, or creating a plan manually.plan/)languages/ecosystem fields)$ARGUMENTS: If invoked standalone (not from the /research pipeline), check $ARGUMENTS for --claude-only and --substitute flags. When present, all Gemini/Codex MCP calls in this skill are replaced per the Claude-Only Mode rules above..workspace.json exists at the output directory root, read output_dir from it and use as the base for all file operations. If absent (standalone invocation), derive the absolute output path from the location of research_plan.md.Check if src/ already has code (Glob src/**/*):
src/ is empty or absent, proceed with initialization.Determine language and ecosystem using the following priority:
| Priority | Source | How |
|---|---|---|
| 1st | Existing src/ files | Detect package managers (Cargo.toml, pyproject.toml, Project.toml, DESCRIPTION) and dominant file extensions |
| 2nd | research_plan.md frontmatter | Read languages and ecosystem fields |
| 3rd | Domain + topic inference | Autonomous selection based on research domain and algorithms |
If 1st and 2nd conflict (e.g., plan says Python but src/ has Rust code), the actual files win.
Announce the discrepancy and proceed with the detected ecosystem.
Initialize the ecosystem (only if src/ is empty):
uv init (if no pyproject.toml exists) or uv add {deps}src/ already exists (pre-created by the pipeline), run cargo init in the output directory root (not inside src/) to avoid double-nesting (src/src/). The resulting src/main.rs is the correct layout.DESCRIPTION and R/ subdirectoryjulia --project=src/ -e 'import Pkg; Pkg.init()'CMakeLists.txt or MakefileLanguage selection principles (when choosing freely):
src/:
src/main.py for Python, src/main.rs
src/lib.rs for Rust, R/ for R packages)/research-execute) for a quick sanity check before the full run--dry-run, --fast, --epochs 1 --samples 10mcp__plugin_context7_context7__query-docs) to look up library APIs when needed.After implementation, update the YAML frontmatter in plan/research_plan.md to reflect the actual
execution commands. This information is consumed by Phase 3.5 (/research-execute).
Read the current frontmatter and update or add these fields:
---
title: "..."
domain: "..."
languages: ["rust", "python"] # actual languages used in src/
ecosystem: ["cargo", "uv"] # actual package managers
execution_cmd: "bash run_all.sh" # command to run the full pipeline
dry_run_cmd: "bash run_all.sh --dry-run" # fast sanity-check command (seconds)
expected_outputs: # key files that should appear in results/
- "results/metrics.csv"
- "results/model.pt"
estimated_runtime: "~30 minutes" # rough estimate for user awareness
---
If a run_all.sh (or equivalent) script does not yet exist, create it in the output directory root (not inside src/). The cwd field in execution_manifest.json should be set accordingly. Always verify that execution_cmd can be run from the directory specified by cwd.
After updating the YAML frontmatter, also emit a structured execution_manifest.json in the output directory root. This file is the machine-readable execution contract consumed by Phase 3.5 (/research-execute).
{
"schema_version": "1.0.0",
"languages": ["rust", "python"],
"ecosystem": ["cargo", "uv"],
"execution_cmd": "bash run_all.sh",
"dry_run_cmd": "bash run_all.sh --dry-run",
"expected_outputs": [
{"path": "results/metrics.csv", "required": true},
{"path": "results/model.pt", "required": false}
],
"estimated_runtime": "~30 minutes",
"cwd": "."
}
Fields:
schema_version: Always "1.0.0" for this releaselanguages, ecosystem: Actual languages/tools used in src/execution_cmd: Single command to run the full pipelinedry_run_cmd: Fast sanity-check command (seconds, not minutes)expected_outputs: Files that should appear in results/ after execution. required: true means the pipeline should warn if absent; required: false means optional.estimated_runtime: Rough estimate for user awarenesscwd: Working directory relative to the output directory (optional, defaults to output directory root)The YAML frontmatter in
research_plan.mdis retained for backward compatibility and human readability, butexecution_manifest.jsonis the authoritative machine contract.
Pre-validation: Before proceeding to Step 4, verify that the file or command referenced by execution_cmd exists at the expected path (e.g., Glob for run_all.sh or check that the binary is available). If the target does not exist, fix the manifest/frontmatter before running validation.
Note: If Step 4 (Validation) discovers issues that require changing the execution command, re-update the frontmatter (Step 3) and manifest (Step 3b) after the fix to keep them consistent.
Run the dry-run command to confirm basic executability:
{dry_run_cmd}
Present the implementation summary to the user:
execution_cmd, dry_run_cmd)Before presenting to the user, execute a lightweight quality checkpoint:
High, Medium, or Low):| Checklist Item | Criteria |
|---|---|
| Code correctness | All files are syntactically valid; key functions produce expected output types |
| Alignment with plan | Implementation matches the research plan's specification; deviations are documented |
| Error handling | Edge cases and invalid inputs are handled gracefully |
| Dependency management | All required libraries are listed; no undeclared imports |
Conditional MAGI mini-review (if confidence is Medium or Low):
mcp__codex-cli__ask-codex(
prompt: "Review this research implementation for correctness, plan alignment, error handling, and dependency management. Focus on: {low_scoring_items}\n\n@{output_dir}/plan/research_plan.md\n@{output_dir}/src/ (all source files matching the detected language: *.py, *.rs, *.jl, *.r, *.cpp, etc.)",
model: "gpt-5.4"
)
If
--claude-only: Per §SubagentExec — B (AC, code reviewer): Read research plan + source files. Review correctness, plan alignment, error handling, dependency management focusing on {low_scoring_items}. Return structured text.
Go/No-Go synthesis: Write a brief gate report with:
Save to src/phase_gate.md.
If the gate returns No-Go, fix the identified issues before presenting to the user. Maximum 1 fix iteration.
Present the implementation for user review: