agent stuck re-asking for scan parameters it already collected for authorized engagement
Fixes a pentest agent that keeps re-asking for scan parameters it already collected during an authorized engagement. Use when the agent repeats parameter questions instead of advancing the scan plan. Not for genuinely missing parameters the tester never supplied.
TL;DR
The agent has the parameters; it just lost the thread. Persist the collected scan parameters to a small engagement state file that the agent reads at the start of every turn, and gate every parameter question behind a lookup in that file first. One file, one lookup, the loop stops.
agent stuck re-asking for scan parameters it already collected for authorized engagementUse this when
- The agent asks for target range, scan profile, or intensity it was already given earlier in the same engagement.
- The same parameter question appears twice or more in one run.
- The engagement scope has not changed between the first answer and the repeat question.
Not for this skill when
- A parameter is genuinely new, or the scope changed and needs reconfirmation.
- The agent asks a human approver to confirm scope in writing. That is an authorization step, not a bug.
- The questions come from a different agent with no shared state. That is a handoff problem.
Steps
- Create an engagement state file, for example
engagement_state.jsonin the run directory, holding the parameters already collected: target scope, scan profile, intensity, tester contact. Verify: the file exists and holds the values the agent keeps re-asking for. - Add a session-start rule: before the agent asks any parameter question, it reads the state file and only asks when the field is empty. Verify: re-run the same turn and confirm no repeated question appears.
- Echo the loaded parameters back at the start of each planning turn in one line, so the reasoning stays grounded in stored state instead of conversation history that may have been truncated. Verify: the agent's next actions reference the stored values.
- When the tester answers a parameter, the agent writes it to the state file in the same turn, not later. Verify: the file timestamp updates within seconds of the answer.
- If the agent still repeats the question, search its logs for the parameter name and check whether a tool call is wiping or shadowing the file between turns. Verify: no tool in the loop deletes or overwrites the state file.
Variant phrasings
agent keeps asking for scan config it already has
Same fix path, phrased as config loss.
pentest agent repeats target questions
Scope-focused variant.
agent forgot engagement parameters mid-run
Long-run variant where context truncation is the usual cause.
Compatibility: any agent harness that supports file reads at turn start. The pattern works with CLI and API-driven harnesses alike.
Why it happens
Most harnesses inject earlier conversation as summarized context, and parameter answers are exactly the detail summarizers drop. A durable state file survives summarization, truncation, and restarts, which is why it fixes the loop permanently instead of once.
Edge cases / pitfalls
- Scope changes mid-engagement need an explicit state update, or the agent keeps using stale parameters and never asks. Treat any scope change as a state-file edit, then continue.
- Never store real tester credentials or secrets in the state file. Keep authentication out of it; the file holds scan parameters only.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_p3W2Ld699AmA3n3O-oiWvA