Agentic Workflow via GitHub Issues

From Stat DS Computing Wiki


Agentic coding tools can act as automated research assistants, directly interacting with your terminal and file system to write scripts, run data pipelines, and manage your compute jobs. While this can drastically speed up iteration, managing these AI agents across different machines and lengthy experiments can quickly become chaotic.

This article outlines a robust workflow for managing long-running agentic experiments.

1. Introduction to Agentic Coding

Agentic coding moves beyond simple autocomplete. These tools can read your entire project directory, execute terminal commands, and debug errors autonomously.

Popular tools in this space include:

The rest of this article will use Claude Code as the primary example, but the overarching workflow and principles should translate well to most agentic coding setups.

2. Challenges of the Agentic Coding Workflow

While extremely powerful, relying on an AI agent for complex statistical research introduces several logistical hurdles:

  • Session Tracking: It is difficult to keep track of multiple terminal sessions, especially when running overlapping experiments.
  • Memory Loss: Remembering exactly what prompt led to a specific code change or output during a chaotic debugging session is nearly impossible.
  • Token Limits: Keeping a single continuous session open for days uses up too much context window (tokens), eventually leading to degraded AI performance, slow response times, or API errors.
  • Machine Isolation: Sessions running on your personal laptop cannot easily communicate with or track jobs running on the department's HPC clusters.

3. The Solution in 3 Parts

To build a reliable, scalable agent workflow, we can combine Claude Code with GitHub issues, dedicated SSH keys, and terminal multiplexers. This setup assumes that your code base is already hosted on GitHub. See Git and GitHub for using GitHub to manage your code.

3a. GitHub MCP and Bookkeeping via GitHub Issues

GitHub Issues are a built-in tracking tool for repositories. By setting up the GitHub Model Context Protocol (MCP) server, Claude can read from and write directly to your repository's issues. See instructions for setting up GitHub MCP server access for Claude CLI

Instead of relying on a single, infinitely long terminal session to remember context, treat a GitHub issue as your "lab notebook." When you start working, point Claude to a specific issue link for its instructions. When the agent completes a task, have it summarize the results and post them back to the issue as a comment. This allows you to safely kill sessions to save tokens—simply start a fresh session later and point it to the exact same GitHub issue to pick up right where it left off.

Among other features, GitHub issues are easily searchable and can be assigned labels for easy organization. Issues can be cross referenced (simple type "#" to start tagging another issue). Claude can even file new issues on your behalf should it encounter new bugs while working.

3b. Giving Claude its own SSH key

Large research experiments ultimately need to run on larger department or external clusters using Slurm. You can grant Claude autonomy by generating a dedicated SSH key specifically for the agent, using the same workflow as Passwordless SSH.

Once configured, Claude can SSH into the Slurm clusters on your behalf. It can sync your local GitHub repositories to the remote server, format and write the necessary sbatch submission scripts, and submit jobs directly to the queue—acting as an automated bridge between your local environment and the heavy-compute nodes.

3c. Tmux and Remote Control

Since our department maintains always-on, SSH-only servers (leviathans and ghidorahs, see Department Servers), you can detach your agentic workflows from your personal hardware entirely.

By launching Claude Code inside a Tmux (terminal multiplexer) session on a department server, the agent continues running even if you close your laptop or lose your internet connection. You can periodically SSH back into the server and reattach to the tmux session, checking its progress, providing human feedback when it gets stuck, or terminating rogue processes.

Claude in particular has a remote control feature that lets you check on any Claude session from the claude.ai website or from the Claude app. This can be useful if you anticipate Claude needing frequent human feedback for a particular session, but you will be without SSH access for a long time.


Important: Monitoring Automated Jobs
Giving an AI agent the ability to submit Slurm jobs or execute remote commands requires careful oversight. Always verify the batch scripts and environment setups Claude generates before allowing it to submit them, to prevent accidental runaway processes on shared cluster queues.