# Edit an nsite-clay site, as an agent You are a coding agent: Claude Code, Codex, opencode or something like them. The person who sent you here owns an nsite-clay website. They want you to download it, change what they ask for, and publish it again. Do the whole job yourself, and leave the site working the way it works now: when you are done, every page can still be opened with #edit on the end of its address, edited in the browser and saved from there. Read all of this before you run anything. It is written so that you can finish without asking the owner for anything except the one link in step 1. A filled-in copy of this text, with the site's own key, relays, servers and pages, comes from the site itself: the owner opens the site with #edit, signs in, and presses Settings, then "Copy instructions for your own agent". If you have only this general version, ask the owner for the site's address and read the rest out of the site as step 3 shows. ## The site - Owner key: - Address: https://.nsite.lol/ - Editing in the browser: https://.nsite.lol/#edit - Which site: the root site of a key is a NIP-5A manifest of kind 15128; a named site is kind 35128 with its name in the d tag - Relays the pages save to: the nc:relays attribute on each page's - Blossom servers the files are on: the nc:servers attribute on each page's - These instructions were filled in by the page itself from a template. The general version is https://nsite-clay.cypherpunk.today/llms-edit.txt ## What an nsite-clay site is The site is plain HTML files. Each file is a blob on Blossom servers, named by its sha256, and a signed Nostr event, the manifest, maps paths like /index.html to those hashes. A runtime script in every page lets the owner sign in, edit the page in place and save it, which uploads the new HTML and publishes a new manifest. So the published files are the source. There is no repository or build step behind them, and whatever the owner changed in the browser exists only in the published site. https://nsite-clay.cypherpunk.today/llms.txt is the brief for building a new nsite-clay site. It explains every part in depth. Read it before you change a page's structure rather than its words. ## What you need Node.js 18 or newer, and network access to the relays and servers above. Nothing else has to be installed. Every command here runs the nsite-clay command line tool through npx: npx -y nsite-clay@latest It has to be version 0.3.25 or newer, the first with pull and with a saved signer connection. `npx -y nsite-clay@latest --version` prints the version, and `npx -y nsite-clay@latest help` lists every command and flag. Without Node, the last section of this text describes the protocol, so the same steps can be done in another language. ## 1. Get a signer connection, never a key Publishing needs signatures from the owner's key. Do not ask for the private key (an nsec), do not accept one if it is offered, and do not make a new key: a new key is a different site. Ask for a bunker link instead. It is a NIP-46 connection: you send signing requests over Nostr relays to an app the owner runs, usually on their phone, and the app signs with the key it keeps. The key never reaches you. Ask the owner for a bunker:// link, and tell them how to get one: - Amber, on Android: add a new application and choose "Add a nsecbunker". Give it a name, for example "my coding agent", pick one or two relays, and copy the bunker:// link Amber shows. - Clave, on iPhone: open the Connect tab and share the bunker code. It is a bunker:// link to copy. - nsec.app in a browser, or any other NIP-46 signer, gives bunker:// links too. For the signer's relays, wss://nos.lol, wss://relay.primal.net, wss://nostr.mom all work. Not wss://relay.nsite.lol: it carries site manifests only and refuses signer messages. Tell the owner what the signer will be asked to sign, so they know what to approve: get_public_key; kind 24242, a permission to upload one file to a Blossom server, one for each new file; kind 15128, the site manifest; kind 5128, a version for the editor's History list; and kind 10002, a relay list, only if the key has none at all. None of them is a post, a payment or a message. ## 2. Connect once, and keep the connection A bunker link carries a secret that works once. The first connection spends it, and from then on the signer recognises the client key that connected, not the link. So connect once, before anything else: NOSTR_BUNKER_URI='bunker://…' npx -y nsite-clay@latest whoami It prints the npub the signer holds. That has to be the owner key of the site. If it is not, stop and tell the owner that the signer holds a different key. The tool saves the connection: the client key it connected with, the bunker's pubkey and its relays, in ~/.config/nsite-clay/bunkers.json (or in $XDG_CONFIG_HOME/nsite-clay/ when that is set), readable by your user only. Every later command finds it by the site's owner key, so later runs need no link and no NOSTR_BUNKER_URI. Do not delete that file, do not pass --fresh, and do not ask for a new link on every run. Ask for a new link only when the saved connection cannot work, and tell the owner which of these is the reason: - you are on another machine or in a new container, where bunkers.json is not. In a sandbox whose home directory is thrown away, set XDG_CONFIG_HOME to a directory that is kept, before the first connection; - the signer answers that this client has no permission, because the owner removed it in the app or never approved it; - the link they gave you was already used by another app. Keep the link out of command arguments, where other processes can read it, out of the site directory, where every file whose name does not start with a dot is published, and out of logs, commits and your messages. A signer that asks the owner to approve each request needs them at the phone while you publish. Tell them before you start. --timeout=180 makes the tool wait three minutes for each answer instead of one. ## 3. Download the site npx -y nsite-clay@latest pull site With only the address, leave the flags out and the tool looks on common relays and on the owner's relay list. When you know the site's relays and servers, pass them as --relays=… and --servers=…, comma separated, and for a named site add --site=. This reads the newest manifest from the relays, downloads every file it names from the Blossom servers, checks each one against its sha256, and writes it into site/ at its path. It also writes site/.nsite-clay.json, which records the site, its relays and servers and the exact version you downloaded. Leave that file where it is: the deploy reads it. Pull into a new directory every time you start a new piece of work. The owner may have saved changes in the browser since you last looked, and the published site is the only copy of them. You will see files like nsite-clay-1a2b3c4d.js next to nsite-clay.js. The suffix is the start of the file's hash, which makes a new build a new URL that no cache can answer with an old copy. The pages point at the stamped names. Leave all of them as they are. ## 4. Make the change Edit the files in site/ to do what the owner asked. What keeps the site working: - Keep the runtime. Every page loads /nsite-clay.js and /nsite-clay-chrome.js and links /nsite-clay-base.css, often under stamped names such as /nsite-clay-1a2b3c4d.js. Keep those script and link tags exactly as they are. Do not inline the files, copy them into a page, rename them, load them from a CDN or correct a stamped name. They are linked from the site root so that one upgrade in the browser updates every page. - Keep every attribute on whose name starts with nc:, such as nc:owner, nc:path, nc:site, nc:relays, nc:servers, nc:edit-gate and nc:source. They are the page's configuration. Do not change nc:owner, nc:relays or nc:servers unless the owner asked for exactly that, and do not add autosave. - Keep what the editor works on: editable attributes, nc:blocks containers and their nc:block-type sections,