Full pipeline

From GRIND-Lab-Core/night_owl_research_agent · View interactive version

Full pipeline is an AI agent skill from the GitHub repository GRIND-Lab-Core/night_owl_research_agent. Complete 4-stage end-to-end research pipeline. Orchestrates idea-discovery-pipeline → deploy-experiment → auto-review-loop → generate-report. Reads RESEARCH_PLAN.md (or BRIEF.md as fallback) for context that overrides $ARGUMENTS.

How to use this skill

Skill file

Skill: full-pipeline

End-to-end research pipeline. You are the pipeline conductor — you sequence the four sub-skills, check gates, and persist state across sessions.

The pipeline orchestrates exactly four subskills, in order:

idea-discovery-pipeline → deploy-experiment → auto-review-loop → generate-report

Constants

Override via argument, e.g., /full-pipeline "topic" — AUTO_PROCEED: false, human checkpoint: true, difficulty: nightmare.


Startup: Load Context, Check & Resume

Before any subskill is invoked, load the project context. All discovered files override $ARGUMENTS; $ARGUMENTS is only the primary driver when none of the context files exist or carry usable information.

  1. Read CLAUDE.md — project dashboard, control flags, canonical output paths.
  2. Read handoff.json if it exists — pipeline.stage, recovery.resume_skill, recovery.read_first.
  3. Read memory/MEMORY.md for the current pipeline stage and prior token usage.
  4. Load research context (priority order):

1. RESEARCH_PLAN.md in the project root — if present and non-empty, this is the authoritative research brief (problem, method, constraints, success criteria, prior attempts). Treat it as ground truth.

2. BRIEF.md in the project root — if RESEARCH_PLAN.md is missing, read BRIEF.md (the 12-section research brief — see CLAUDE.md Key Files). Treat it as the authoritative brief.

3. $ARGUMENTS — if neither file exists, or both are empty / contain only template placeholders, fall back to $ARGUMENTS as the research direction.

4. Both file and $ARGUMENTS present: the file's details (problem, constraints, success criteria) override; $ARGUMENTS may sharpen scope but cannot contradict the brief. If they conflict materially, surface the conflict to the user and ask which one to follow before proceeding.

  1. Read output/REVIEW_STATE.json if it exists — resume from saved round (see /auto-review-loop resume rules).
  2. Read the experiment status file appropriate for COMPACT_MODE:
  1. Display the resolved context (which brief was loaded, current stage, last action) and confirm with the user before proceeding.

💡 If neither RESEARCH_PLAN.md nor BRIEF.md exists and $ARGUMENTS is also empty, stop and ask the user for a research direction or to create one of these files (templates: templates/RESEARCH_PLAN_TEMPLATE.md).


Stage 1 — Idea Discovery (`/idea-discovery-pipeline`)

Goal: Identify a tractable, novel research direction and produce an experiment plan.

Invoke the subskill, passing through control flags:

/idea-discovery-pipeline "$ARGUMENTS"

The subskill internally chains: /lit-review → /generate-idea → /novelty-check → /idea-review → /experiment-design-pipeline (which itself runs /refine-research → /experiment-design). It will read RESEARCH_PLAN.md directly in its Phase 0 — do not re-paste its contents into the prompt.

Outputs (canonical paths produced by /idea-discovery-pipeline):

Gate 1: If AUTO_PROCEED = false, stop here and present the top ideas to the user:

📋 Idea Discovery Pipeline completed! Top ideas:

1. [Idea 1 title] — Pilot: POSITIVE (+X%), Novelty: 9/10
2. [Idea 2 title] — Pilot: WEAK POSITIVE (+Y%), Novelty: 8.3/10
3. [Idea 3 title] — Pilot: NEGATIVE, eliminated

Recommended: Idea 1. Shall I proceed with deployment?

The user may approve, pick a different idea, request changes (re-run the subskill with refined constraints), reject all (collect feedback, re-run), or stop and save state.

If AUTO_PROCEED = true, the subskill auto-selects the top idea after presenting results.

After selection, ensure the chosen idea and supporting context are recorded in RESEARCH_PLAN.md (template: templates/RESEARCH_PLAN_TEMPLATE.md) so downstream stages and future sessions inherit it.

Path bridge before Stage 2: /deploy-experiment reads output/refine-logs/EXPERIMENT_PLAN.md and output/refine-logs/FINAL_PROPOSAL.md. /idea-discovery-pipeline writes the plan to output/EXPERIMENT_PLAN.md. Before Stage 2, verify output/refine-logs/EXPERIMENT_PLAN.md exists; if it does not, copy output/EXPERIMENT_PLAN.md to that location so the deploy skill finds it. Do not relocate the original.

Update memory/MEMORY.md.


Stage 2 — Autonomous Experiment Execution (`/deploy-experiment`)

Goal: Run all experiments described in the plan and collect results.

Invoke the subskill:

/deploy-experiment

The subskill will:

  1. Read output/refine-logs/EXPERIMENT_PLAN.md (authoritative plan) and output/refine-logs/FINAL_PROPOSAL.md (context).
  2. Run the mandatory local GPU availability check (Step 0 of /deploy-experiment) before any classification. This applies to every pilot or full experiment in this pipeline. If a local GPU (CUDA or MPS) is detected, all ML/DL runs MUST execute on it; only when LOCAL_GPU=none may runs route to remote/Modal/CPU.
  3. Classify the experiment into Track A (ML/DL on GPU) or Track B (spatial/GIScience on CPU) — or both for mixed GeoAI.
  4. Acquire data via /data-download if any required dataset is missing from data/raw/.
  5. Pre-flight environment checks (GPU re-confirmed from Step 0 for Track A, package availability for Track B).
  6. Launch runs (long-running jobs go to background or remote screen sessions).
  7. For Track B, route execution through /spatial-analysis per claim.
  8. Periodically invoke /training-check (Track A with W&B) to monitor for stalls/failures.

Outputs (canonical paths produced by /deploy-experiment):

Wait for runs to finish, then confirm EXPERIMENT_RESULT.md and EXPERIMENT_LOG.md are populated before advancing.

Update memory/MEMORY.md.


Stage 3 — Autonomous Review Loop (`/auto-review-loop`)

Goal: Iteratively improve work quality through adversarial review until all per-criterion floors are met and the weighted score is acceptable, or MAX_ROUNDS = 4 is reached.

Invoke the subskill, passing the chosen idea and difficulty:

/auto-review-loop "[chosen idea title] — difficulty: $REVIEWER_DIFFICULTY"

The subskill reads output/experiment/EXPERIMENT_RESULT.md, output/experiment/EXPERIMENT_LOG.md, output/refine-logs/FINAL_PROPOSAL.md, and prior review state. Each round runs: independent reviewer (Codex MCP / codex exec / Claude subagent fallback) → parse → (optional debate in hard/nightmare) → fix verification → re-evaluate. State is persisted to output/REVIEW_STATE.json at every phase boundary.

Outputs (canonical paths produced by /auto-review-loop):

After the loop completes, read the terminal status and final score from output/REVIEW_STATE.json:

Update memory/MEMORY.md.


Stage 4 — Report Writing (`/generate-report`)

Goal: Consolidate all pipeline artifacts into a single narrative rich enough to drive the downstream paper-writing-pipeline (paper-plan → paper-figure-generate → paper-draft → paper-review-loop → paper-convert).

Invoke the subskill (optionally with a focus hint):

/generate-report

The subskill reads, at minimum:

…and produces output/NARRATIVE_REPORT.md — the single source-of-truth narrative for the paper-writing pipeline.

After /generate-report returns, append a short pipeline summary block to output/NARRATIVE_REPORT.md (or write it alongside as output/PIPELINE_SUMMARY.md):

# Research Pipeline Report

**Direction**: $ARGUMENTS (and/or RESEARCH_PLAN.md / BRIEF.md)
**Chosen Idea**: [title]
**Date**: [start] → [end]
**Pipeline**: idea-discovery-pipeline → deploy-experiment → auto-review-loop → generate-report

## Journey Summary
- Ideas generated: X → filtered to Y → piloted Z → chose 1
- Implementation: [brief description of what was built]
- Experiments: [number of runs, total compute time, GPU-hours]
- Review rounds: N/4, final score: X/10, status: [completed|max_rounds_reached|blocked]

## Final Status
- [ ] Ready for paper-writing-pipeline / [ ] Needs manual follow-up

## Remaining TODOs (if any)
- [items from output/REVIEW_STATE.json open_weaknesses]

## Files Changed
- [list of key files created/modified]

Gate 4 (if HUMAN_CHECKPOINT = true): Present output/NARRATIVE_REPORT.md to the user for approval before handing off.

Handoff: Once approved, the next call in the workflow is /paper-writing-pipeline using output/NARRATIVE_REPORT.md as input.

Update memory/MEMORY.md.


Recovery Instructions

If context overflows mid-pipeline:

  1. Read handoff.json for pipeline.stage, recovery.resume_skill, recovery.read_first (fastest recovery).
  2. Read output/REVIEW_STATE.json to find current review round and per-criterion scores (Stage 3 only).
  3. Read memory/MEMORY.md for pipeline state flags.
  4. Read output/PROJ_NOTES.md (when COMPACT_MODE = true) or output/experiment/EXPERIMENT_LOG.md (full).
  5. Resume from the interrupted stage — do NOT re-run completed stages or experiments marked SUCCESS in output/experiment/EXPERIMENT_LOG.md.

Key Rules

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.