LuaN1aoAgent uses a Retrieval-Augmented Generation (RAG) system to provide the Executor with domain-specific attack payloads, bypass techniques, and vulnerability exploitation methods during task execution. Without the knowledge base, the agent relies solely on the LLM’s parametric knowledge.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/SanMuzZzZz/LuaN1aoAgent/llms.txt
Use this file to discover all available pages before exploring further.
Why the knowledge base matters
During execution, the Executor can call theretrieve_knowledge MCP tool to fetch relevant techniques for a specific attack scenario — for example, retrieving SQL injection payloads for a specific database, or WAF bypass sequences for a detected firewall product. The knowledge service returns semantically ranked results from a FAISS vector index built from your local documents.
The agent also uses the distill_knowledge tool to write new attack insights discovered during a task back into the knowledge base, enabling accumulation of custom intelligence over time.
Step 1: Set up PayloadsAllTheThings
The recommended starter knowledge base is PayloadsAllTheThings, which contains a comprehensive set of attack payloads organized by vulnerability type.<project_root>/knowledge_base/. You can add any number of subdirectories with .md or .txt files — all will be indexed.
Step 2: Build the vector index
Run the knowledge base preparer to scan documents, chunk them, generate embeddings, and write the FAISS index:What rag_kdprepare does
Scan the knowledge_base directory
Walks
knowledge_base/ recursively, collecting all .md and .txt files. Each file is assigned a stable doc_id based on its relative path from the project root.Detect new and modified documents
Compares SHA-256 hashes against
rag/faiss_db/faiss_manifest.json. Documents whose hash has changed or that are new are queued for processing. Documents that no longer exist are removed from the index.Chunk documents
Passes each document through
MarkdownChunker, which splits content into chunks respecting Markdown headings. Chunk sizes are controlled by environment variables:Generate embeddings
Encodes chunks using a SentenceTransformer model (loaded from
rag/models/all-MiniLM-L6-v2 if available locally). Falls back to an offline hash-based embedder (OfflineHasherEmbedder, 384 dimensions) if the model cannot be loaded.Force-rebuilding the index
To force a full rebuild of the entire index:Step 3: Start the knowledge service
The knowledge service is a FastAPI application that exposes the FAISS index over HTTP:Auto-start behavior
The agent automatically starts the knowledge service if it is not already running when a task begins. TheKnowledgeServiceManager in agent.py:
- Checks
GET /healthonhttp://127.0.0.1:8081 - If the service is not healthy, spawns a
uvicornsubprocess withstart_new_session=True - Polls health every 500ms for up to 5 seconds
- Proceeds with the task if the service becomes healthy; logs a warning if it times out
The auto-started knowledge service process is detached from the agent. It continues running after the agent exits. On the next run, the health check will detect it is already running and skip the startup step.
Health check
Verify the knowledge service is running and the index is loaded:status is "unavailable", the FAISS index was not found or failed to load. Re-run rag_kdprepare.
Adding custom knowledge documents
Place any.md or .txt files anywhere under knowledge_base/ and re-run rag_kdprepare. The preparer scans the entire directory tree, so subdirectory organization is up to you:
The retrieve_knowledge and distill_knowledge tools
During task execution, the Executor can invoke these tools via MCP:
retrieve_knowledge
retrieve_knowledge
Performs a semantic similarity search against the FAISS index and returns the top-k most relevant chunks.Example query (invoked internally by the agent):Response:Timeout: 15 seconds (configurable via
TOOL_TIMEOUT_RETRIEVE in .env).distill_knowledge
distill_knowledge
Writes new attack insights discovered during a task back into the knowledge base as a custom document. This enables the agent to accumulate intelligence across runs.Timeout: 20 seconds (configurable via
TOOL_TIMEOUT_DISTILL in .env).Configuring the knowledge service port
The default port is8081. Override it in .env:
KNOWLEDGE_SERVICE_URL to determine where to send health checks and tool requests.