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:ARCANGEL0 EVA Session Lifecycle Management

From Leeroopedia
Knowledge Sources
Domains Pentest, Session_Management, UI_Architecture
Last Updated 2026-10-29 14:00 GMT

Overview

Lifecycle model for managing pentest engagement sessions — from creation and provider setup through agent interaction, Intel accumulation, and artifact export — with persistent state and mode-based interaction.

Description

A pentest session is the unit of an engagement in an agentic framework. It encapsulates:

  • Provider configuration: Which LLM provider, model, and reasoning settings drive the agent.
  • Conversation history: The full message log between operator and agent.
  • Session Intel: Structured intelligence accumulated during the engagement.
  • Operational mode: Recon, Guided, or AutoPwn — controlling agent autonomy.
  • Workspace: The file-system root where the agent operates.

The lifecycle flows through: creation (or resume of a prior session) → provider/model setup (model selection, reasoning defaults) → mode selection → agent engagement (turn loop) → Intel accumulation → artifact export (attack-surface map, reports).

Sessions are persisted as JSON with atomic writes (0o600 permissions) so they survive crashes and can be resumed. Each session has a UUID hex identifier and tracks creation/update timestamps.

Usage

Apply this principle when:

  • Building a multi-session application where each session has independent state.
  • Needing to resume interrupted engagements with full context.
  • Managing provider configuration that may differ per session.
  • Exporting engagement artifacts (maps, reports) at session end.

Theoretical Basis

The lifecycle follows a state machine with persistent transitions:

# Abstract algorithm (NOT real implementation)
states = {"created", "configured", "active", "paused", "exported"}
transitions = {
    "created": ["configured"],
    "configured": ["active", "paused"],
    "active": ["paused", "exported"],
    "paused": ["active"],
    "exported": ["active"],
}

Session persistence uses atomic file writes (temp file + os.replace) to prevent corruption:

# Abstract algorithm (NOT real implementation)
def save_session(record):
    temp = NamedTemporaryFile(dir=sessions_dir)
    json.dump(record, temp)
    os.fsync(temp.fileno())
    os.replace(temp.name, sessions_dir / f"{record['id']}.json")
    chmod(0o600)

Practical Guide

  • Use atomic writes for session persistence — never write directly to the target file.
  • Track updated_at on every save so sessions can be sorted by recency.
  • Store sessions under XDG data home (`~/.local/share/mitsu/sessions/`) with 0o700 directory permissions.
  • Apply reasoning defaults on session open — probe the provider for model capabilities.
  • Allow model mismatch recovery — if the saved model no longer exists, fall back to a safe default.

Related Pages

Implemented By

Page Connections

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