← Lesson
Tool Isolation Is the Point
Joeven
Run
Reset
Python loads on first run
ALLOW = { "coder": {"src/app.py"}, "planner": {"PLAN.md"}, } def apply_patch(repo, role, path, content): if path not in ALLOW.get(role, set()): return {"ok": False, "error": "forbidden_path", "repo": repo} nxt = dict(repo) nxt[path] = content return {"ok": True, "repo": nxt} repo = {"src/app.py": "x", "PLAN.md": ""} print(apply_patch(dict(repo), "coder", "src/app.py", "y")["ok"]) print(apply_patch(dict(repo), "planner", "src/app.py", "hack")) print("planner PLAN", apply_patch(dict(repo), "planner", "PLAN.md", "steps")["ok"])
Run to execute this in your browser. Nothing is sent to a server.