Offline-First Apache 2.0 Python 3.10+ MCP Ready

Your AI, your machine,
your rules

Fully local autonomous AI agent for laptop management. LangGraph reasoning loop, Ollama local LLM, ChromaDB RAG, MCP server, and a SHA-256 chained audit log. Zero API keys. Zero cloud calls.

Stack
LangGraph
Ollama
ChromaDB
MCP
sentence-transformers
psutil
7
Agent Tools
5
MCP Tools for Claude
10
Max Agentic Iterations
0
API Keys Required
What it does

Everything local, nothing leaked

Ask it anything about your machine. It reasons, calls tools, and answers — entirely on your hardware, with every action cryptographically logged.

🧠

LangGraph Reasoning Loop

Multi-step planning with tool use via a LangGraph StateGraph. Up to 10 agentic iterations per query, with a ToolNode for parallel tool dispatch and automatic loop termination.

langgraph-0.2+ stategraph toolnode 10-iter-max
🏠

Ollama Local LLM No cloud

Default qwen2.5-coder:7b for high tool-calling accuracy. No internet, no API key, no data ever leaves localhost:11434. Swap models in one line of config.

qwen2.5-coder:7b llama3.2 mistral:7b deepseek-r1
📚

ChromaDB RAG Layer

Ingest git repos, configs, logs, and docs. Retrieve relevant context at inference time via cosine similarity over all-MiniLM-L6-v2 embeddings — also running fully locally.

chromadb-0.5+ all-miniLM-L6-v2 512-token chunks cosine-similarity
🔌

MCP Server Claude ready

Exposes 5 tools to Claude Desktop and Claude Code over stdio transport. One config block and Claude can query your system, repos, and knowledge base from any conversation.

mcp-1.0+ stdio-transport claude-desktop claude-code
🛡️

Permission Guard

Every tool call passes through PermissionGuard before execution. Path allowlist, blocked system dirs, command allowlist, manual approval for destructive ops, 100 MB write cap, 30s timeout.

path-allowlist cmd-allowlist write-cap-100mb timeout-30s
🔗

SHA-256 Chained Audit Log

Every agent action writes to logs/audit.jsonl as a hash chain — each entry commits the SHA-256 of the previous entry. Any historical modification is detectable.

sha-256 hash-chain append-only verify-audit

Architecture

How the agent thinks

A LangGraph loop ties together a local LLM, a RAG layer, system tools, and an audit trail — all on your machine.

LangGraph drives the loop

The StateGraph alternates between the agent node (LLM reasoning) and ToolNode (parallel tool dispatch) until the LLM produces a final response or hits the 10-iteration limit.

Every call is guarded

PermissionGuard intercepts each tool call before execution. Violations raise PermissionError and are blocked — the LLM never receives the result of a blocked call.

Every call is logged

Allowed and blocked calls alike are written to the SHA-256 chained audit log. Run python main.py verify-audit at any time to confirm the full chain is intact.

Claude sees the same tools

The MCP server exposes a subset of tools to Claude Desktop and Claude Code via stdio. Claude calls them like any other MCP tool — with every call logged to the same audit trail.

┌─────────────────────────────────────────────────────────────────────────┐
│                     User / MCP Client                                 │
│                 (CLI chat or Claude Desktop)                          │
└─────────────────────────────────────┤───────────────────────────────────┘
                                 | query
                                 ▼
┌─────────────────────────────────────────────────────────────────────────┐
│                      LangGraph Agent Loop                             │
│                                                                         │
│   ┌──────────┐  tool_calls?   ┌────────────────┐                    │
│   │  agent   │ ────────────► │   ToolNode     │                    │
│   │  (LLM)   │ ◄──────────── │  (LangChain)  │                    │
│   └──────────┘  tool results  └────────────────┘                    │
│        │                          │                                    │
│   max 10 iters              Permission Guard + Audit Log                │
│        │                                                               │
│        ▼ Final response                                               │
└─────────────────────────────────────────────────────────────────────────┘
                 |                   |                        |
                 ▼                   ▼                        ▼
┌──────────────────┐ ┌───────────────────┐ ┌────────────────────┐
│ Ollama (localhost) │ │  ChromaDB (RAG)   │ │   System Tools    │
│                    │ │                   │ │                    │
│ qwen2.5-coder:7b   │ │ all-MiniLM-L6-v2  │ │ psutil, git,        │
│ temperature=0.1    │ │ cosine similarity  │ │ pathlib, subprocess │
│ NO API KEY         │ │ 512-token chunks   │ │ Permission Guard    │
└──────────────────┘ └───────────────────┘ └────────────────────┘
Available tools
ToolDescriptionPermissionMCP
get_system_statusCPU %, memory %, disk free, battery %, boot time, platformRead✓
list_gitreposAll repos under C:\Gitrepos with remote URL and current branchRead✓
run_git_statusgit status --short for a named repoRead (path check)✓
list_running_processesTop N processes ranked by CPU usage via psutilRead✓
read_fileRead any text file ≤ 2 MB from an allowed pathRead (allowlist)✗
write_fileWrite content to a file in an allowed pathWrite (allowlist)✗
query_knowledge_baseSemantic search over ingested documents — top-k cosine hitsRead✓

Security model

Three layers of safe operation

A local agent with file-write access is a high-privilege process. LaptopAI-Agent treats it that way from the ground up.

1

Permission Guard — every tool call, before execution

Allowed write paths: C:\Gitrepos, C:\Users\Sunil\Documents, C:\Users\Sunil\Desktop
Blocked paths: C:\Windows\System32, C:\Program Files
Allowed commands: git, python, pip, npm, node, powershell, Get-ChildItem …
Manual approval for: rm, Remove-Item, Format-*, reg delete
Max file write: 100 MB  •  Max execution time: 30 seconds

Any violation raises PermissionError and the tool call is blocked — the LLM never sees the result.

2

SHA-256 Chained Audit Log — tamper-evident history

Every agent action writes to logs/audit.jsonl as a hash chain. Each entry commits the SHA-256 of the previous entry, making any historical modification immediately detectable. Run python main.py verify-audit to check the full chain integrity at any time.

3

Zero External Calls — nothing leaves your machine

LLM inference runs via Ollama at localhost:11434. Embeddings run via sentence-transformers locally. Vector store is ChromaDB on disk at ./data/chroma_db/. The audit log is a local file. No tokens, queries, files, or embeddings are ever sent over the network.

Comparison
Feature Cloud AI (ChatGPT / Claude API) Local LLM (no agent) Cloud LLM + Agent LaptopAI-Agent
Runs fully offline ✗ ✓ ✗ ✓
Zero API keys ✗ ✓ ✗ ✓
Multi-step tool use ✓ ✗ ✓ ✓
RAG over local files ✗ ✗ partial ✓
MCP integration partial ✗ partial ✓
Cryptographic audit trail ✗ ✗ ✗ ✓ SHA-256
Permission enforcement ✗ ✗ ✗ ✓
Swap models in config ✗ ✓ ✗ ✓

Installation

Get started in 3 steps

Pull a local model, install dependencies, start chatting. No API key, no signup, no data leaving your machine.

● 1. Pull local model & install
ollama pull qwen2.5-coder:7b

git clone https://github.com/\
  sunilgentyala/LaptopAI-Agent
cd LaptopAI-Agent
pip install -r requirements.txt
Requires Python 3.10+ and Ollama. qwen2.5-coder:7b (~4.7 GB) is the recommended default.
● 2. Chat & explore
python main.py chat
python main.py status
python main.py repos
python main.py verify-audit
Ask: "Which of my repos have uncommitted changes?" or "My disk is 87% full — what's taking space in C:\Gitrepos?"
● 3. Ingest your docs
python main.py ingest \
  C:\Gitrepos

python main.py chat
> What does the ZKP-RA circuit
  enforce at the policy layer?
Ingests .txt, .md, .log, .py, .yaml, .json recursively with upsert deduplication.
● 4. Connect Claude Desktop
// claude_desktop_config.json
{
  "mcpServers": {
    "laptop-ai": {
      "command": "python",
      "args": ["main.py","mcp"],
      "cwd": "C:\\...\\LaptopAI-Agent"
    }
  }
}
Claude can then call system_status, list_gitrepos, git_status, top_processes, and rag_query directly from any conversation.

Local models

Recommended Ollama models

Swap models with one line in config.yaml — no code changes needed.

ModelSizeStrength
qwen2.5-coder:7b ⭐ ~4.7 GB Tool calling, code reasoning — default
llama3.2:3b ~2.0 GB Lightweight, fast responses
mistral:7b ~4.1 GB General reasoning, instruction following
deepseek-r1:7b ~4.7 GB Multi-step planning, math
Community

Star history

Track LaptopAI-Agent's growth on GitHub.

Star History Chart

Run AI your way ⭐

A star helps other developers who want local-first, privacy-respecting AI agents find this project. No cloud required — ever.

★  Star on GitHub Open an issue Read the docs
Author

Built by

SG
Sunil Gentyala
IEEE Senior Member  ·  Lead Cybersecurity & AI Security Consultant
HCL America Inc., Dallas TX  ·  sunil.gentyala@ieee.org