This directory contains tools and documentation for developing the Terraform Proxmox Provider.
Comprehensive guide for debugging the provider, including:
- Using mitmproxy to intercept and analyze API calls
- Common debugging scenarios
- Log analysis techniques
- Troubleshooting tips
Template for maintaining context across multi-step tasks. Use this when:
- Working on large PRs or refactors
- Implementing features that span multiple sessions
- Debugging complex issues
Usage:
- Copy to
.dev/<ISSUE_NUMBER>_SESSION_STATE.md(e.g.,1234_SESSION_STATE.md) - Files matching
*_SESSION_STATE.mdare auto-ignored by.gitignore - Update after each meaningful phase
Note: The following patterns are auto-ignored by
.gitignore:*_SESSION_STATE.md,*_PROGRESS.md,*_REPORT.md,*_PLAN.md
Enhanced mitmproxy script for analyzing provider-API interactions. Features:
- Categorizes API calls — Automatically identifies Storage, VM, Container, Network, Cluster APIs
- Filters output — Shows only Proxmox API calls (excludes other traffic noise)
- Highlights key parameters — Marks important query params:
content,vmid,node,storage,type - Pretty-prints JSON — Formatted request/response bodies for readability
- Shows data counts — Displays number of items returned from list APIs
- Visual indicators — ✅ for success (2xx), ❌ for errors (4xx, 5xx)
This section documents how to effectively use LLM agents (like Claude Code) for development work on this provider. The workflow is designed to maintain context across sessions, ensure quality, and produce verifiable results.
┌──────────────────────────────────────────────────────────────────────┐
│ DEVELOPMENT WORKFLOW │
└──────────────────────────────────────────────────────────────────────┘
┌─────────────┐
│ GitHub Issue│ ← All work starts with an issue
└──────┬──────┘
│
▼
┌─────────────┐ Creates:
│/bpg:start-issue │────→ • Branch: fix/1234-description
└──────┬──────┘ • Session state: .dev/1234_SESSION_STATE.md
│ • Clears stale logs
│
▼
┌─────────────┐
│ Development │ ← Write code, create tests
│ │
│ (implement) │
└──────┬──────┘
│
│ ┌─────────────┐
├─┤ /bpg:debug-api │ ← Use during development to verify
│ └─────────────┘ API calls are correct
│
▼
┌─────────────┐ Runs:
│ /bpg:ready │────→ • make build, lint, test
└──────┬──────┘ • Acceptance tests (with logging)
│ • API verification prompt
│ • Documentation check
│
▼
┌─────────────┐ Creates:
│/bpg:prepare-pr │────→ • .dev/1234_PR_BODY.md
└──────┬──────┘ • Filled PR template with proof of work
│
▼
┌─────────────┐
│ Submit PR │ ← gh pr create --body-file .dev/1234_PR_BODY.md
└─────────────┘
════════════════════════════════════════════════════════════════════
RESUMING WORK (after break, context loss, or new session):
┌─────────────┐ Loads:
│ /bpg:resume │────→ • Session state context
└──────┬──────┘ • Git state verification
│ • Existing log files
│ • Immediate next action
▼
Continue from where you left off...
When to use: Beginning work on any GitHub issue.
What it does:
- Verifies the issue exists on GitHub
- Determines issue type (bug fix →
fix/, feature →feat/) - Creates branch with proper naming:
{type}/{issue}-{description} - Creates session state file from template
- Populates session state with issue context
- Clears stale log files from previous work
Example:
You: /bpg:start-issue 1234
Agent: Creates fix/1234-vm-clone-timeout branch, session state, displays issue summary
When to use:
- Starting a new conversation to continue previous work
- After context loss or session timeout
- Returning to work after a break
What it does:
- Lists available session state files (if no issue specified)
- Loads session context and displays quick restore info
- Verifies git state matches session (prompts to switch if needed)
- Shows existing log files from previous runs
- Displays immediate next action
Example:
You: /bpg:resume
Agent: Shows available sessions, loads context, displays "Immediate Next Action: Verify test passes after fix"
When to use:
- Implementing new API parameters
- Debugging unexpected API behavior
- Verifying fix sends correct parameters
- When tests pass but behavior seems wrong
What it does:
- Starts mitmproxy on port 8080
- Runs acceptance test with proxy settings
- Captures all API traffic to
/tmp/api_debug.log - Analyzes traffic for specific parameters
- Reports findings with recommendations
Example:
You: /bpg:debug-api TestAccResourceVM content
Agent: Starts proxy, runs test, shows API calls containing "content" parameter
Key insight: Tests passing ≠ correct API calls. Always verify with mitmproxy for API changes.
When to use:
- Before declaring work complete
- Before creating a PR
- After implementing changes
What it does:
- Runs
make build— Must pass - Runs
make lint— Must show 0 issues - Runs
make test— All unit tests pass - Runs acceptance tests with verbose output →
/tmp/testacc.log - Prompts for API verification status
- Checks if documentation needs regeneration
- Updates session state with results
Example:
You: /bpg:ready TestAccResourceVMClone
Agent: Runs all checks, reports status, suggests /bpg:prepare-pr if all pass
When to use:
- After
/bpg:readypasses all checks - Before submitting a PR
What it does:
- Reads
.github/PULL_REQUEST_TEMPLATE.md - Fills "What does this PR do?" from commits and session state
- Verifies and checks Contributor's Note items
- Builds Proof of Work section from
/tmp/testacc.logand/tmp/api_debug.log - Sets issue link (Closes/Relates)
- Writes filled template to
.dev/{issue}_PR_BODY.md
Output is ready for gh pr create --body-file.
Example:
You: /bpg:prepare-pr 1234
Agent: Creates .dev/1234_PR_BODY.md, provides gh pr create command
1. /bpg:start-issue 1234 ← Setup branch and session
2. [Investigate and implement fix]
3. /bpg:debug-api TestAccBugFix ← Verify API calls
4. /bpg:ready TestAccBugFix ← Run full checklist
5. /bpg:prepare-pr 1234 ← Generate PR body
6. gh pr create --body-file .dev/1234_PR_BODY.md
1. /bpg:resume 1234 ← Load context
2. [Agent shows: "Next action: Run tests after implementing fix"]
3. [Continue from where you left off]
When the agent's context fills up during long work:
1. Agent updates session state before context loss
2. [New conversation]
3. /bpg:resume 1234 ← Restore full context
4. [Continue seamlessly]
1. /bpg:start-issue 1234 ← Work on first issue
2. [Complete work, /bpg:ready, /bpg:prepare-pr]
3. /bpg:start-issue 5678 ← Start second issue (clears logs)
4. [Work on second issue]
The skills share state through files:
| File | Written By | Read By |
|---|---|---|
.dev/{issue}_SESSION_STATE.md |
/bpg:start-issue, all skills update |
/bpg:resume, /bpg:ready, /bpg:prepare-pr |
/tmp/testacc.log |
/bpg:ready, /bpg:debug-api |
/bpg:prepare-pr, /bpg:resume |
/tmp/api_debug.log |
/bpg:debug-api |
/bpg:prepare-pr, /bpg:resume |
This allows:
/bpg:prepare-prto use test results from/bpg:readywithout re-running/bpg:resumeto note existing logs from previous runs- Session state to accumulate context across the workflow
Use parallel agents for independent tasks to speed up work:
Good candidates for parallel execution:
- Research tasks (explore different parts of codebase simultaneously)
- Running independent test suites
- Searching for patterns across different directories
- Gathering context from multiple unrelated files
Not suitable for parallel execution:
- Tasks with dependencies (B needs output of A)
- File modifications (risk of conflicts)
- Sequential workflows (test → fix → verify)
How to request: Ask for agents to run "in parallel" explicitly.
LLMs have no memory between sessions. Externalize state to files:
- Session state file — The agent's memory across context resets
- Update before ANY context switch — End of session, new task, long operation
- Write "next action" for a stranger — Assume no prior context
- User decisions — Never re-ask; record in session state
- Agent assumptions — Make explicit; mark verified/rejected
- Reasoning — "Why" matters more than "what"
- Form hypothesis → test → record result
- Prevents circular debugging across sessions
- Use "Hypotheses Tested" table in session state
- Cache code patterns and file locations in session state
- Record dead ends so they're not re-explored
- Note key file:line references for quick restoration
- Each commit = working, resumable state
- If session dies mid-work, resume from last commit
- "Tests pass" ≠ correct behavior
- Verify with mitmproxy when available, OR use behavioral assertions in tests (uptime checks, API status queries) to prove the behavior change
- Include evidence in PR proof of work section
- Scrutinize implementation against plan before declaring done — check every condition, test case, and step. Plans encode reasoning (e.g., why a guard should NOT be present); implementation must match.
For long-running tasks:
- Checkpoint frequently — Update session state after every successful test run
- Summarize completed work — Don't keep raw exploration in context; distill findings
- Chunk large changes — Break into atomic commits to create resume points
- Use
/bpg:resume— Start new sessions by loading session state, not from memory
When things go wrong:
- Test failures — Record in session state, add to "Hypotheses Tested", don't mark complete
- API errors — Capture in mitmproxy log, document in session state
- Context loss — Always resume from session state file using
/bpg:resume - Blocked work — Update session status to "Blocked", document blocker, move to next task
When handing off work:
- To another agent — Ensure "Quick Context Restore" is complete and current
- To human — Create PR using
/bpg:prepare-pr, reference session state location - From human — Use
/bpg:resume, ask about any "Unverified" assumptions
-
Always start with
/bpg:start-issue— Sets up proper branch naming and session tracking -
Update session state frequently — The agent will do this, but remind it before long operations
-
Use
/bpg:debug-apiliberally — API verification catches bugs that tests miss -
Don't skip
/bpg:ready— The checklist exists because each item has caught real bugs -
Use
/bpg:prepare-pr— Generates PR body with proof of work, ready forgh pr create -
Resume, don't restart — After breaks, use
/bpg:resumeinstead of re-explaining context -
Trust but verify — Review the agent's work, especially for complex logic
# Start proxy with enhanced script
mitmdump -s .dev/proxmox_debug_script.py --flow-detail 2 > /tmp/debug.log 2>&1 &
# Run your test
./testacc TestAccDatasourceFile
# View the output (shows categorized API calls)
cat /tmp/debug.log | grep "API"
# Stop the proxy
pkill -f mitmdump# Basic proxy with full URLs
mitmdump --flow-detail 2 > /tmp/test.log 2>&1 &
# Run test
./testacc TestAccYourNewFeature
# Check if parameter is sent
grep "your_param=" /tmp/test.log
# Cleanup
pkill -f mitmdump- Agent Instructions: CLAUDE.md — Primary guidelines for AI-assisted development
- Debugging Details: DEBUGGING.md — In-depth debugging guide
- Session Template: SESSION_STATE_TEMPLATE.md — Template for session files
When adding new tools or scripts to this directory:
- Document the tool in this README
- Reference it from DEBUGGING.md if applicable
- Update CLAUDE.md if it's a commonly-used workflow
- If adding a new skill, follow the patterns in
.claude/commands/