> 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

reArtex: The Dual-Graph Architecture Powering LLM-Driven Penetration Testing

[ View on GitHub ]

reArtex: The Dual-Graph Architecture Powering LLM-Driven Penetration Testing

Hook

Most LLM security tools treat discovered assets like chat history—ephemeral, tangled, and impossible to query. reArtex stores them in a separate graph that persists across every engagement, making 'show me every test we ran on this server' actually answerable.

Context

Autonomous penetration testing frameworks face a gnarly architectural problem: how do you separate what the AI is thinking from what it actually found? Traditional execution logs mix tool output with reasoning traces, making it impossible to answer basic questions like 'what vulnerabilities exist on this asset' without parsing through dozens of task logs. You end up with knowledge trapped in chronological execution order—great for reproducing a single test, terrible for understanding your attack surface.

reArtex, a hardened fork of the original Artex framework, tackles this with an architecture decision that feels obvious in hindsight: maintain two completely separate graph structures. The exploration graph tracks per-task reasoning chains—every intent the planner generates, every tool a worker executes, the ephemeral 'how did we get here' story. The asset graph is your ground truth repository—hosts, services, credentials, vulnerabilities—persisted across all tasks and queryable as structured knowledge. Anchor nodes link them bidirectionally, so you can reconstruct forensics ('which task discovered this SQL injection') or campaign coverage ('did we test authentication on all discovered APIs'). Built for Chinese enterprise red teams operating under strict compliance requirements, it prioritizes auditability over autonomy, trading the original Artex's freewheeling execution for human approval gates and evidence preservation.

Technical Insight

External

Storage

Go Monolith

Frontend

user actions

task state

read graph state

generate intents

claim intent

execute tools

write discoveries

write assets/vulns

anchor nodes

scope definition

capture traffic

persist

persist

Next.js UI

embedded

HTTP API

Planner Agent

Worker Pool

Traffic Proxy

:8788

PostgreSQL

Exploration Graph

per-task chains

Asset Graph

ground truth

Norma SDK

LLM + Tools

ScopeSentry

asset ingestion

System architecture — auto-generated

The planner-worker orchestration model is where reArtex's design philosophy becomes concrete. The planner agent reads the current exploration graph state—previous intents, tool outputs, discovered assets—and generates new intents. Think of intents as specific, actionable test directives: 'attempt SQL injection on /api/users endpoint' or 'bruteforce SSH on 192.168.1.50 using discovered credentials'. These intents queue up, and worker agents claim them one at a time.

Here's what makes this pattern resilient: workers are single-shot executors. A worker pulls one intent, executes the real tooling (SQLMap, Nmap, custom scripts exposed via the norma SDK), writes discoveries to both graphs atomically, then terminates. No long-running agent processes accumulating context drift or hallucinating previous failures into current execution. The worker count is configurable per task, giving you horizontal scaling within task boundaries, but serialization at the intent level prevents the chaos of concurrent agents stepping on each other's network traffic or racing to exploit the same vulnerability.

The dual-graph write pattern looks something like this in practice:

// Simplified worker execution flow
func (w *Worker) ExecuteIntent(intent *Intent) error {
    // Execute real tooling via norma SDK
    result, err := w.toolExecutor.Run(intent.Tool, intent.Parameters)
    if err != nil {
        return w.writeFailure(intent, err)
    }
    
    // Parse discoveries from tool output
    assets := w.parser.ExtractAssets(result)
    vulns := w.parser.ExtractVulnerabilities(result)
    
    // Atomic transaction: write to both graphs
    return w.graphWriter.Transaction(func(tx *GraphTx) error {
        // Exploration graph: append this execution step
        execNode := tx.ExplorationGraph.AddExecution(
            intent.ID,
            result.Output,
            result.ExitCode,
        )
        
        // Asset graph: upsert discovered entities
        for _, asset := range assets {
            assetNode := tx.AssetGraph.UpsertAsset(asset)
            
            // Anchor link: how did we discover this?
            tx.CreateAnchor(execNode, assetNode, "discovered_by")
        }
        
        // Vulnerabilities link to both execution and affected assets
        for _, vuln := range vulns {
            vulnNode := tx.AssetGraph.AddVulnerability(vuln)
            tx.CreateAnchor(execNode, vulnNode, "found_by")
            tx.CreateAnchor(vulnNode, vuln.TargetAsset, "affects")
        }
        
        return nil
    })
}

The anchor nodes are the architectural trick that makes this work. They're not just foreign keys—they're first-class graph edges with timestamps, evidence references, and confidence scores. When you query 'show me all vulnerabilities on host X', you're traversing asset graph edges. When you query 'how did we discover vulnerability Y', you follow anchors back through exploration graph executions to see the exact tool invocation, parameters, and LLM reasoning that led there.

Vulnerability retesting demonstrates how this architecture enables sophisticated workflows. Instead of replaying previous commands blindly, reArtex spawns a new agent conversation with the vulnerability node as context. The retesting agent gets the original discovery evidence, the time elapsed, and the affected asset's current state. It must reason about whether conditions changed—was it a time-based SQL injection that only worked during business hours? Did the application version update? The agent devises new probes adaptively, then writes a three-state conclusion (reproducible/fixed/indeterminate) back to the vulnerability node with new evidence.

The embedded proxy on port 8788 handles traffic recording via Server-Sent Events. Every HTTP request/response pair flows through the proxy, gets captured with millisecond timestamps, and streams to the frontend via SSE for real-time monitoring. The implementation requires nginx configuration that disables buffering:

location /api/traffic/stream {
    proxy_pass http://localhost:8080;
    proxy_buffering off;
    proxy_cache off;
    proxy_read_timeout 86400s;
    proxy_set_header Connection '';
    chunked_transfer_encoding off;
}

This fragility is by design—the tool assumes you control the entire deployment stack and can tune reverse proxy behavior. For enterprise red teams running dedicated infrastructure, it's fine. For researchers trying to run this on shared hosting or behind corporate proxies, it's a deployment nightmare.

MCP (Model Context Protocol) integration treats external tools as LLM context providers rather than dumb shell wrappers. Instead of parsing unstructured stdout, tools expose structured endpoints that the LLM queries directly. A reconnaissance tool might expose /api/mcp/discovered-hosts that returns JSON the planner reads to decide next intents, or /api/mcp/credential-store that workers query during authentication attempts. This only works if your tooling implements MCP servers, which means reArtex is most powerful when paired with a cooperating ecosystem.

Gotcha

The entire documentation is in Chinese with zero English translation. This isn't just README inconvenience—configuration field names, error messages, and tool integration guides all assume fluent Chinese comprehension. If you can't read technical Chinese, you're reverse-engineering the codebase from Go source, which defeats the purpose of using a framework.

The norma SDK is referenced everywhere but never explained or open-sourced. Agent capabilities—how they invoke tools, parse results, maintain conversation state—are abstracted behind this SDK that ships as a black box. You can't extend agents with new tools without either getting proprietary SDK access or reimplementing the entire agent interface from scratch. This creates hard vendor lock-in to the original Artex ecosystem.

Scalability stops at single-node PostgreSQL. The monolithic Go binary with embedded frontend means you can't independently scale planner logic versus worker execution versus the web UI. As task concurrency grows, PostgreSQL becomes the bottleneck—every worker writing to both graphs hits the same database. There's no sharding strategy, no read replicas for queries, no mention of how to handle dozens of concurrent penetration tests without serializing on database writes. For small teams running sequential engagements, it's adequate. For organizations wanting to parallelize testing across hundreds of assets, the architecture doesn't provide a path forward.

Verdict

Use if you're in the Chinese offensive security ecosystem (already using ScopeSentry for asset management), need LLM-assisted penetration testing with mandatory human approval gates for compliance, and want persistent cross-engagement knowledge graphs that survive beyond individual task execution logs. The dual-graph architecture genuinely solves the asset discovery versus exploration state problem better than execution-log-based alternatives. Skip if you need English documentation, want a standalone tool without proprietary SDK dependencies, require horizontal scalability beyond single-node PostgreSQL, or expect to run this on infrastructure you don't control (the SSE proxy requirements will break on most default reverse proxy configs). This is enterprise red team infrastructure, not a researcher's experimentation framework.