A local-first agentic AI system built on LangGraph and Ollama. Momobot orchestrates multi-step reasoning loops, manages persistent long-term memory, and executes complex tool chains entirely on-premise — bridging the gap between simple LLM chats and autonomous software agents.
Standard LLM interfaces are reactive: they wait for a prompt, provide a text response, and stop. True productivity requires an agent — a system that can break a goal into sub-tasks, execute tools, observe the result, and iterate until the goal is achieved without human intervention at every step.
PersistentKeyword-indexed markdown shards for cross-session recall
GroundedPersistent shell, vision OCR, and headless web-browsing
02 — Architecture
The Agentic Loop
Momobot is not a linear pipeline. It is a state-machine defined by a LangGraph, allowing the LLM to loop back to reasoning after every tool execution.
Core Innovation: Unlike standard agents that might hallucinate a sequence of actions, Momobot uses a task_state.json to maintain a structured plan. It tracks pending → running → done statuses, making it resilient to crashes and capable of complex multi-step recovery.
03 — Tool Ecosystem
Beyond Text Generation
To be useful, an agent needs a "body." Momobot's toolset is designed for high-fidelity interaction with the local OS and the web.
Category
Tool
Capability
System
bash_shell
Persistent PowerShell session (cwd and env survive)
Files
str_replace_tool
Surgical, diff-based file editing (no accidental overwrites)
Vision
view_image
Playwright rendering — Vision LLM analysis
Knowledge
memory_tools
Shard-based long-term storage (Keyword index)
Planning
init_task
Graph-based dependency tracking for goals
04 — Context Engineering
The Compaction Problem
Long sessions eventually hit the LLM's context limit, leading to "forgetfulness" or performance degradation. Momobot implements an active Compaction Trigger.
# Logic for context health maintenanceif current_tokens > COMPACTION_THRESHOLD:
# Preserve most recent messages for immediate flow
history_to_summarize = messages[:-RECENT_WINDOW]
# Generate a dense state summary
summary = llm.generate_summary(history_to_summarize)
# Update rolling session state and prune history
session_state.update(summary)
messages = messages[-RECENT_WINDOW:]
This ensures that critical decisions made 50 turns ago are preserved in a condensed summary, while the immediate conversation remains fluid and high-resolution.
05 — Impact
From Chatbot to Co-Engineer
Momobot transforms the AI interaction from "asking for code" to "assigning a project." It is capable of:
Autonomous Refactoring: Reading a codebase, identifying a pattern, and applying surgical edits across multiple files.
Research Loops: Searching the web, fetching content, and synthesizing a report into the Obsidian vault.
Visual Debugging: Rendering a web page, analyzing the layout via vision, and fixing CSS issues.
Persistent Learning: Remembering a user's technical preferences across weeks of different sessions.