archived/skills/debug-headless/SKILL.md
Debug Claude Code or Gemini CLI in headless mode with full output capture.
npx skillsauth add nicsuzor/academicops debug-headlessInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Run Claude Code or Gemini CLI non-interactively with output and debug log capture.
# Run headless session
cd /path/to/project && claude -p "your prompt" --output-format json --model haiku
# Find the session file (most recent)
ls -lt ~/.claude/projects/-home-<user>-<project>/*.jsonl | head -1
# Generate readable transcript
cd $AOPS && uv run python scripts/session_transcript.py /path/to/session.jsonl
claude -p "prompt" --output-format json --model haiku 2>&1 | head -200
Key flags:
-p "prompt" - Non-interactive mode with prompt--output-format json - Structured output for parsing--model haiku - Faster/cheaper for testing (or sonnet for complex)--dangerously-skip-permissions - Skip permission prompts (use carefully)Sessions are stored at: ~/.claude/projects/-<path-with-dashes>/<uuid>.jsonl
# List recent sessions for a project
ls -lt ~/.claude/projects/-home-nic-src-academicOps/*.jsonl | head -5
# Find session by prompt content
grep -l "your prompt text" ~/.claude/projects/-home-nic-src-*/*.jsonl
cd $AOPS && uv run python scripts/session_transcript.py /path/to/session.jsonl
Output: Creates two files in $ACA_DATA/sessions/claude/:
*-full.md - Complete transcript with all tool results*-abridged.md - Compact view without tool output detailsUse the transcript - don't grep raw JSONL. The full transcript contains:
### Hook: EventName: ToolName ✓ - Hook execution markers### Subagent: type (description) - Inline subagent conversations## Subagent Transcripts - Orphan/warmup agents at endWhat to look for:
| Debug Question | Look In Transcript |
| --------------------- | ------------------------------------------------------------------ |
| Did custodiet fire? | ### Hook: PostToolUse entries + Task(subagent_type="custodiet" |
| What hooks ran? | All ### Hook: headings show event + tool |
| Where did it fail? | Search for ERROR, failed, exit [1-9] |
| What did subagent do? | ### Subagent: sections show full conversation |
| What was injected? | SessionStart hook content at beginning |
Custodiet threshold: Fires every ~5 "action" tool calls.
Skipped tools (don't count toward threshold):
Read, Glob, Grep, mcp__memory__retrieve_memoryParallel vs Sequential: Tools called in parallel (same turn) may count differently than sequential calls across multiple turns.
Use the full transcript to verify hooks:
| Hook | What to Check in Transcript |
| ---------------- | ----------------------------------------------- |
| SessionStart | First content block has AXIOMS.md/HEURISTICS.md |
| UserPromptSubmit | ### Hook: UserPromptSubmit ✓ after user turn |
| PostToolUse | ### Hook: PostToolUse: ToolName ✓ entries |
| Stop | No ✗ (exit N) markers on hooks |
Hook status indicators:
✓ = exit 0 (success)✗ (exit N) = non-zero exit (error)Hook not executing:
# Check settings.json configuration
cat ~/.claude/settings.json | jq '.hooks'
# Check hook file exists
ls -la $AOPS/hooks/*.py | head -10
Session exits with code 1:
sys.exit(0) for advisory messages| Tool | Headless Flag | Debug Flag | Auto-approve |
| ----------- | ------------- | ---------- | -------------------------------- |
| Claude Code | -p | -d | --dangerously-skip-permissions |
| Gemini CLI | (positional) | -d | -y / --yolo |
tools
Streamlit implementation of the analyst presentation layer. Use when building or updating a Streamlit dashboard that displays pre-computed research data. This is the Streamlit-specific HOW for the tech-agnostic principles in the aops-tools analyst skill — display only, never transform.
tools
Python plotting and statistical-modelling libraries (matplotlib, seaborn, statsmodels) for the analyst presentation and statistical-methodology layers. Use when producing publication-quality figures or fitting statistical models in Python. Library-specific HOW for the tech-agnostic principles in the aops-tools analyst skill.
tools
dbt (data build tool) implementation of the analyst transformation layer. Use when a project has a dbt/ directory or you need to build, test, or document SQL transformations as version-controlled, reproducible dbt models. This is the dbt-specific HOW for the tech-agnostic principles in the aops-tools analyst skill.
development
Core academicOps skill — institutional memory, strategic coordination, workflow routing, and framework governance. Merges butler (chief-of-staff) with framework development conventions.