How armaganakcann/pocket-agent works
pocket-agent is a local-first, tool-calling assistant for llama.cpp, with an optional remote fallback for complex requests. A user submits a request through the CLI; the loop chooses a backend, sends prompted conversation to it, parses a possible tool call, dispatches one tool, and feeds its result back until the model answers or reaches the step limit. Tools cover Termux notifications, speech and battery status, plus guarded file and shell access. Source excerpts show the runtime wiring; roadmap items such as Telegram, RAG and voice input are not implemented capabilities.
Main entry points: agent.py Agent loop · tools.py Tool dispatcher · prompts.py Prompt and schema
Components 18
User interaction
- CLI
agent.py
Agent runtime
- Agent loop
agent.py - Complexity router
agent.py - Tool-call parser
agent.py - LLM backend
agent.py - Prompt and schema
prompts.py
Tools and device access
- Tool dispatcher
tools.py - Notifications
tools.py - Text to speech
tools.py - File access
tools.py - Shell tool
tools.py - Battery status
tools.py
Other components
- User
- llama.cpp server
- Remote API
- Termux APIs
- Home filesystem
- System shell
Connections 19
- User → CLI: submits request
README.md - CLI → Agent loop: runs request
agent.py - Agent loop → Complexity router: checks complexity
agent.py - Agent loop → Prompt and schema: uses instructions
agent.py - Agent loop → LLM backend: sends messages
agent.py - LLM backend → llama.cpp server: posts chat
agent.py - Complexity router → Remote API: selects fallback
README.md - Agent loop → Tool-call parser: parses reply
agent.py - Agent loop → Tool dispatcher: dispatches tool
agent.py - Tool dispatcher → Notifications: invokes
tools.py - Tool dispatcher → Text to speech: invokes
tools.py - Tool dispatcher → File access: invokes
tools.py - Tool dispatcher → Shell tool: invokes
tools.py - Tool dispatcher → Battery status: invokes
tools.py - Notifications → Termux APIs: runs command
tools.py - Text to speech → Termux APIs: runs command
tools.py - Battery status → Termux APIs: runs command
tools.py - File access → Home filesystem: reads and writes
tools.py - Shell tool → System shell: runs command
tools.py