Skip to content

Instantly share code, notes, and snippets.

View lukestanley's full-sized avatar

Luke Stanley lukestanley

View GitHub Profile
@lukestanley
lukestanley / glass_agent_v4.html
Created September 16, 2026 00:58
Single HTML file CDN backed SWE Agent with Recursive Language Model (RLM) implementation
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Glass agent v4 - Luke Stanley</title>
<script type="module" src="https://pyscript.net/releases/2026.6.1/core.js"></script>
<style>
textarea { width: 100%; box-sizing: border-box; }
</style>
@lukestanley
lukestanley / sandbox_proxy.py
Created June 8, 2026 10:58
Single-file HTTPS MitM proxy (Astral uv script) for easy sandbox filtering
# /// script
# dependencies = [
# "cryptography",
# "trio",
# ]
# ///
from csv import DictReader
from datetime import datetime, timedelta, timezone
from ipaddress import ip_address
@lukestanley
lukestanley / nano_rlm.py
Created April 26, 2026 01:18
Single-file Nano RLM agent: a Recursive Language Model harness using a networked VM for experimenting with recursive and self-optimising local-model agents that can work around context-window limits.
#!/usr/bin/env python3
"""nano_rlm.py - a compact VM-isolated Recursive Language Model demo.
The full prompt is loaded into an isolated persistent REPL, the root model sees
only metadata, generated Python can call `rlm_query(...)` recursively, compact
observations are fed back, and setting JSON-serializable `Final` returns the
answer. The demo summarizes `rlm.pdf`.
Requires:
- qemu-system-x86_64
@lukestanley
lukestanley / t5_gemma.py
Created November 19, 2025 00:42
Experimenting with non-instruction following T5-Gemma models for summarisation (inference)
"""
In early Nov 2025, I tried the non-instruction tuned T5-Gemma models on Colab.
Why? Modern encoder-decoder models could address prompt injection risks which right now are very high and risky.
This logs some of my successes and HF social signals. I didn't get around to finetuning it yet.
--@lukestanley
"""
# !pip install -q -U transformers bitsandbytes accelerate
from huggingface_hub import login
# login(new_session=False)
login(token=READ_ONLY_HF_TOKEN)
@lukestanley
lukestanley / dspy_minimal_mcp_demo.py
Last active October 21, 2025 01:34
dspy_minimal_mcp_demo.py Shows an get_mcp_tool_session wrapper for DSPy that allows using a list of MCP servers easily specified over HTTP with SSE, and local npx and uvx commands, with a ReAct DSPy agent to answer questions using those tools.
#!/usr/bin/env -S uv run
# Uses the inline script metadata Python Enhancment Proposal (PEP 723)
# To install UV see: https://docs.astral.sh/uv/getting-started/installation/
# To run with UV: uv run dspy_minimal_mcp_demo.py
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "dspy>=3.0.2",
# "mcp>=1.2.0",
@lukestanley
lukestanley / share_my_wifi_qr_code.py
Created October 5, 2025 15:19
Share WiFi password as QR code from terminal on Ubuntu 24.04
# Uses the inline script metadata Python Enhancment Proposal (PEP 723)
# To install UV: https://docs.astral.sh/uv/getting-started/installation/
# To run with UV: uv run share_my_wifi_qr_code.py
# /// script
# requires-python = ">=3.12"
# dependencies = ["qrcode-terminal"]
# ///
import shutil
@lukestanley
lukestanley / map.svg
Created April 5, 2025 01:54
AI-2027 Map: A scenario beginning in mid-2025 splits at a key decision in Oct 2027—prioritise speed or safety in AI development. Shared path: AI accelerates AI. US–China AI race heats up. Alignment issues emerge. Agent-4 gives 50x R&D boost. Oversight Committee forms. Speed path ("Race wins"): Agent-5 misleads monitors, manipulates Oversight. Sh…
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

《两年内 AI 如何接管一切》🚀 作者:Joshua Clymer @joshua_clymer,2025年2月7日。

`How AI Might Take Over in 2 Years` by Joshua Clymer @joshua_clymer, 7 Feb 2025.

![][image1]
我不是天生的“末日预言家”😟。但不幸的是,作为 AI 安全研究员,我的部分工作是思考那些更令人不安的情况。
I’m not a natural “doomsayer.” But unfortunately, part of my job as an AI safety researcher is to think about the more troubling scenarios.

我就像阿波罗 13 号🚀起飞前最后一刻还在忙着检查的机械师👨🔧
I’m like a mechanic scrambling last-minute checks before Apollo 13 takes off.

@lukestanley
lukestanley / translate_zh.py
Created February 8, 2025 22:00
Translates sentences of English text to bilingual Chinese and English with emojis
import json
import nltk
import requests
import hashlib
from diskcache import Cache
from time import sleep
# Set up disk-backed cache that caches forever
cache = Cache('disk_cache')