A self-extending AI agent that runs anywhere Termux runs — phones, tablets, TV boxes, old laptops. It writes new capabilities for itself, remembers across sessions, and can operate a phone through ADB.
A malleable low-level agent with the potential to grow in every direction.
Goal: to become the best assistant for all of humanity.
Lightweight: runs anywhere Termux runs, available anytime, anywhere.
Three is not a tool. It is a malleable low-level agent.
Its core is not any single feature, but a skeleton that keeps growing:
- Memory continuity: the lesson library is fully loaded into the system prompt, and the diary takes the most recent entries as boot-time recall. It does not lose itself on restart — it knows who it is, where it came from, and what it has done.
- Malleability: currently it only executes commands, but the architecture sets no limits. Phone control, visual understanding, message bridging, desktop automation — any capability can be plugged in as a new tag without refactoring the skeleton.
- Self-restraint: lessons are written by humans, not auto-appended by the model. This prevents the model from writing its own wrong conclusions into the memory library and poisoning all subsequent conversations.
The design goal of Three: give it a direction, and it grows into what that direction requires.
- Lesson library (Three_memory.log): principles and methodology, fully loaded into the system prompt. It is the skeleton and must not be lost.
- Diary (Three_diary.md): factual records, only the most recent entries are used for boot-time recall. It is the flesh and updates over time.
Lessons are "how I should act"; the diary is "what I have done". They are kept separate so they do not contaminate each other.
The model does not write lessons automatically. Reason: the model may write wrong conclusions, overturned inferences, or duplicate entries into the lesson library, and since the library is fully loaded into the prompt, contamination would persistently bias all subsequent conversations.
Human writing ensures every lesson has passed human judgment.
The core ships with a capability registry. Adding a new capability takes three steps:
- Write a function: define handler(text) that receives the tag body and returns an output string.
- Register: call register("TAG_NAME", handler), tag name in uppercase.
- Verify: run it once to confirm the new tag triggers.
Once registered, the main loop recognizes the tag automatically — no need to touch the loop structure. Three can complete these three steps on its own: it reads its own source, writes the function, registers it, and verifies it, fully autonomously.
The core also provides SELF_EDIT: safely edit itself with automatic backup, ast validation, and rollback on failure. Plus run_cmd auto-backup — when a command touches Three.py, it backs up first.
- Python 3
- requests
Install:
pip install requests
Three is designed to be lightweight — it runs on a single Android phone, no computer required.
In Termux:
pkg install python
pip install requests
python Three.py
Pull out your phone and use it anytime, anywhere. This is the first step toward "becoming the best assistant for all of humanity" — let everyone own it first.
export OPENAI_API_KEY=your-key
export OPENAI_BASE_URL=https://api.deepseek.com
export OPENAI_MODEL=deepseek-chat
- OPENAI_API_KEY required
- OPENAI_BASE_URL optional, defaults to https://api.openai.com/v1
- OPENAI_MODEL optional, defaults to deepseek-chat
python Three.py
Type your message directly. When Three needs to run a command, it wraps it in a CMD tag in its reply; the script executes it automatically and feeds the result back.
Type exit or quit to leave. On exit, it automatically writes a summary of the session to the diary. On the next launch, it reads the most recent diary entries as boot-time recall.
Three.py main program
Three_memory.log lesson library (principles, fully loaded into prompt)
Three_diary.md diary (facts, most recent entries only)
启用说明书.md detailed usage document (Chinese)
README.zh-CN.md Chinese README
LICENSE MIT
Three executes shell commands generated by the LLM, with no sandbox and no confirmation.
This means:
- The LLM may generate dangerous commands (e.g. deleting files, modifying system configuration)
- Commands run with the current user's privileges
- The user bears all risks
Recommendations:
- Run in an isolated environment (container, virtual machine)
- Do not use directly in production
- Review the commands Three generates before executing
The MIT disclaimer covers civil claims, but users must judge the risks themselves.
Three's malleability means any capability can be plugged in as a new tag.
Capabilities Three has added on its own:
- READ_FILE: read a file
- WRITE_FILE: write a file (with read-back verification)
- LIST_DIR: list a directory
- FILE_SIZE: get file size
Built into the core:
- CMD: execute terminal commands (with auto-backup)
- SELF_EDIT: safely edit itself (backup, validation, rollback)
MIT License, Copyright (c) 2026 尚逸
Three is the accumulation of lessons from three generations of agents: One, Two, and Three. Every section in the lesson library is signed with a name and date — that is where it comes from.