analyze_agent_context

A command for checking whether a named software agent has enough instructions, tools, and context to complete its task.

In plain words
What is it for?
Use it to review the manager, ideation, experimentation, or writeup agent and examine its instructions, available tools, and experiment results.
Why use it?
It helps reveal missing information or unclear instructions before an agent starts work. If no results folder is supplied, it can run a new multi-agent experiment to inspect.

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/analyze_agent_context
Clone the repo
git clone --depth 1 https://github.com/ltjed/freephdlabor

Made for: Claude Code.

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 1,166 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.01166
Opus 5 $0.00000 $0.00583
Sonnet 5 $0.00000 $0.00233
Haiku 4.5 $0.00000 $0.00117

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

Security

Grade A, and why

analyze_agent_context 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 2d 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/analyze_agent_context.md · 99 lines

How it starts

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

You are tasked with analyzing agent instructions from the agent's perspective to evaluate whether they have sufficient information, context, and clarity to successfully perform requested tasks.

Arguments provided: $ARGUMENTS

The arguments should contain:

  1. agent_name (required): The specific agent to analyze (manager, ideation, experimentation, or writeup)
  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: Load Agent Instructions and Context

  • Read the current instructions for the specified agent: freephdlabor/prompts/{agent_name}_instructions.py
  • Review the agent's available tools in: freephdlabor/agents/{agent_name}_agent.py
  • Understand the agent's role within the multi-agent system

Step 3: Analyze Agent Task Reception Points

  • Read the JSONL file at results/{results_dir}/agent_llm_calls.jsonl
  • Critical: Find all occurrences when the specified agent first receives a new task from other agents
  • Since agent_llm_calls.jsonl is organized in temporal order, identify when the agent is initially invoked by another agent
  • For each task reception point, extract:
    • The exact task/instruction given to the agent
    • The context provided by the requesting agent
    • The agent's initial response and understanding
    • Any clarification requests or confusion indicators

Step 4: Perspective Analysis for Each Task Reception

For each identified task reception point, put yourself in the agent's shoes and evaluate:

Information Sufficiency at Task Reception:

  • Did the agent receive enough context to understand what was being asked?
  • Was the task scope and boundaries clearly communicated?
  • Did the agent have sufficient background information about the project/experiment?
  • Were dependencies and prerequisites clearly stated?

Read the full file on GitHub · 99 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. 2d ago First seen · 99 lines · 0 tokens per session scan A 304e8bdd90de

Subscribe to this mod's changes

analyze_agent_context is a command published in the GitHub repository ltjed/freephdlabor (703 stars, last pushed 3mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,166 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.