$npx -y skills add Borda/AI-Rig --skill researchMinimal codex-native research loop. Use for docs/papers/state-of-the-art scan with source-backed recommendations.
| 1 | # Research |
| 2 | |
| 3 | Source-backed research for documentation, API migration, paper, or state-of-the-art questions. |
| 4 | |
| 5 | ## Input Schema |
| 6 | |
| 7 | ```json |
| 8 | { |
| 9 | "question": "required research question", |
| 10 | "mode": "docs|sota|paper|methodology|code-fidelity", |
| 11 | "constraints": [ |
| 12 | "optional codebase, compute, version, or implementation constraints" |
| 13 | ], |
| 14 | "done_when": "recommendations are source-backed with caveats and confidence" |
| 15 | } |
| 16 | ``` |
| 17 | |
| 18 | ## Workflow |
| 19 | |
| 20 | ### 01: Create run directory |
| 21 | |
| 22 | Run `python PLUGIN_ROOT/shared/create_run.py --skill research` once. Retain its single printed path as |
| 23 | `<run-directory>` and substitute that literal path into every later artifact path and helper argument. Never store or |
| 24 | reuse the path through a shell variable; shell variables do not persist across tool calls. |
| 25 | |
| 26 | ### 02: Define research question, mode, and constraints |
| 27 | |
| 28 | Modes: |
| 29 | |
| 30 | - `docs`: current API/docs/migration answer. |
| 31 | - `sota`: method comparison and implementation recommendation. |
| 32 | - `paper`: single-paper analysis. |
| 33 | - `methodology`: experiment design, metric, guard, and ablation review. |
| 34 | - `code-fidelity`: compare paper/spec claims against implementation. |
| 35 | |
| 36 | ### 03: Gather sources |
| 37 | |
| 38 | Write `<run-directory>/sources.md`: |
| 39 | |
| 40 | ```markdown |
| 41 | | Source | Type | Date/version | Why reliable | Used for | |
| 42 | | --- | --- | --- | --- | --- | |
| 43 | ``` |
| 44 | |
| 45 | Source rules: |
| 46 | |
| 47 | - Prefer primary docs, papers, specs, release notes, code. |
| 48 | - Use current live sources for volatile docs, dependencies, APIs. |
| 49 | - Mark stale/unavailable source explicitly. |
| 50 | - Do not cite secondary summaries for high-impact claims unless independently corroborated. |
| 51 | |
| 52 | For `sota`, `paper`, `methodology`, `code-fidelity`, apply `../../shared/specialist-orchestration.md` when independent expertise improves correctness. Write `<run-directory>/specialist-research-plan.md` with context packs for: |
| 53 | |
| 54 | - `web-explorer`: current docs, release notes, API and dependency changes. |
| 55 | - `scientist`: formulas, methodology, metrics, ablations, benchmark claims. |
| 56 | - `solution-architect`: implementation fit, API boundaries, migration shape. |
| 57 | - `squeezer`: performance or resource claims. |
| 58 | - `data-steward`: datasets, splits, leakage, reproducibility. |
| 59 | - `challenger`: unsupported recommendation or overconfident source synthesis. |
| 60 | |
| 61 | Do not send full papers, repositories, or all search results to every specialist. Give each only source excerpts, code files, questions needed for its axis. |
| 62 | |
| 63 | ### 04: Map to codebase context when implementation is relevant |
| 64 | |
| 65 | Inspect `python PLUGIN_ROOT/shared/collect_diff.py --help`; collect `working-tree` scope into `<run-directory>/baseline`. Run topic scan separately; record unavailable paths/collection failures as evidence gaps. |
| 66 | |
| 67 | ### 05: Produce `<run-directory>/research.md` with: |
| 68 | |
| 69 | - `Question` |
| 70 | - `Constraints` |
| 71 | - `Source Table` |
| 72 | - `Findings` |
| 73 | - `Comparison` for SOTA/method choices |
| 74 | - `Implementation Fit` |
| 75 | - `Risks And Unknowns` |
| 76 | - `Recommendation` |
| 77 | - `Next Checks` |
| 78 | |
| 79 | ### 06: For paper/code-fidelity mode, include dimensions: |
| 80 | |
| 81 | - `F`: formula/math match |
| 82 | - `H`: hyperparameter parity |
| 83 | - `E`: evaluation protocol |
| 84 | - `N`: notation and naming consistency |
| 85 | - `C`: citation/derivation chain |
| 86 | |
| 87 | ### 07: Run review gate |
| 88 | |
| 89 | Run `git diff --check` as an argv command. Write its combined output to `<run-directory>/review.txt` and retain its |
| 90 | exit status as review evidence; do not erase a nonzero result. |
| 91 | |
| 92 | ### 08: Run shared gates and write the validated result artifact |
| 93 | |
| 94 | Follow `../../shared/helper-cli-contract.md` and authoritative help. For research-only work, mark lint, format, types, tests inapplicable with concrete reasons; review requires non-empty `research.md`, `sources.md`, clean diff check. Write `RESEARCH_METADATA`, validate as `research`, promote only validated candidate. |
| 95 | |
| 96 | Replace explicit skip with relevant command when research includes executable validation. |
| 97 | |
| 98 | ## Fail-Fast Rules |
| 99 | |
| 100 | 1. Missing question => fail. |
| 101 | 2. No primary sources for high-impact/current claims => fail. |
| 102 | 3. Recommendation not tied to constraints => fail. |
| 103 | 4. Paper/code-fidelity claim without code or source reference => fail. |
| 104 | 5. Result artifact missing => fail. |
| 105 | |
| 106 | ## Quality Gates |
| 107 | |
| 108 | Required: |
| 109 | |
| 110 | - `review`: source table, caveats, self-review, `git diff --check`. |
| 111 | |
| 112 | Conditional: |
| 113 | |
| 114 | - `tests`: when research includes an executable validation or code-fidelity probe. |
| 115 | |
| 116 | ## Calibration Hooks |
| 117 | |
| 118 | On source-protocol/recommendation-policy change, update calibration: |
| 119 | |
| 120 | - behavioral cases: stale docs, unsupported SOTA claim, paper-code mismatch |
| 121 | - benchmark patterns: `research` |
| 122 | |
| 123 | ## Output Contract |
| 124 | |
| 125 | Use shared gate schema from `../../shared/quality-gates.md`. |
| 126 | |
| 127 | Minimum artifact payload template: `result-template.json`. |