sec-af icon indicating copy to clipboard operation
sec-af copied to clipboard

quality: guided bounded-autonomy prompts — meta-level harness guidance

Open santoshkumarradha opened this issue 8 months ago • 0 comments

Problem

The current multi-turn prompt guidance in harness.py is generic and vague:

def _with_multi_turn_prompt(prompt: str) -> str:
    return (
        f"{prompt.rstrip()}\n\n"
        "IMPORTANT: This is a complex task. Take multiple turns. "
        "Explore first, gather evidence, build analysis incrementally, "
        "and write final JSON only when complete."
    )

"Explore first, gather evidence" is hand-wavy. It does not guide the LLM toward a specific cognitive process. The LLM has autonomy but no direction.

Architectural Principle Violated

Principle 2 (Guided Autonomy): Each agent operates within a constrained solution space. Guidance comes from task decomposition, explicit context boundaries, and predefined interaction patterns.

Cognitive Harness principle: By constraining output, we constrain the thought process.

Proposed Design: Phase-Aware Meta-Prompts

Key Principle: Guide at the Meta Level

Do NOT hardcode specific instructions. Instead, provide a cognitive framework the LLM applies to any task within the phase. This is bounded autonomy — the LLM decides what to do within the bounds we set.

Phase-Specific Guidance Templates

Recon: Survey → Identify → Map → Synthesize. Report what IS there, not what MIGHT be. Hunt: Review context → Identify relevant files → Trace data flow → Report with evidence. False negatives better than false positives. Prove: Read actual code → Trace flow → Check sanitization → Construct exploit hypothesis → Verdict. INCONCLUSIVE is valid.

What This Is NOT

  • NOT hardcoding search patterns
  • NOT telling the LLM which files to read
  • NOT constraining the exploration path
  • IS providing cognitive FRAMEWORK applied autonomously
  • IS setting quality bars (cite lines, do not guess)
  • IS defining evidence vs speculation

Additional Improvements

  1. Schema-Aware Output Guidance: Include field descriptions from Pydantic model in prompt
  2. Evidence-First Prompt Ordering: context → constraints → task → output (not current: task → vague guidance)
  3. Per-Agent-Type Prompts: Different sub-agents within prove (tracer vs exploit vs verdict) get different cognitive frames

Acceptance Criteria

  • [ ] Phase-specific guidance templates for recon, hunt, prove
  • [ ] Guidance is meta-level (cognitive framework, not hardcoded steps)
  • [ ] Schema field descriptions included in output guidance
  • [ ] Evidence-first prompt ordering
  • [ ] A/B comparison on DVGA: measure finding quality before/after
  • [ ] No hardcoded vulnerability patterns in guidance

Dependencies

  • Independent of all other issues
  • Improves quality across ALL phases

santoshkumarradha avatar Mar 05 '26 18:03 santoshkumarradha