# How is engagement state and knowledge kept across a long run?

> Open-source AI pentest and offensive-security agents — a good answer covers: Memory stores, knowledge graphs, databases or files for hosts, services, credentials and findings; summarisation or compaction of long sessions; resuming an engagement.

Canonical page: https://llms-technical-reviews.com/offensive-security-agents/q/state-memory/

## Verdict

Nebula and Strix recover most completely from a crash mid-engagement. PentAGI keeps the fullest audit trail plus searchable memory, and RedAmon has the richest attack graph.

**Database or checkpoint resume.** [Nebula](/p/nebula/) stores every run, tool call, approval and finding in SQL and checkpoints missions to SQLite before each step. A routing journal replays the model's last decision after a crash, so a tool call is not repeated. [Strix](/p/strix/) keeps each agent's conversation in an SDK SQLite session and snapshots the agent tree to `agents.json`. A resume respawns children, and LLM compaction summarises old turns near the context limit. [PentAGI](/p/pentagi/) logs flows, message chains, tool calls and terminal output to PostgreSQL and reloads flows on restart. Tool results are anonymised, chunked and embedded in pgvector, with an optional Graphiti knowledge graph. [PentestGPT](/p/pentestgpt/) keeps runs, tasks, attempts and observations in SQLite and gives each role a bounded projection. Provider sessions always start fresh, and `--resume` requires an identical configuration hash.

**Files and checkpoints on disk.** [Shannon](/p/shannon/) git-commits each agent's deliverable, and resume reruns only incomplete agents from `session.json`. [RAPTOR](/p/raptor/) keeps a ledger and per-artifact `chain-state.json`, so an interrupted chain restarts at its first unsettled stage. [Decepticon](/p/decepticon/) uses the workspace as its shared store (objective DAG, findings, a locked `events.jsonl`), with Neo4j optional for some roles. [CyberStrike](/p/cyberstrike/) puts sessions, captured requests, intel and findings in one SQLite file and prunes old tool output when context fills.

**Graph-centred.** [RedAmon](/p/redamon/) checkpoints agent state to Postgres by default, falling back to memory without a database. It writes each attack chain to Neo4j, and a new session loads prior chains for the project.

**Thin or volatile.** [Pentest Swarm AI](/p/pentest-swarm-ai/) always uses an in-memory blackboard; its Postgres board has no caller, so a campaign cannot resume. Cross-campaign memory is a JSON file capped at 5,000 patterns. [PentestAgent](/p/pentestagent/) persists only `notes.json`, put back into prompts truncated to 200 characters; conversation and plan reset on each run. [HexStrike AI](/p/hexstrike-ai/) keeps everything in process memory.

Pick: Nebula or Strix for long runs that must survive restarts.
Pick: PentAGI when you want every command and output in a queryable database.
Pick: RedAmon when the attack-surface graph is the main working surface.

## Per-project answers

### usestrix/strix (answered)

Strix maintains scan state across several coordinated stores:

**ReportState** — A singleton `ReportState` (`report/state.py:197–956`) holds the in-memory vulnerability report list, run record (run name, start/end time, LLM usage, status, targets, config), and callback hooks. It persists to `run.json` on every state change (via `save_run_data()`) and writes artifact files (vulnerabilities JSON/CSV/MD, SARIF, coverage, executive report). On resume, `hydrate_from_run_dir()` (lines 260–331) reloads vulnerabilities and LLM usage from disk.

**SDK SQLite sessions** — Each agent gets a `SQLiteSession` stored in `agents.db` under the run's `.state/` directory (`core/sessions.py:43–45`). These hold the full conversation history (model responses, tool calls, results). Compaction via `llm/compaction.py:maybe_compact()` (lines 340–401) summarizes old turns when the context window is near capacity, producing a structured checkpoint (finding list, credentials, recon details, work state, failed attempts). It reads LiteLLM's model metadata for window size via `context_budget.py`, uses the LLM itself for summarization with the `_SUMMARY_INSTRUCTIONS` prompt (96 lines of dense extraction rules), and replaces old session items with the checkpoint.

**AgentCoordinator** — The in-memory coordinator (`core/agents.py:56–705`) tracks the agent graph: parent relationships, statuses (running/waiting/completed/stopped/crashed/failed/budget_paused), mailboxes (inter-agent message queues), recovery counts, wait kinds, and budget state. It snapshots to `agents.json` via `_maybe_snapshot()` (lines 684–704), using atomic temporary-file writes. On resume (`runner.py:341–383`), the snapshot is restored and subagents are respawned via `respawn_subagents()`.

**Knowledge tools** — Structured knowledge is stored and loaded from `.state/`: coverage entries (`hydrate_coverage_from_disk`), notes, threat models, todos. These are restored on resume so accumulated context survives.

**Resume mechanism** — `run_strix_scan()` (runner.py:290–731) detects a prior run by the existence of `agents.json`. It restores the coordinator snapshot, reopens each agent's SQLite session, respawns child agents in their prior state, and replays conversation from the SDK session database. A new `--instruction` on resume is injected as a fresh user message. Budget flags are recomputed from actual spend to avoid double-counting.


Citations: [strix/report/state.py:197-240](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/report/state.py#L197-L240) · [strix/report/state.py:260-331](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/report/state.py#L260-L331) · [strix/llm/compaction.py:1-20](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/llm/compaction.py#L1-L20) · [strix/llm/compaction.py:340-401](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/llm/compaction.py#L340-L401) · [strix/core/agents.py:56-100](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/core/agents.py#L56-L100) · [strix/core/agents.py:637-705](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/core/agents.py#L637-L705)

### KeygraphHQ/shannon (answered)

Engagement state is persisted through a **file-based audit and checkpoint system**, not an in-memory knowledge graph or database.

**Run Directory Structure**: Each scan writes to a workspace directory (`workspaces/{hostname}_{sessionId}/`). The top level holds the customer-facing report (PDF and Markdown); all internals — checkpoints, logs, prompts, agent deliverables, `session.json`, browser artifacts — live under a hidden `.shannon/` subdirectory (`apps/worker/src/audit/utils.ts:52-54`).

**Session State**: `session.json` records the canonical workflow state including completed agents, expected agents, participating classes, report progress (stage, partial reasons, model checkpoint), and the miscellaneous exploitation outcome (`apps/worker/src/audit/utils.ts:59-62`). This is the file resume reads to determine which agents to skip.

**Workflow Logger** (`apps/worker/src/audit/workflow-logger.ts`): A combined `workflow.log` provides human-readable per-workflow logs backed by `LogStream` (`apps/worker/src/audit/log-stream.ts`). Every combined-log line is also projected into per-agent files under `.shannon/agents/<slug>.log` via `actor-projection.ts`. Capella stages get their own per-stage trace queues drained before the activity returns.

**Git Checkpoints**: After each agent completes successfully, its deliverable is git-committed to a deliverables repo within the workspace. On resume, the workflow restores the git checkpoint, removes incomplete agent deliverables, and only re-routes missing agents (`apps/worker/src/temporal/workflows.ts:1318-1342`). Rollback is handled by `rollbackGitWorkspace` in `apps/worker/src/services/agent-execution.ts:410-415`.

**Reconciliation Artifact Store** (`apps/worker/src/ai/reconciliation/artifact-store.ts`): A file-based store for reconciliation observations and tasks, referenced by opaque artifact refs passed between reconciliation stages. Each stage (prepare, enrich, form, materialize, publish) writes its output as a durable artifact.

**No summarization or compaction of long sessions** beyond pi's built-in **context compaction** (`compaction: { enabled: true }` in `apps/worker/src/ai/pi/pi-executor.ts:344`), which compresses the transcript when it approaches the context window. There is no knowledge graph, semantic memory store, or cross-session learning. Each task `child session` accumulates its usage separately; the parent totals its own plus child spend.


Citations: [apps/worker/src/audit/utils.ts:42-80](https://github.com/KeygraphHQ/shannon/blob/b9744f6cecc5429333873b86a6762f1d70c54fc2/apps/worker/src/audit/utils.ts#L42-L80) · [apps/worker/src/temporal/workflows.ts:1296-1342](https://github.com/KeygraphHQ/shannon/blob/b9744f6cecc5429333873b86a6762f1d70c54fc2/apps/worker/src/temporal/workflows.ts#L1296-L1342) · [apps/worker/src/services/agent-execution.ts:295-340](https://github.com/KeygraphHQ/shannon/blob/b9744f6cecc5429333873b86a6762f1d70c54fc2/apps/worker/src/services/agent-execution.ts#L295-L340) · [apps/worker/src/ai/pi/pi-executor.ts:332-346](https://github.com/KeygraphHQ/shannon/blob/b9744f6cecc5429333873b86a6762f1d70c54fc2/apps/worker/src/ai/pi/pi-executor.ts#L332-L346) · [apps/worker/src/temporal/workflows.ts:480-504](https://github.com/KeygraphHQ/shannon/blob/b9744f6cecc5429333873b86a6762f1d70c54fc2/apps/worker/src/temporal/workflows.ts#L480-L504)

### vxcontrol/pentagi (answered)

Engagement state and knowledge are persisted across three primary stores: PostgreSQL (relational), pgvector (semantic memory), and optionally Graphiti (temporal knowledge graph).

**Relational (PostgreSQL).** Every action is logged in structured tables: `Flow`, `Task`, `Subtask` with status lifecycle (Created→Running→Waiting→Finished/Failed); `Msgchain` stores the full LLM conversation chain (messages JSON blob, plus token usage and cost); `Toolcall` records each tool call with args and result; `Termlog` captures terminal stdin/stdout/stderr; `Agentlog` tracks which agent role initiated/executed what. All models are in `pkg/database/models.go`. The status propagation chain flows upwards: subtask → task → flow (`pkg/controller/subtask.go:216-231`).

**Semantic (pgvector).** Tool results from terminal, file, search, and agent tools are automatically stored into the pgvector store via `storeToolResult()` (`pkg/tools/executor.go:597-683`). Results are split into chunks (2000-char recursive character splitter, lines 610-618), anonymized using a pattern-based replacer (IPs, domains, credentials), and embedded with the configured `Embedder`. Agents retrieve past findings through `search_in_memory` (memory tool), `search_guide`, `search_answer`, and `search_code` tools. Retrieval is by similarity search (cosine, threshold 0.2, limit 3, `pkg/tools/memory.go:24-26`).

**Knowledge graph (Graphiti, optional).** Agent responses and tool executions are optionally logged to a Graphiti temporal knowledge graph server over HTTP (`pkg/graphiti/`). Agent responses are stored via `storeAgentResponseToGraphiti()` (`pkg/providers/performer.go:1011-1089`) and tool executions via `storeToolExecutionToGraphiti()` starting at line 1092. Agents can query Graphiti using the `graphiti_search` tool with 7 search types (temporal window, entity relationships, diverse results, episode context, successful tools, etc.) — see registry.go:347-357.

**Summarization and compaction.** The `performer` chain loop calls `compactChainForWindow()` (performer.go:139-148) and `SummarizeChain()` (line 258) to compact long message chains when they exceed context windows. The summarizer is role-specific, driven by `pkg/csum/` package.

**Resumability.** Flows can be loaded from the database on restart via `LoadFlowWorker()` (`pkg/controller/flow.go:339-526`), which restores tasks, subtasks, message chains, containers, and assistant workers.


Citations: [backend/pkg/database/models.go:869-1064](https://github.com/vxcontrol/pentagi/blob/cffed9485aa1cca70762cd08a57ac62a80406258/backend/pkg/database/models.go#L869-L1064) · [backend/pkg/tools/executor.go:597-683](https://github.com/vxcontrol/pentagi/blob/cffed9485aa1cca70762cd08a57ac62a80406258/backend/pkg/tools/executor.go#L597-L683) · [backend/pkg/tools/memory.go:22-155](https://github.com/vxcontrol/pentagi/blob/cffed9485aa1cca70762cd08a57ac62a80406258/backend/pkg/tools/memory.go#L22-L155) · [backend/pkg/providers/performer.go:1011-1089](https://github.com/vxcontrol/pentagi/blob/cffed9485aa1cca70762cd08a57ac62a80406258/backend/pkg/providers/performer.go#L1011-L1089) · [backend/pkg/controller/flow.go:339-526](https://github.com/vxcontrol/pentagi/blob/cffed9485aa1cca70762cd08a57ac62a80406258/backend/pkg/controller/flow.go#L339-L526)

### GreyDGL/PentestGPT (answered)

All canonical state lives in **SQLite**, managed by `MemoryKernel` (`memory.py:140`). The database stores five tables: `runs` (goal, status, revision, allowed_targets), `tasks` (id, kind, target, objective, done_when, basis_ids, depends_on, status), `attempts` (id, task_id, status, revision, trace_episode_id, summary, failure_kind/message), `observations` (exact evidence quote with full identity provenance), and `transitions` (append-only revision log with kind, detail, and timestamp). WAL mode with synchronous=FULL ensures durability without concurrency overhead. There is **no knowledge graph, vector store, or RAG layer**. Each `RunSnapshot` (`memory.py:46-57`) is a full materialized view projected from the SQLite state on every read. The Supervisor receives a **bounded projection** of this state — not the full history — limited to open tasks, four recent closed tasks, required dependency/basis context, the six most recent observations, and four recent diagnostic attempts (`agents.py:360-471`). The Executor receives only its one task, its explicit basis (up to 8 observations), up to two same-task prior observations, and one retry diagnostic. Provider conversation history is not preserved between episodes — every episode uses `resume = null`. The `TraceStore` (`trace.py:65`) persists diagnostic episode traces as filesystem journals (`input.json`, `events.jsonl`, `output.json` per episode) but traces are not memory — they are diagnostic only. For resumption, the trial stores an identity hash (`trial-config.json`) of the full configuration; `--resume` requires an exact match including goal, targets, provider, model, effort, prompt/schema hashes, sandbox policy, and unified-agent version (`trial.py:147-152`). The legacy client (`pentestgpt_legacy/`) stores conversation history in an in-memory dictionary per model role (`pentest_gpt.py:72-99`) and saves transcripts to files on exit.


Citations: [pentestgpt_agent/src/pentestgpt_agent/memory.py:140-250](https://github.com/GreyDGL/PentestGPT/blob/e8b1bb77d1ac00329675cec3b060aba971ec1ac8/pentestgpt_agent/src/pentestgpt_agent/memory.py#L140-L250) · [pentestgpt_agent/src/pentestgpt_agent/memory.py:286-429](https://github.com/GreyDGL/PentestGPT/blob/e8b1bb77d1ac00329675cec3b060aba971ec1ac8/pentestgpt_agent/src/pentestgpt_agent/memory.py#L286-L429) · [pentestgpt_agent/src/pentestgpt_agent/agents.py:360-471](https://github.com/GreyDGL/PentestGPT/blob/e8b1bb77d1ac00329675cec3b060aba971ec1ac8/pentestgpt_agent/src/pentestgpt_agent/agents.py#L360-L471) · [pentestgpt_agent/src/pentestgpt_agent/trial.py:143-155](https://github.com/GreyDGL/PentestGPT/blob/e8b1bb77d1ac00329675cec3b060aba971ec1ac8/pentestgpt_agent/src/pentestgpt_agent/trial.py#L143-L155)

### 0x4m4/hexstrike-ai (answered)

**State management is purely in-memory with no persistence across server restarts or long-run compaction.** The server initialises several global singleton instances at module level: `cache = HexStrikeCache()` (line 6734) is an `OrderedDict`-backed LRU cache with TTL that stores command execution results keyed by MD5 hash — it resets on server restart. `telemetry = TelemetryCollector()` (line 6781) tracks cumulative command counts and success rates in a simple in-memory dict. `ProcessManager` (line 5576) and `ProcessPool` (line 4877) keep dicts of active PIDs with progress info, all volatile. The `CTFChallengeAutomator` has `active_challenges`, `solution_cache`, and `learning_database` (line 3858) — all plain dicts. The `CVEIntelligenceManager` has `cve_cache` and `vulnerability_db` (line 5754) — also in-memory dicts with no database backend. There is no SQLite, no filesystem persistence for session state, no knowledge graph, and no mechanism to resume an interrupted engagement. The `AdvancedCache` (line 5085) has a background cleanup thread for expired entries but does not survive a restart. Long-running commands are tracked by PID with progress bars and ETA estimates cycled through the spinner animation, but the process state is lost if the server dies. Summarisation or compaction of long sessions does not exist — the system has no concept of a session lifecycle.


Citations: [hexstrike_server.py:6668-6734](https://github.com/0x4m4/hexstrike-ai/blob/d689933ff579d839c676c82b231f8e98326c5f04/hexstrike_server.py#L6668-L6734) · [hexstrike_server.py:6736-6781](https://github.com/0x4m4/hexstrike-ai/blob/d689933ff579d839c676c82b231f8e98326c5f04/hexstrike_server.py#L6736-L6781) · [hexstrike_server.py:3855-3876](https://github.com/0x4m4/hexstrike-ai/blob/d689933ff579d839c676c82b231f8e98326c5f04/hexstrike_server.py#L3855-L3876) · [hexstrike_server.py:5750-5760](https://github.com/0x4m4/hexstrike-ai/blob/d689933ff579d839c676c82b231f8e98326c5f04/hexstrike_server.py#L5750-L5760) · [hexstrike_server.py:5085-5134](https://github.com/0x4m4/hexstrike-ai/blob/d689933ff579d839c676c82b231f8e98326c5f04/hexstrike_server.py#L5085-L5134)

### BitterSecurity/Decepticon (answered)

**Multiple coordinated persistence mechanisms.** Engagement state is kept across turns through four complementary stores, each with a different purpose and lifetime.

**1. OPPLAN (the tactical plan).** The Operations Plan is a DAG of objectives persisted at `/workspace/plan/opplan.json` in the engagement filesystem. `OPPLANMiddleware` (`middleware/opplan.py`, lines 1–58) injects objective status into every LLM call (battle tracker), supports versioned DAG commits to prevent parallel mutation, and exposes CRUD tools (`commit_opplan`, `update_objective`, `list_objectives`). Each objective tracks phase, status (pending/in-progress/blocked/completed/cancelled), OPSEC level, notes, blocked_by dependencies, and C2 tier.

**2. Event log.** Each engagement has an append-only `events.jsonl` file (`runtime/event_log.py`, lines 1–80) under `<workspace>/events.jsonl`. It uses platform-appropriate exclusive file locking (POSIX `flock` / Windows `msvcrt`) so concurrent sub-agents do not interleave lines. The `EventType` enum provides typed event categories. `read_events()` yields events in order, skipping malformed lines for crash resilience.

**3. Knowledge graph (optional Neo4j).** `KGMiddleware` (`middleware/kg.py`, lines 1–77) attaches Neo4j-backed attack graph state to analyst/operator agents. Tools `kg_record(observations)` and `kg_ingest(scanner_kind, path)` let agents write hosts, services, credentials, and findings as typed nodes and edges with provenance. A cached summary block is injected into every system prompt and rebuilt when the graph revision advances. The KG is optional — it degrades gracefully with a single warning when Neo4j env vars are unset (`middleware/kg_internal/store.py`).

**4. Workspace filesystem.** The engagement workspace directory (`/workspace/<slug>/`) is the authoritative shared store, accessible to all sub-agents over the HTTPSandbox HTTP transport (via `CompositeBackend`). Agents write findings (`findings/`), recon data (`recon/`), and evidence (`evidence/`) as structured markdown and JSON files.

**Context compaction.** `SummarizationMiddleware` (slot `SUMMARIZATION` in `middleware_slots.py`, lines 445–446) auto-compacts long sessions via deepagents' summarization engine. The `_SafeSummarizationProxy` (lines 267–443) wraps it with a fallback: summarization failures log a warning and skip the turn rather than aborting the run. Compaction events are emitted to the event log for operator visibility. The `RecordingMiddleware`/`ReplayMiddleware` (`runtime/recording.py`) support full session recording for post-engagement replay.


Citations: [packages/decepticon/decepticon/middleware/opplan.py:1-58](https://github.com/BitterSecurity/Decepticon/blob/cd252a5467b91ccfdb46fde9562c75d671d33604/packages/decepticon/decepticon/middleware/opplan.py#L1-L58) · [packages/decepticon/decepticon/runtime/event_log.py:1-80](https://github.com/BitterSecurity/Decepticon/blob/cd252a5467b91ccfdb46fde9562c75d671d33604/packages/decepticon/decepticon/runtime/event_log.py#L1-L80) · [packages/decepticon/decepticon/middleware/kg.py:1-77](https://github.com/BitterSecurity/Decepticon/blob/cd252a5467b91ccfdb46fde9562c75d671d33604/packages/decepticon/decepticon/middleware/kg.py#L1-L77) · [packages/decepticon/decepticon/agents/middleware_slots.py:267-446](https://github.com/BitterSecurity/Decepticon/blob/cd252a5467b91ccfdb46fde9562c75d671d33604/packages/decepticon/decepticon/agents/middleware_slots.py#L267-L446)

### gadievron/raptor (answered)

Engagement state is stored durably on disk in the run output directory, not in RAM or a graph database. The **engagement ledger** (`core/engagement/ledger.py`) is a `ledger.json` document with every artifact row, its content identity, exposure features, policy slots (tier assignments), reservation slots (budget charges), and an append-only `policy_amendments` trail. Per-artifact chain state is in `<output_dir>/chains/<artifact-id>/chain-state.json` — an interrupted chain resumes from the first unsettled stage, judged by artifact existence plus recorded state, never wall-clock. The **engagement supervisor** (`core/engagement/supervise.py`) persists a `engagement-state.json` with a code pin (framework source-control SHA + models config hash), segment counter, and budget figures. Parks are recorded durably in `engagement-parks.json` with a `PARKED` marker file surfaced by the project status view. The **SAGE persistent memory** system (`core/sage/`) provides consensus-validated cross-run persistence across domains like `raptor-findings-{repo_key}`, `raptor-fuzzing`, `raptor-methodology`, `raptor-fp-{repo_key}` (false positive suppression), `raptor-rule-library`, and `raptor-audit-{repo_key}`. SAGE stores are accessed through mechanical hooks (`core/sage/hooks.py`) that make hard skip/suppress decisions — no prompt injection from recalled text. Rows are MAC-stamped (`core/sage/rowmac.py`); recall verifies the MAC over decision fields before any mechanical effect, and unverified rows degrade to hints only. Session summarisation is achieved through the phase/pass structure of the supervisor: after each pass, an interim report (`engagement-interim-report.md`) is written with policy, feasibility, committed spend, per-row status, and park summaries. Compaction of long sessions is handled by the `_MAX_PASSES` cap and the per-pass boundary checks (drain requests, wall bounds) that pause cleanly rather than accumulating infinite churn.


Citations: [core/engagement/ledger.py:1-132](https://github.com/gadievron/raptor/blob/265236fc9f328be7df46cee36969fd447463c3c6/core/engagement/ledger.py#L1-L132) · [core/engagement/supervise.py:178-300](https://github.com/gadievron/raptor/blob/265236fc9f328be7df46cee36969fd447463c3c6/core/engagement/supervise.py#L178-L300) · [core/sage/memory.py:1-60](https://github.com/gadievron/raptor/blob/265236fc9f328be7df46cee36969fd447463c3c6/core/sage/memory.py#L1-L60) · [core/sage/hooks.py:1-60](https://github.com/gadievron/raptor/blob/265236fc9f328be7df46cee36969fd447463c3c6/core/sage/hooks.py#L1-L60) · [core/engagement/chain_elf.py:36-91](https://github.com/gadievron/raptor/blob/265236fc9f328be7df46cee36969fd447463c3c6/core/engagement/chain_elf.py#L36-L91)

### CyberStrikeus/CyberStrike (answered)

**SQLite persistence.** All engagement state is stored in a local SQLite database (via Drizzle ORM). Key tables include: `intel_entry` (discovered assets, endpoints, technologies), `vulnerability` (findings with severity/status), `methodology_phase` (phase progress), `vrt_check` (per-intel-entry test results), `chain_candidate` (attack chain detections), `request` (captured HTTP requests), and `coverage_note` (what was tested by which agent). The database is project-scoped under the `.cyberstrike` directory.

**Intel system** (`methodology/intel.ts`): Each discovered asset/endpoint is logged via `add_intel` with type, asset, severity, confidence, tags, and chain potential. Entries auto-generate VRT checklists for systematic testing. Dedup prevents duplicate entries. Chains are auto-detected (`Chain.detect()`) when findings across multiple entries could combine into high-impact exploits (8 patterns: credential+endpoint, info_disclosure+ssrf, redirect+oauth, idor+data_leak, xss+csrf, ssti+rce, race_condition+business, custom).

**Session compaction** (`session/compaction.ts`): When total tokens approach the model's context limit (minus a 20K token buffer), the system prunes old tool call outputs, keeping only the last ~40K tokens of tool interactions. Compaction preserves the task structure (subtask parts) while stripping verbose command output.

**Memory system** (`memory/index.ts`): File-based long-term memory stored in `.cyberstrike/memory/MEMORY.md` with daily notes in `.cyberstrike/memory/<date>.md`. Supports append-to-long-term, append-to-daily, search, and getSessionContext (which returns yesterday's + today's notes + long-term memory). Memory tools are exposed to agents via `MemorySearchTool`, `MemoryWriteTool`, `MemoryReadTool`, and `MemoryContextTool`.

**Session chaining.** Child sessions are created for subagent task execution (`Session.create({parentID})`), allowing recursive decomposition of work while maintaining the audit trail.


Citations: [packages/cyberstrike/src/methodology/intel.ts:1-120](https://github.com/CyberStrikeus/CyberStrike/blob/61044eddf31d1549b54cea64a5c0dd694ab0341b/packages/cyberstrike/src/methodology/intel.ts#L1-L120) · [packages/cyberstrike/src/memory/index.ts:1-220](https://github.com/CyberStrikeus/CyberStrike/blob/61044eddf31d1549b54cea64a5c0dd694ab0341b/packages/cyberstrike/src/memory/index.ts#L1-L220) · [packages/cyberstrike/src/session/compaction.ts:1-60](https://github.com/CyberStrikeus/CyberStrike/blob/61044eddf31d1549b54cea64a5c0dd694ab0341b/packages/cyberstrike/src/session/compaction.ts#L1-L60) · [packages/cyberstrike/src/methodology/chain.ts:1-80](https://github.com/CyberStrikeus/CyberStrike/blob/61044eddf31d1549b54cea64a5c0dd694ab0341b/packages/cyberstrike/src/methodology/chain.ts#L1-L80) · [packages/cyberstrike/src/session/vulnerability.ts:1-100](https://github.com/CyberStrikeus/CyberStrike/blob/61044eddf31d1549b54cea64a5c0dd694ab0341b/packages/cyberstrike/src/session/vulnerability.ts#L1-L100)

### samugit83/redamon (answered)

**AgentState in LangGraph** is the primary memory store (`state.py:978`): a `TypedDict` holding messages, execution trace, todo list, objectives, target info, chain findings memory, chain failures memory, chain decisions memory, chain waves memory, LATS tree state, QA history, phase history, fireteam plans, and token accounting. All this lives inside LangGraph's `MemorySaver` checkpointer by default (in-memory), replaced with `AsyncPostgresSaver` (`orchestrator.py:160-196`) when `PERSISTENT_CHECKPOINTER=true`, persisting the full state to Postgres via `psycopg_pool`. The thread_id is `user_id:project_id:session_id` (`config.py:55`), enabling session resume.

**Neo4j graph persistence.** The `chain_graph_writer.py` module writes the attack chain to Neo4j as fire-and-forget operations on a dedicated writer thread: `AttackChain` nodes (per session), `ChainStep` nodes (one per iteration), `ChainFinding`/`ChainFailure`/`ChainDecision` nodes, all linked by `NEXT_STEP`/`HAS_PARENT` relationships. This provides a durable, queryable attack graph separate from the agent's in-memory state. The `fire_create_attack_chain()` and `fire_record_*()` functions are called from initialization, tool confirmation, approval, and completion nodes.

**Chain memory stores** (`chain_findings_memory`, `chain_failures_memory`, `chain_decisions_memory`, `chain_waves_memory`) are accumulated lists on `AgentState` that survive across objectives (cleared only on session reset). `chain_decisions_memory` tracks phase transitions and operator decisions. `chain_waves_memory` tracks completed fireteam waves even when they produce zero findings (for coverage awareness).

**Execution trace summarization.** `format_chain_context()` (`state.py:1694`) renders the attack chain for the LLM prompt, grouping tool calls by iteration. `summarize_trace_for_response()` (`state.py:1529`) truncates to the last N steps for API responses. A cap of `EXECUTION_TRACE_MEMORY_STEPS` (default 100) prevents unbounded growth. LATS tree summaries are carried into execution_trace via `_carry_tree_forward()` (`lats.py:1650-1672`), and a persistent digest (`_lats_tree_digest`, `_lats_leads`, `_lats_dead`) survives execution trace eviction.

**Resumption.** Sessions resume by recovering the persisted state from Postgres via `graph.aget_state(config)` in the various `resume_*_with_streaming()` methods (`orchestrator.py:1183-1401`). The last checkpoint's state is loaded, the user's response injected, and `graph.astream()` continues from where it paused.

**Prior chain context.** On first invocation of a new session, `initialize_node` (`initialize_node.py:518-534`) queries Neo4j for prior chains from the same project (with a 15-second timeout), rendering them as `_prior_chain_context` in state. This allows the agent to see past attack chain results when starting a new objective.

> **Editor's note.** Correction: the persistent Postgres checkpointer is the default (`PERSISTENT_CHECKPOINTER: True` in agentic/project_settings.py L98, and set to "true" in docker-compose.yml); `MemorySaver` is only the fallback when it is switched off or `DATABASE_URL` is missing.

Citations: [agentic/state.py:978-1078](https://github.com/samugit83/redamon/blob/b13da9cb5ad35ae75428b8f21794e799a25fd201/agentic/state.py#L978-L1078) · [agentic/orchestrator.py:160-196](https://github.com/samugit83/redamon/blob/b13da9cb5ad35ae75428b8f21794e799a25fd201/agentic/orchestrator.py#L160-L196) · [agentic/orchestrator_helpers/chain_graph_writer.py:1-60](https://github.com/samugit83/redamon/blob/b13da9cb5ad35ae75428b8f21794e799a25fd201/agentic/orchestrator_helpers/chain_graph_writer.py#L1-L60) · [agentic/state.py:1529-1545](https://github.com/samugit83/redamon/blob/b13da9cb5ad35ae75428b8f21794e799a25fd201/agentic/state.py#L1529-L1545) · [agentic/orchestrator_helpers/lats.py:1650-1672](https://github.com/samugit83/redamon/blob/b13da9cb5ad35ae75428b8f21794e799a25fd201/agentic/orchestrator_helpers/lats.py#L1650-L1672) · [agentic/orchestrator_helpers/nodes/initialize_node.py:518-534](https://github.com/samugit83/redamon/blob/b13da9cb5ad35ae75428b8f21794e799a25fd201/agentic/orchestrator_helpers/nodes/initialize_node.py#L518-L534)

### GH05TCREW/pentestagent (answered)

**Persistent notes store.** The primary persistence mechanism is the `notes` tool, which writes to `loot/notes.json` (`tools/notes/__init__.py:18-23`). Notes survive across sessions and are loaded into the agent system prompt on each turn (truncated to 200 chars per note to save tokens, `pa_agent.py:86-88`). The full content can be retrieved via the `notes` tool's `read` action. An asyncio lock (`_notes_lock`) ensures safe concurrent access from multiple agents.

**Workspace-based state.** `WorkspaceManager` (`workspaces/manager.py:66`) stores per-workspace YAML at `workspaces/{name}/meta.yaml` containing targets list, creation timestamp, last active timestamp, operator notes, and tool run history. All operations read/write files directly — no in-memory caching. Loot directories are organized under each workspace (`loot/`, `knowledge/sources/`, `knowledge/embeddings/`, `notes/`, `memory/`).

**Conversation history summarization.** `ConversationMemory` (`llm/memory.py:31`) manages token budgets. When the conversation exceeds 60% of the token budget (`summarize_threshold=0.6`), the oldest messages (beyond `recent_to_keep=10`) are summarized by the LLM itself into a technical summary that preserves targets, versions, credentials, and attack vectors. Summarization is chunked in groups of 10 messages. The cached summary is prepended as a system message on subsequent turns. Token counting uses `tiktoken` (cl100k_base) with a fallback to word-count estimation.

**ShadowGraph (crew mode only).** The `ShadowGraph` (`knowledge/graph.py:46`) builds a NetworkX directed graph from notes, extracting entities: hosts (via IP regex), services (port/product/version), credentials (username/password), vulnerabilities (CVE/weaknesses), endpoints, and technologies. It produces strategic insights for the crew orchestrator, including attack paths via `nx.shortest_path`. The graph is rebuilt each orchestrator cycle from the notes.

**MCP-level memory.** The MCP server provides `store_memory`/`retrieve_memory`/`clear_memory` tools (`mcp/server/mcp_tools.py:838-923`) as an in-memory key-value store with timestamps and substring search. This is session-scoped and not persisted to disk.

**Conversation store (TUI).** When a user forks a conversation from the TUI, `ConversationStore` (`interface/conversation_store.py`) saves the full conversation to the workspace directory, enabling retrieval and branching while preserving alternative threads.

**No engagement resume mechanism.** While notes survive to disk, there is no structured facility to reload agent state (conversation history, plan state, worker pool) from a previous session. Each `agent_loop()` call resets the plan and conversation history (`base_agent.py:264`).


Citations: [pentestagent/tools/notes/__init__.py:1-24](https://github.com/GH05TCREW/pentestagent/blob/8dde193e41d34ac53ee87374316e5d2fe7cec946/pentestagent/tools/notes/__init__.py#L1-L24) · [pentestagent/llm/memory.py:31-175](https://github.com/GH05TCREW/pentestagent/blob/8dde193e41d34ac53ee87374316e5d2fe7cec946/pentestagent/llm/memory.py#L31-L175) · [pentestagent/knowledge/graph.py:46-100](https://github.com/GH05TCREW/pentestagent/blob/8dde193e41d34ac53ee87374316e5d2fe7cec946/pentestagent/knowledge/graph.py#L46-L100) · [pentestagent/workspaces/manager.py:66-120](https://github.com/GH05TCREW/pentestagent/blob/8dde193e41d34ac53ee87374316e5d2fe7cec946/pentestagent/workspaces/manager.py#L66-L120) · [pentestagent/mcp/server/mcp_tools.py:838-923](https://github.com/GH05TCREW/pentestagent/blob/8dde193e41d34ac53ee87374316e5d2fe7cec946/pentestagent/mcp/server/mcp_tools.py#L838-L923) · [pentestagent/agents/pa_agent/pa_agent.py:45-120](https://github.com/GH05TCREW/pentestagent/blob/8dde193e41d34ac53ee87374316e5d2fe7cec946/pentestagent/agents/pa_agent/pa_agent.py#L45-L120)

### Armur-Ai/Pentest-Swarm-AI (answered)

State is maintained across three distinct storage systems with different lifetimes.

**In-campaign: the blackboard** (`internal/swarm/blackboard/`). The `Board` interface (`board.go:12-54`) provides `Write`, `Query`, `Subscribe`, cursor tracking and budget operations. Each `Finding` (`types.go:59-74`) carries a `PheromoneBase`, `HalfLifeSec` decay, and typed data. Agents subscribe via `Predicate` (type filter + MinPheromone gate) and receive a channel of matching findings. The board is memory-backed by default (`NewMemoryBoard` in `swarm_runner.go:284`), with a Postgres variant selected when a DB pool is available. The scheduler tracks per-agent cursors for exactly-once delivery (`board.go:29-34`). Pheromone-based decay means stale findings naturally deprioritize without explicit compaction.

**Cross-campaign: MemoryStore** (`internal/memory/store.go:19-26`, `persist.go:14-69`). After a campaign, the engine calls `ExtractPatterns` and stores learned patterns in a `MemoryStore` with categories: tech_stack, attack_chain, false_positive, timing. Each entry has `Confidence`, `UsageCount`, and `LastUsed`. On subsequent runs, `RecallRelevant` matches target keywords against stored patterns (`store.go:42-56`) and feeds the resulting brief to the recon agent (`swarm_runner.go:468-471`). The store persists to `~/.pentestswarm/memory.json` (capped at 5000 entries, oldest dropped). Duplicates are merged (bump `UsageCount`, keep higher confidence) rather than appended.

**The attack graph** (`internal/attackgraph/`) is built from findings and the campaign objective, with nodes for each vulnerability/host state and edges for exploitability. `BuildFromFindings` constructs the graph; `BestPathToObjective` finds the highest-probability chain (`agent/report/agent.go:112-140`). Edges proven by external oracles are marked "verified" with full certainty.

**Resuming engagements**: The scheduler's cursor mechanism (`board.go:34`, `scheduler.go:301`) means agents resume from their last committed finding ID. An operator can warm-start a swarm by importing a context pack via `SeedImported` (`agents/seed.go:48-100`), which writes prior endpoints and findings to the board with standard pheromone so the swarm skips rediscovery. The `ctxpack.Load` mechanism (`swarm_runner.go:459-465`) reads a folder of prior pentest reports, tool output, or code.

> **Editor's note.** Correction: the swarm runner always uses the in-memory board (`blackboard.NewMemoryBoard`); `NewPostgresBoard` has no caller, so in-campaign swarm state does not survive a restart.

Citations: [internal/swarm/blackboard/board.go:1-94](https://github.com/Armur-Ai/Pentest-Swarm-AI/blob/40985e3184a5622fa76dc0b491ccb51b48d7acdf/internal/swarm/blackboard/board.go#L1-L94) · [internal/memory/persist.go:1-69](https://github.com/Armur-Ai/Pentest-Swarm-AI/blob/40985e3184a5622fa76dc0b491ccb51b48d7acdf/internal/memory/persist.go#L1-L69) · [internal/engine/swarm_runner.go:444-475](https://github.com/Armur-Ai/Pentest-Swarm-AI/blob/40985e3184a5622fa76dc0b491ccb51b48d7acdf/internal/engine/swarm_runner.go#L444-L475) · [internal/swarm/agents/seed.go:1-100](https://github.com/Armur-Ai/Pentest-Swarm-AI/blob/40985e3184a5622fa76dc0b491ccb51b48d7acdf/internal/swarm/agents/seed.go#L1-L100)

### berylliumsec/nebula (answered)

Engagement state is persisted across three independent stores.

**NebulaStore** (`storage.py`): The primary relational store (SQLAlchemy-backed, PostgreSQL or SQLite) holds all domain entities — `AgentRun`, `Task`, `ToolCall`, `Finding`, `Evidence`, `Artifact`, `Engagement`, `Approval`, `ChatSession`, `ContextSnapshot` and dozens more. The CLI uses Alembic for schema migrations (`cli.py:25`). `RunStatus` tracks lifecycle: `QUEUED → PLANNING → RUNNING → WAITING_APPROVAL/PAUSED/INTERRUPTED/CANCELLED/FAILED/COMPLETE` (`domain.py:391-401`).

**LangGraph Checkpoints**: The mission graph (`orchestration.py:511-556`) uses `AsyncSqliteSaver` (`orchestration.py:32`) with sync durability mode — every superstep is checkpointed before the next node starts. This enables `MissionRuntime.recover()` (`orchestration.py:642-659`) to resume any interrupted run from its last committed state. `RoutingJournal` (`orchestration.py:271-316`) records the model's routing response before any tool call executes, so a crash+recovery replays the same routing response instead of asking the model again — ensuring idempotent tool execution. Finished runs delete their checkpoints (`orchestration.py:675-698`).

**Context Compaction**: `ContextCompactor` (`context.py:1440-1470`) creates immutable `ContextSnapshot` entities for long-running conversations. The `WORKING_CONTEXT_CEILING` is 200K input tokens (`context.py:79`). Above this, the compactor uses a model to summarize prior conversation turns and stores the result as a `ContextSnapshot` with quality metadata and source references. The compactor targets 75% of the window and allows 60% of that for input (`context.py:69, 80`).

**Butler Memory** (`butler_memory.py:1-48, 166-200`): A separate SQLite database (not the main NebulaStore) with an optional Chroma vector index for semantic search. Memory scopes are `global_preference`, `global_lesson`, or `project_lesson`. Items are stored with `content`, `source_label`, `engagement_id`, timestamps, and revisions. The `_PREFERENCE` and `_LESSON_PROCESS` regex patterns (`butler_memory.py:51-84`) guide Butler's automatic judgment of what to save. The search index is rebuildable from the authoritative SQLite records. Butler's memory is explicitly separate from conversation context — it's durable, cross-project, and operator-visible through the Memory panel.

**Events and provenance**: Every significant state change is recorded as a `RunEvent` with idempotency keys (`orchestration.py:584-611`). The `ResourceRelation` entity (`domain.py:89-113`) creates provenance edges between resources (evidence "affects" finding, artifact "produced_by" execution) with revision tracking.

**Resumption**: The `resume()` entry point (`orchestration.py:639-659`) accepts an approval response for paused missions or `recover()` for crashed ones. The `NebulaStore` supports `ConflictError` with expected-revision checks to prevent lost updates during recovery.


Citations: [src/nebula/v3/orchestration.py:511-556](https://github.com/berylliumsec/nebula/blob/7332d9a05127933d2cc649e6797c9586466cfa8a/src/nebula/v3/orchestration.py#L511-L556) · [src/nebula/v3/orchestration.py:271-316](https://github.com/berylliumsec/nebula/blob/7332d9a05127933d2cc649e6797c9586466cfa8a/src/nebula/v3/orchestration.py#L271-L316) · [src/nebula/v3/orchestration.py:639-659](https://github.com/berylliumsec/nebula/blob/7332d9a05127933d2cc649e6797c9586466cfa8a/src/nebula/v3/orchestration.py#L639-L659) · [src/nebula/v3/context.py:54-80](https://github.com/berylliumsec/nebula/blob/7332d9a05127933d2cc649e6797c9586466cfa8a/src/nebula/v3/context.py#L54-L80) · [src/nebula/v3/context.py:1440-1470](https://github.com/berylliumsec/nebula/blob/7332d9a05127933d2cc649e6797c9586466cfa8a/src/nebula/v3/context.py#L1440-L1470) · [src/nebula/v3/butler_memory.py:1-48](https://github.com/berylliumsec/nebula/blob/7332d9a05127933d2cc649e6797c9586466cfa8a/src/nebula/v3/butler_memory.py#L1-L48)
