Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:AISecurityLab Hackagent Run Persistence

From Leeroopedia
Knowledge Sources
Domains Security_Testing, Persistence, Reporting
Last Updated 2026-10-29 00:00 GMT

Overview

A persistence pattern that records every attempt of a campaign run — request, response, verdict, trace, and evaluation — to a store (local SQLite or remote HTTP) and writes reproducible output files to disk.

Description

A red-team campaign produces structured evidence: which goals were attacked, what was sent, what came back, and whether the judges called it a jailbreak. Run persistence captures this in two forms:

Store records (via RunTracker):

  • An attack row and a run row when the attack starts (run status: RUNNING).
  • A result row per attempt, as soon as it is judged, with evaluation status (SUCCESSFUL_JAILBREAK, FAILED_JAILBREAK, ERROR_TEST_FRAMEWORK), evaluation metrics, response text, latency, and error.
  • Trace rows per attempt's search steps (when save_traces is on).
  • Final run status (COMPLETED, FAILED, CANCELLED) and run notes.

Output files (via write_outputs):

  • campaign.yaml: The campaign that ran, credentials redacted, for reproducibility.
  • results.json / results.jsonl: One row per attempt with goal, prompt, response, decoded text, evaluation, error.
  • traces.jsonl: Search traces of iterative attacks, one line per attempt, with each node's path for tree rebuilding.
  • audit.json: The judge audit report, when one ran.

The store supports two backends: local (SQLite file on this machine) and remote (HackAgent server, authenticated via environment variable). A caller-supplied store stays owned by the caller; one opened by the runner is closed before returning.

Usage

Use this principle when a security testing pipeline must produce auditable, reproducible evidence. Every attempt should be persisted as soon as it is judged, not batched at the end, so a crash leaves partial records rather than none.

Theoretical Basis

# Abstract algorithm (NOT real implementation)
def record(self, attempt):
    # Create result row immediately after judging
    record = store.create_result(run_id, attempt.goal, attempt.goal_index, ...)
    # Write trace rows
    for node in attempt.trace:
        store.create_trace(record.id, sequence, node.type, node.payload)
    # Update with evaluation
    store.update_result(record.id,
        evaluation_status=_evaluation_status(attempt),
        evaluation_metrics=eval_columns(attempt.verdict))

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment