> your AI agent picks dependencies from memory; give it dated facts — try starlog.dev ↗ vet your agent's deps ↗ vibe-coding is fine. vibe-importing isn’t. — try starlog.dev ↗ vibe-importing isn’t fine ↗ your agent has never seen your private packages — try starlog.dev ↗ facts for private packages ↗ a linter for the dependencies your AI agent picks — try starlog.dev ↗ a linter for agent deps ↗ whois is redacted, cdns mask the rest — get the real operator — try whoisgeni.us ↗ who really runs that domain ↗ domain attribution that shows its work — full evidence chain — try whoisgeni.us ↗ domain intel w/ evidence ↗

← Back to Articles

ARTEX-MUTANT: How Dual-Graph Persistence Solves the LLM Agent Memory Problem

[ View on GitHub ]

ARTEX-MUTANT: How Dual-Graph Persistence Solves the LLM Agent Memory Problem

Hook

Most LLM agents forget everything when they crash. ARTEX-MUTANT stores its 'thoughts' in PostgreSQL so it wakes up exactly where it left off—even mid-exploit.

Context

Autonomous LLM agents that execute real commands face a problem that doesn't exist in ChatGPT: they need to survive process restarts without losing context. Traditional ReAct-style agents keep their reasoning chains in memory, so when your container crashes at 3 AM during a penetration test, you're back to square one. Multi-agent frameworks like AutoGPT sidestep this with JSON file checkpoints, but those don't handle concurrent workers reading and writing shared state—you get race conditions and duplicate work.

ARTEX-MUTANT is a deliberately hardened fork of an upstream penetration testing agent that solves this with a dual-graph architecture: one PostgreSQL-backed graph for discovered assets (ports, services, vulnerabilities), and a separate graph for execution history (what the agent tried, what worked, what failed). The planner agent reads both graphs, generates structured intent objects like 'scan_port' or 'exploit_vuln,' and queues them for N concurrent worker agents that execute via tool calls to bash, nmap, and HTTP clients. Workers write results back to the exploration graph, the planner reads it on the next cycle, and the whole system can pause/resume across container restarts without losing agent memory. This isn't a production pentest tool—the README explicitly warns it's linked to unauthorized intrusions in its upstream lineage—but the architecture patterns here solve real problems that general-purpose agent frameworks still struggle with.

Technical Insight

Read discovered

attack surface

Read execution

history

Generate intents

scan/exploit

Consume tasks

Validate command

Execute if allowed

Write results

Write new assets

hosts/ports/vulns

Planner Agent

Asset Graph

PostgreSQL

Exploration Graph

PostgreSQL

Intent Queue

Worker Agents

N concurrent

Tool Executors

bash/nmap/HTTP

Intercept Rules

regex validation

System architecture — auto-generated

The core architectural insight is separating what the agent knows from what it's doing. The asset graph stores discovered attack surface as PostgreSQL rows—each host, port, service, and vulnerability gets a unique ID and relationships tracked via foreign keys. The exploration graph stores every tool call the agent makes: the intent type, the target asset ID, the timestamp, the stdout/stderr, and whether it succeeded. When the planner agent wakes up (either after a restart or on its scheduled loop), it queries both:

// Simplified from the actual codebase structure
type Planner struct {
    db *sql.DB
}

func (p *Planner) GenerateIntents() ([]Intent, error) {
    // Read asset graph: what exists on the network
    assets, _ := p.db.Query(`
        SELECT id, ip, port, service 
        FROM assets 
        WHERE state = 'discovered' AND NOT EXISTS (
            SELECT 1 FROM exploration 
            WHERE target_asset_id = assets.id 
            AND intent_type = 'scan_port'
        )
    `)
    
    // Read exploration graph: what we've already tried
    history, _ := p.db.Query(`
        SELECT target_asset_id, intent_type, result 
        FROM exploration 
        WHERE timestamp > NOW() - INTERVAL '1 hour'
    `)
    
    // Generate new intents based on both
    intents := []Intent{}
    for assets.Next() {
        var id int
        var ip string
        assets.Scan(&id, &ip)
        intents = append(intents, Intent{
            Type: "scan_port",
            Target: id,
            Command: fmt.Sprintf("nmap -p- %s", ip),
        })
    }
    
    // Push to PostgreSQL queue table
    for _, intent := range intents {
        p.db.Exec(`INSERT INTO intent_queue (type, target, cmd) VALUES ($1, $2, $3)`,
            intent.Type, intent.Target, intent.Command)
    }
    return intents, nil
}

Workers poll the intent_queue table, claim a row via SELECT FOR UPDATE SKIP LOCKED (PostgreSQL's row-level locking for concurrent consumers), execute the bash command, and write results back to the exploration graph. This strict planner-worker split prevents the runaway tool-call loops you see in ReAct agents where each worker can spawn subtasks—only the planner generates work, workers only execute and report back.

The intercept rules add a runtime-editable security layer, but it's admittedly bypassable. Every tool call passes through a PostgreSQL-backed regex matcher before execution:

func (w *Worker) ExecuteWithIntercept(cmd string) error {
    rules, _ := w.db.Query(`SELECT pattern, action FROM intercept_rules WHERE enabled = true`)
    for rules.Next() {
        var pattern, action string
        rules.Scan(&pattern, &action)
        if matched, _ := regexp.MatchString(pattern, cmd); matched {
            if action == "block" {
                return fmt.Errorf("blocked by rule: %s", pattern)
            }
        }
    }
    // Actual execution happens here
    return exec.Command("bash", "-c", cmd).Run()
}

The problem: these rules match the final bash command string, not the structured intent object the LLM generated. If the LLM outputs a tool call with JSON-escaped newlines or embeds commands in environment variables, it bypasses substring matching. The codebase itself admits this in comments—the intercept rules are 'security theater unless you treat the agent as already compromised.'

What's genuinely clever is the process environment scrubbing after startup. The server reads LLM API keys and database credentials from environment variables, stores them in memory, then explicitly deletes them from os.Environ(). When worker bash calls run as the same UID, they can't leak secrets via cat /proc/$PPID/environ because the parent process already scrubbed its own environment. This is OS-level hardening you rarely see in Go agent frameworks:

func main() {
    apiKey := os.Getenv("LLM_API_KEY")
    dbPass := os.Getenv("DB_PASSWORD")
    
    // Store in-memory
    config := Config{APIKey: apiKey, DBPassword: dbPass}
    
    // Scrub from process environment
    os.Unsetenv("LLM_API_KEY")
    os.Unsetenv("DB_PASSWORD")
    
    // Now worker bash calls can't extract these via /proc
    startServer(config)
}

The first-run protection is simpler but effective: on cold start, the server generates a one-time setup token, prints it to console logs, and binds to 127.0.0.1:8080 by default. You can't access the web UI without the token, and remote access requires you to explicitly change the bind address. It's not OAuth, but it's a real cold-start security boundary that most research agent frameworks skip entirely.

Gotcha

The intercept rules are the most visible 'security' feature, but they're admittedly bypassable via JSON-escaped command injection in the LLM's own output. If you're evaluating this as a safe way to run autonomous agents, understand that the regex substring matching happens after the LLM has already crafted the bash command—it's post-compromise mitigation, not sandboxing. The real first-run protection is the setup token and loopback bind; everything after that assumes the agent might be malicious.

No execution sandboxing means bash tool calls run as the same UID as the Go server. A malicious LLM response (or prompt injection from a compromised website the agent scrapes) can read workspace files, attempt SQL injection through the Go code's database queries, or pivot to the host. The single-user design compounds this—there's one admin account, no RBAC, so every authorized session has full read/write to all tasks, intercept rules, and LLM settings. If you're running this in a team context or on a shared server, one compromised session owns the entire database. The README's disclaimer about upstream lineage being linked to real unauthorized intrusions isn't hypothetical; treat this as a research artifact for studying agent architectures, not a polished offensive tool.

Verdict

Use if: you're building detection content for autonomous LLM agents and need a reference implementation of dual-graph persistence and planner-worker architecture patterns, or you're researching how 'security-conscious' agent frameworks differ from typical research prototypes—the documented hardening process (env scrubbing, runtime-editable intercepts, reviewing evasion forks but refusing to port them) is the real learning material here. Skip if: you want a production penetration testing platform (use Metasploit with msfrpc API or a commercial agent framework with real sandboxing), you need multi-user audit trails or RBAC (this is a single-admin system), or you're looking for a safe way to run autonomous agents overnight (the intercept rules are bypassable and there's no execution isolation). The one-star repo status and deleted upstream forks signal this is a hardening research artifact, not deployment-ready tooling.