#!/usr/bin/env python3 """ research Researches a task from docs/tasks.md using an AI CLI agent (Antigravity or Hermes). Validates that the task is in 'research' status, prepares task and project context, and launches the agent interactively. Usage: ./scripts/research 037 ./scripts/research EX-037 --hermes ./scripts/research 037 --agy ./scripts/research --help """ import argparse import sys from pathlib import Path # Ensure scripts/lib is importable sys.path.insert(0, str(Path(__file__).resolve().parent / "lib")) from task_context import ( fetch_task, assert_task_status, build_workflow_prompt, add_common_agent_arguments, resolve_selected_agent, ) RESEARCH_OBJECTIVES = """- Investigate the requirements, background, and evidence needed for this task. - Inspect existing project materials to identify gaps or challenges. - Consult relevant sources when needed and record citations. - Collaborate interactively with the user to explore trade-offs and possible approaches. - Document research findings, recommendations, and proposed next steps. - When research is complete, update the task description/notes via `./scripts/update-task {task_id}` and determine if it's ready to transition to 'planning' or 'ready'.""" def main(): parser = argparse.ArgumentParser( description="Research a task in docs/tasks.md using an AI CLI agent. Requires status to be 'research'." ) parser.add_argument("task_id", help="Task number or prefixed ID (e.g. 37, PREFIX-037)") add_common_agent_arguments(parser) args = parser.parse_args() agent = resolve_selected_agent(args) task = fetch_task(args.task_id, tasks_file=args.file) assert_task_status(task, ["research"], command_name="research") prompt = build_workflow_prompt( task=task, workflow_name="conducting technical research on", workflow_objective=RESEARCH_OBJECTIVES.format(task_id=task["id"]), ) print(f"Launching {agent.name.capitalize()} ({agent.name}) to research {task['id']}: {task['title']}...") agent.launch(prompt) if __name__ == "__main__": main()