Minimal one-file coding agent built on Bun and the Google Gen AI SDK with Gemini 3.5 Flash.
Features: read, write, edit, and unrestricted bash; text, image, PDF, audio, and video input; local JSONL sessions with inline base64 media; non-interactive --prompt, --resume, and --fork; lightweight interactive mode with cancel, undo, and edit.
Warning: nanogem has unrestricted filesystem and shell access. There is no sandbox or confirmation layer.
bun install
chmod +x agent.ts
mkdir -p ~/.local/bin ~/.nanogem
ln -s "$PWD/agent.ts" ~/.local/bin/nanogemCreate ~/.nanogem/auth.json:
{
"google": {
"type": "api_key",
"key": "YOUR_GEMINI_API_KEY"
}
}GEMINI_API_KEY takes precedence over auth.json. Optional global instructions are loaded from ~/.nanogem/AGENTS.md. Sessions are stored under ~/.nanogem/sessions/.
nanogem
nanogem --prompt "inspect this project"
nanogem --resume SESSION_ID --prompt "continue"
nanogem --fork SESSION_ID --prompt "try another approach"
nanogem --resume SESSION_ID
nanogem --fork SESSION_IDInteractive commands: /resume ID, /fork ID, /undo, /edit, /exit. Press Ctrl+C during a turn to cancel and rewind it.