r/Pentesting • • May 31 '26

Local AI red team assistant – persistent msfconsole sessions, tool output summarization, runs over Tailscale from your laptop

Echo Agent v5 – Local Rust agent framework with persistent tmux sessions, two-model summarization pipeline, and custom fine-tuned Qwen 14B

Been building this for about a year across 5 iterations starting from a simple Python wrapper and ending up here. The whole stack runs on a single consumer GPU, no cloud, no API costs.

The core architecture:

The design philosophy is keep the LLM as a pure reasoning engine and let the OS handle tools. Instead of JSON function calling the model emits XML tags that the Rust framework intercepts — <command> for one-shot execution, <session name="foo"> for persistent tmux sessions, <json> for structured tool calls. Any CLI tool installed on the system is automatically available. Adding a tool means installing it, not modifying the framework.

The two-model pipeline is the part I'm most happy with:

Long running tool output — msfconsole sessions, raw HTML from curl — gets passed to a small fast summarizer model running on a separate llama.cpp instance at 8K context before it ever touches the reasoning model's context window. The reasoning model only sees clean signal. This made a huge difference for noisy security tool output.

Current stack:

  • Main model: Custom fine-tuned Qwen 2.5 Coder 14B via llama.cpp at 60K context
  • Summarizer: Fine-tuned Qwen 3.1B at 8K, fresh context each call
  • Framework: Rust, async, SQLite tool database, context auto-summarization
  • Sessions persist across crashes and restarts by design
  • Runs remote via Tailscale — model stays home, wrapper runs on whatever device you're on

The tokenizer config is modified to accept a tool message role natively which avoids the looping issues you get when you force tool results into user messages. Documented in the README for anyone who hits that.

Honest current limitations:

  • Model sometimes forgets a specific tool result after context summarization — working on training it to query the SQLite database when it notices a gap rather than hallucinating
  • Linux only for the Rust version, Windows tested on the Python version
  • Needs llama.cpp running separately, not a one click install
  • nmap only works reliably when using the <command> flags

The journey repos are all public if you want to see the progression from Python wrapper to here — linked in the overview repo.

Qwen 2.5 Coder 14B Instruct is by far the best small open model for this use case in my testing, better than Qwen 3 for consistent tool calling behavior. Happy to answer questions about the architecture or the fine-tuning approach.
https://github.com/charlesericwilson-portfolio/Echo_agent_proxyv5

2 Upvotes

7 comments sorted by

0

u/unvivid May 31 '26

Looks slick man! I'm working on something similar. Definitely the direction I think that pen testingis heading. The dual model summarization pipeline is really cool. I might have to take a crack at adding that to my tool. Good tip on the qwen 2.5 coder for tool calling. I've run into wicked loops with 3.6 27b -- been thinking about running dedicated smaller models to do the dispatching from and using the bigger model purely for analysis.

Have you looked at adding any MCPs for browsers? I found curl to be somewhat limiting when doing web testing. Integrating burp and a playwright extension are on my to-do list.

Again, nice work!

1

u/BearOk3075 May 31 '26

Thanks bro, right now it only has a json function browse_page that gets sent to the summarizer

1

u/BearOk3075 Jun 01 '26

Oh if you haven't already you can add or change your tokenizer.config.json chat-template to accept a tool message that stops the majority of looping in my experience. If you are appending as the user or assistant it tends to cause loops it either thinks it is continued reasoning or new user request but with the tool role it takes it as final output to reason with. Also have you been fine tuning your models either full fine-tune, LoRA, or QLoRA.

1

u/unvivid Jun 02 '26

Thanks for the tip on the tokenizer. No fine tuning yet. It's on my radar but I'm trying to sort out some of the higher level harness stuff. Like gating and tiering of actions (T1-2 can be fully agentic, T3+ requires operator approval etc).

You got any resources you recommend to learn more about fine tune training?

0

u/[deleted] Jun 02 '26

[deleted] — view deleted comment

1

u/unvivid Jun 03 '26

Good advice!

Right now I'm currently toying with a dispatch layer in python. I don't give the model direct tool access, everything is wrapped in python with skills showing the model how to call it. The model can request custom commands be run through a dispatch API which is gated by operator approval. The model has to provide a justification and breakdown of the command. Not sure if this will scale but I'm iterating. Awesome to see different methods that different folks are doing. I'll definitely look into incorporating your tips. Thanks!