Back to browse
Luna Agent – Custom AI agent in ~2300 lines of Python, no frameworks

Luna Agent – Custom AI agent in ~2300 lines of Python, no frameworks

by nonatofabio·Mar 7, 2026·1 point·0 comments

AI Analysis

●●●BangerBig BrainWizardryNiche Gem

Custom agent framework in 2300 lines beats 400K-line bloatware; auditable and runs fully local.

Strengths
  • Hybrid memory system (FTS5 + sqlite-vec + RRF) is genuinely clever — solves persistent context without separate vector DB.
  • MCP tool integration via JSON config is elegant insertion point; native tool guardrails (blocklist, timeouts, caps) show real security thinking.
  • Ruthless minimalism: 8 runtime deps, single process, one database file — architectural restraint that enables auditability and portability.
Weaknesses
  • Audience is constrained to homelab builders with local inference hardware; no cloud API option limits accessibility.
  • Blog post, not shipped product — no GitHub link visible, unclear if repo is public or ready for adoption beyond the author's use case.
Category
Target Audience

Homelab operators and developers building local AI agents who want to avoid framework bloat.

Similar To

AutoGPT · LangChain · LlamaIndex

Post Description

Hey HN. I evaluated three agent frameworks for a homelab project, one had 400K lines of code (and 42K exposed instances on Shodan), one was 9 days old, and the third was so thin I'd rebuild most of it anyway. None worked for me.

So I built my own in ~2300 lines of Python. No frameworks, 8 runtime dependencies, 106 tests.

What it does: - Persistent memory via SQLite (FTS5 keyword search + sqlite-vec embeddings + recency decay, fused with Reciprocal Rank Fusion) - MCP tool integration — add capabilities by editing a JSON file - Native tools with safety guardrails (bash blocklist, timeouts, output caps) - Discord interface with session isolation - Structured JSON logging for every operation - Conversation compression for effectively infinite context

Runs locally on 2x RTX 3090 with Qwen3-Coder-Next via llama-server. No cloud APIs.

The design philosophy was: don't build what you don't need, but don't block the insertion points. For example, my AI firewall isn't built yet, but all LLM traffic goes through a single configurable URL, swapping in a filtering proxy is a config change I'll do later.

DESIGN.md documents the reasoning behind every architectural decision. Tests mock the LLM client so you can run them on a laptop.

GitHub: https://github.com/nonatofabio/luna-agent Blog post with full technical deep-dive: https://nonatofabio.github.io/blog/post.html?slug=luna_agent

Happy to answer questions about any of the design tradeoffs.

Similar Projects

AI/ML●●Solid

Memv – Memory for AI Agents

Predict-calibrate extraction reduces noise, but Zep and Mem0 already dominate the agent memory space.

Big BrainNiche Gem
brgsk
432mo ago
AI/ML●●●Banger

Memweave CLI – search your AI agent's memory from the shell

Agent memory as git-diffable Markdown files beats opaque vector databases.

Big BrainCozyZero to One
r2d2_
601mo ago