refine_agent_prompt

refine_agent_prompt is a command for Claude Code from ltjed/freephdlabor. It costs 0 tokens per session (557 once invoked), scanned A, original, MIT.

A command for improving instructions used by a group of AI agents that work together on research papers.

In plain words
What is it for?
It helps analyze or optimize the manager, idea-generation, experimentation, and writing agents, using an existing results folder or by running a new experiment.
Why use it?
It compares the agents' results and identifies instruction problems that may reduce the quality of experiments or papers.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/ltjed/freephdlabor/refine_agent_prompt
Clone the repo
git clone --depth 1 https://github.com/ltjed/freephdlabor

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for refine_agent_prompt

README.md
[![agentmods](https://agentmods.dev/badge/commands/ltjed/freephdlabor/refine_agent_prompt.svg)](https://agentmods.dev/commands/ltjed/freephdlabor/refine_agent_prompt)
Your own site
<a href="https://agentmods.dev/commands/ltjed/freephdlabor/refine_agent_prompt"><img src="https://agentmods.dev/badge/commands/ltjed/freephdlabor/refine_agent_prompt.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 557 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00557
Opus 5 $0.00000 $0.00279
Sonnet 5 $0.00000 $0.00111
Haiku 4.5 $0.00000 $0.00056

Measured 5d ago against content hash 11a9a51fc19f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

refine_agent_prompt scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/refine_agent_prompt.md · 55 lines

How it starts

The opening of the file, as written. The whole thing — 55 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are tasked with optimizing the multi-agent workflow by iteratively improving agent instructions to produce high-quality papers publishable at top AI conferences.

Arguments provided: $ARGUMENTS

The arguments may or may not contain the following:

  1. agent_name (optional): The specific agent to optimize (manager, ideation, experimentation, or writeup). If not specified, analyze all agents.
  2. results_dir (optional): A specific results directory to analyze (e.g., "20250715_152703_adaptive_lr_cnn"). If not specified, run a new experiment first.

Your workflow:

Step 1: Determine Starting Point

  • If a results_dir is provided, skip to Step 2 with that directory
  • Otherwise, run the multi-agent system:
eval "$(conda shell.bash hook)" && conda activate freephdlabor && export $(cat .env | grep -v '^#' | xargs) && python launch_multiagent.py --model gpt-5.5 2>&1 | tee logs/output_$(date +%Y%m%d_%H%M%S).log

Step 2: Analyze Results

  • Read the JSONL file at results/{results_dir}/agent_llm_calls.jsonl
  • Focus on the specified agent_name if provided, otherwise analyze all agents
  • Identify issues such as:
    • Agent coordination problems
    • Task execution efficiency issues
    • Research quality and depth problems
    • Experimental design and execution issues
    • Inter-agent communication breakdowns

Step 3: Improve Instructions

Based on identified issues, modify the corresponding instruction files:

  • For specific agent: freephdlabor/prompts/{agent_name}_instructions.py
  • For all agents: Review and update all instruction files as needed

Important constraints:

  • Instructions are system prompts - keep them concise and actionable
  • Focus on improving agent behavior and coordination
  • Prioritize research quality and paper publishability
  • Do NOT modify code structure, only instruction content

Step 4: Commit Changes

Create a git commit with a clear message summarizing:

  • Which agent(s) were optimized
  • Key issues identified
  • Main improvements made

Read the full file on GitHub · 55 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 55 lines · 0 tokens per session scan A 11a9a51fc19f

Subscribe to this mod's changes

refine_agent_prompt is a command published in the GitHub repository ltjed/freephdlabor (715 stars, last pushed yesterday), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 557 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.