Skip to main content

Zero-dependency symbolic AI agent. Pure Python stdlib. Runs anywhere.

Project description

Qwerty v2 — Zero-Dependency Symbolic AI Agent

Pure Python stdlib. No numpy. No torch. No sklearn. 10MB total. Runs on a Raspberry Pi.

Qwerty is an autonomous software agent that reads files, edits code, runs commands, searches the web, learns from every interaction, and composes multi-source answers — all with zero external dependencies. It's a symbolic AI: deterministic, constitution-bound, auditable, and completely offline-capable.

Why Qwerty?

Qwerty Other AI Agents
pip install → runs Requires Python ML stack (numpy, torch, transformers, 800MB+)
Offline by default Cloud API or local LLM (8GB+ RAM)
10MB on disk 2-20GB for local models
Constitution hardcoded at engine level Safety is a prompt (jailbreakable)
Deterministic — same input, same output Non-deterministic (sampling)
Runs on ARM (Raspberry Pi Zero) Needs x86 GPU or cloud

Features

  • 14 tools: read, write, edit, search, find, run, web search, wikipedia, learn, analyze errors, and more
  • Fuzzy NLP: handles "runn ls -la", "plz tel me bout the kernul", "idk wat uefi is" — 50+ shorthand maps, Levenshtein, n-gram Jaccard, contraction expansion, character dedup
  • Knowledge base: 8 curated domains + 127 Wikipedia articles covering programming, OS dev, networking, math, physics, chemistry, biology, technology, and general knowledge
  • Genius composition engine: retrieves, scores, and assembles multi-sentence responses from 2500+ sentences across all knowledge files
  • On-demand learning: lookup <topic> → Wikipedia API (free, caches for next time); web fallback → DuckDuckGo
  • Constitution safety: 9 hardcoded rules block rm -rf /, credential leaks, file overwrites without confirmation, and other dangerous operations
  • Persistent memory: every answer, every lookup, every fix is stored in memory/learned.json — learning compounds across sessions
  • Recursive solve loop: react → think → explore → internet → report — 3 layers of fallback before giving up
  • Protocol: JSON-RPC, MCP server, and CLI modes — plugs into any editor or toolchain
  • 76 passing tests, zero external dependencies

Quick Start

git clone https://github.com/KasishStar/qwerty-agent
cd qwerty-agent
python agent.py

Or ask a question directly:

python agent.py "what is a kernel"

Interactive Mode

python agent.py
qwerty> what is UEFI boot
qwerty> lookup quantum computing
qwerty> list files
qwerty> read file agent.py
qwerty> learn that the answer is 42
qwerty> exit

Interface (with history and slash commands)

python interface.py

JSON-RPC Protocol

python protocol.py --process "what is a kernel"
python protocol.py --json "what is a kernel"
python protocol.py --schema
python protocol.py --mcp

Architecture

User Input → Normalize → Classify Intent → Constitution Check → Execute → Result
                              ↓
                    Genius Composition Engine
                    (2500+ sentences, 8+ domains)
                              ↓
                    Recursive Fallback Loop
                    react → routine → explore → internet → report
                              ↓
                    Persistent Memory (learned.json)

All layers are checked against the constitution before execution. No layer can run rm -rf /, overwrite user files without confirmation, or leak credentials.

How It Works

Qwerty is not an LLM. It's a symbolic AI — every decision is deterministic if/then logic. Its "intelligence" comes from:

  1. Broad knowledge (Wikipedia articles + curated domains)
  2. Fuzzy pattern matching (Levenshtein, n-gram Jaccard, keyword overlap)
  3. Multi-source composition (Genius scores and assembles sentences)
  4. On-demand learning (fetches and stores new knowledge at runtime)
  5. Compounding memory (every success is saved for next session)

What Qwerty Can Do

Task Example
Answer knowledge questions "what is a microkernel"
Read/write files "read file agent.py"
Edit code "edit line 10 of test.py to say hello"
Run commands "run cargo build"
Search code "search for TODO in src/"
Learn new facts "learn that X that Y"
Wikipedia lookup "lookup TCP protocol"
Web search "search web for rust uefi tutorial"
Analyze errors Automatic on command failure
Remember across sessions All in memory/learned.json

Requirements

  • Python 3.10+
  • No pip packages needed
  • Linux, macOS, or Windows
  • ARM (Raspberry Pi) supported
  • Internet optional (for web search and Wikipedia)

Project Structure

qwerty-agent/
├── agent.py              # Main engine: constitution, tools, NLP, solve loop
├── genius.py             # Response composition engine
├── interface.py          # Interactive REPL with history
├── protocol.py           # JSON-RPC / MCP / CLI modes
├── constitution.json     # 9 safety rules
├── knowledge/            # 9 JSON knowledge files (8 curated + Wikipedia)
├── memory/               # Persistent learning (auto-generated)
├── workflows/            # Pre-defined multi-step workflows
├── knowledge_importer.py # Wikipedia article downloader
├── test_all.py           # 76 comprehensive tests
└── pyproject.toml        # Build configuration

Tests

python test_all.py

License

MIT — see LICENSE.


Created by KasishStar. Pure symbolic AI. No ML dependencies. Runs anywhere.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qwerty_agent-2.0.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qwerty_agent-2.0.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file qwerty_agent-2.0.0.tar.gz.

File metadata

  • Download URL: qwerty_agent-2.0.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for qwerty_agent-2.0.0.tar.gz
Algorithm Hash digest
SHA256 c34bbeec55f8d7c3d34556c235464205783eb07e20c45778200179ae668751b6
MD5 67a52e283e7b6512992b3294c87e7eac
BLAKE2b-256 3f15f3f69d630b400ff28a5d78704b43b7194eb223bb87cbb1c2ec35f0327f41

See more details on using hashes here.

File details

Details for the file qwerty_agent-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: qwerty_agent-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for qwerty_agent-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 596ceccc48f67badb44b8a7bbe4daa28f39498ba169dac0a566a3f707ba27932
MD5 683a87fad03a856b635c1d2276289834
BLAKE2b-256 725ebf07afa758199e6dbf75f29d430ff8c39b4027d5780fc26e15f3a1cf64de

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page