ungovernable.tech

[ DEEP DIVE ][ IDENTITY, SOCIAL AND TRUST ][ SOVEREIGN APPLICATIONS ]

Nostr Groups and Git

Also Nostr Groups, NIP-29, NIP-34, ngit, GRASP.

Two Nostr specifications that turn the protocol from a broadcast feed into something with rooms and version control. NIP-29 defines relay-enforced groups — closed, moderated, migrating between relays.

Experimental updated 2026-11-17 18 min read
Contents

Nostr is the note for the identity primitive these both sit on: a secp256k1 keypair with no registrar. Nostr Deep Dive covers the messaging side.

Summary

NIP-29 — Relay-based Groups NIP-34 — git over Nostr
Status in the NIPs repo draft optional relay draft optional
What it defines Groups writable only by a closed set, enforced by the hosting relay Repository announcements, patches, pull requests, issues and status, all as Nostr events
Who holds authority The relay. It signs the group metadata and decides what is valid The repository owner, announced by a kind:30617 event signed by the maintainer's key
Key kinds 39000 metadata, 39001 admin list, 39003 roles, 9000–9020 moderation, 9021 join, 9022 leave, 10009 relay hint 30617 announcement, 30618 state, 1617 patch, 1618 PR, 1619 PR update, 1621 issue, 1630–1633 status, 10317 grasp list
Implementation relay29 library: khatru29, strfry29, relayer29 wrappers ngit (Rust) with a git-remote-nostr helper
Maturity Protocol has moved through several revisions in 2026; the reference library's last tagged release was 2024-12-07 ngit v3.1.0 released 2026-11-15 after a long release-candidate series

Part 1 — NIP-29: groups the relay controls

The model

NIP-29 defines groups "that are only writable by a closed set of users", which may be public for reading or fully private. A group is identified by a random string. There is no creation procedure in the sense of a protocol message: "what happens is just that relays (most likely when asked by users) will create rules around some specific ids so these ids can serve as an actual group."

That single sentence defines the trust model. A group is only as durable as the relay's willingness and ability to keep hosting it, because enforcement is tied to a specific relay. This is the opposite of the key-rooted design elsewhere in this library: an identity needs no permission, but a group does.

Identity, migration, and forking

A group is held together by two things: the group id, and the relay currently enforcing access rules over that id on behalf of one or more group owners or admins. Three consequences follow directly, and the spec is unusually explicit about all three.

Migration. If the hosting relay becomes unresponsive, goes offline permanently, or "simply becomes untrustworthy", the group can be moved by copying the existing events to another relay, provided that relay agrees to receive the old group and continue enforcing the same rules and acknowledging the same admins.

Forking. A dissident faction can take the group's history to a different relay that agrees to change the rules and assign admin powers to a different set of users. The new relay keeps the same id but enforces different moderation policy and a different admin roster. The spec's own sentence is worth quoting because it inverts the usual reading of "fork": "Forks are not bugs. It's a feature of this NIP that the same id can simultaneously identify different communities with different governance, hosted by different relays, each with their own kind:39000 metadata event, their own kind:39001 admin list and their own message history."

Detection. Clients SHOULD, and MUST if the primary relay is offline, periodically inspect the kind:10009 event of the group's admins and of trusted friends. Admin pubkeys should be cached locally so the check survives the primary relay going down. If the relay hint in a kind:10009 has changed, the client SHOULD notify the user that the group may have moved or been forked and offer to fetch from the new relay.

Replication for resilience. Groups that do not want to lose history should keep a live replica of all group events on a second relay. The replica need not enforce any moderation rules — it exists only to preserve history so that if the primary relay disappears, a new authoritative relay can be chosen and the history copied over.

Events and the h tag

Every user-created event sent to a group (chat messages, long-form notes, moderation events) MUST carry an h tag whose value is the group id. The relay-generated metadata events instead use a d tag set to the group id, with the kind set to 39000 and the public key set to the relay's self key, which makes them addressable events signed by the relay keypair directly.

Timeline references. Events may contain references to previous events in a previous tag. The references use the first 8 characters (4 bytes) of any event in the last 50 events seen by the user in that relay, excluding their own. Clients should include at least three; relays are expected to enforce this. The spec explains the purpose as preventing messages being broadcast to external relays that hold forks of the same group "out of context". Relays are expected to reject events containing timeline references to events not found in their own database, and clients should check the same references to keep relays honest.

Late publication. Relays should prevent late publication — messages published now but carrying a timestamp from days or hours earlier — unless they are open to receiving a group forked or moved from another relay.

The moderation event set

Moderation events (kinds 9000–9020) are sent by users and validated by the relay against the sender's role. The documented set:

kind name tags
9000 put-user p with pubkey hex and optional roles
9001 remove-user p with pubkey hex
9002 edit-metadata all the fields of group-metadata
9005 delete-event e with event id hex
9007 create-group —
9008 delete-group —
9009 create-invite arbitrary code
9010 update-pin-list zero or more e with event id hex or a with event address

A kind:9021 join request is sent by any user; the relay must reject it if the user has not been added to the group, with an error message that explains whether the rejection is final, pending review, or otherwise special (a payment requirement, for instance). An already-member request must be rejected with the error prefix duplicate:. A kind:9022 leave request removes the user, and the relay answers with a kind:9001.

Group state is reconstructed from the canonical sequence of moderation events; the 39000-series events are informative snapshots of that state, not the source of truth.

Group metadata and privacy flags

The kind:39000 event is signed by the relay master key only — relays should not accept it from anyone else — and carries name, picture, banner, about, plus four behavioural flags whose absence is meaningful:

  • private — only members can read group messages. Omitting it means anyone can read.
  • restricted — only members can write to the group. Omitting it means anyone can send messages.
  • hidden — relays should hide group metadata from non-members. Omitting it means anyone can request the metadata event.
  • closed — join requests are ignored. Omitting it means users can expect requests to be honoured.

Plus livekit for LiveKit-powered AV rooms and supported_kinds, a list of stringified kinds the group supports; when not specified all kinds are assumed supported, and it may contain no items at all, meaning text is not supported.

Live audio and video spaces

Groups may declare AV support by including a livekit tag in the announcement event. A client obtains a LiveKit JWT by calling the relay path /.well-known/nip29/livekit/<group-id> with a NIP-98-style Authorization header, whose event must be of kind 27235 and contain a u tag with that URL. The relay enforces access control at JWT creation time according to the group settings, and MUST set the sub property on the JWT so that its first 64 characters are the lowercase hex public key of the Nostr user, appending a random identifier so the same user can join multiple times. Relays should serve status code 204 at https://relay.tld/.well-known/nip29/livekit so clients can detect support before offering the option.

The implementation picture

The reference library is fiatjaf/relay29, described as "a library for creating NIP-29 relay-based groups", because "NIP-29 requires relays to have more of an active role in making the groups work with the rules". It currently supports khatru through the khatru29 wrapper, strfry through the strfry29 plugin, and relayer through relayer29. The Relay Runner guide walks through standing up a khatru-based relay with the groups.fiatjaf.com example.

The library's own release history is old: the newest tagged release is v0.5.1 from 2024-12-07, with v0.5.0 (2024-12-07), v0.4.0 (2024-11-12) and v0.3.0 (2024-09-12) before it. Its branch has seen later maintenance — the master branch shows commits through 2025-06-21 including a fix to the AddToPreviousChecking exception, a fix to an incorrect negation in setting the group Closed flag (#18), dependency updates (#16) and an implementation of GetAuthed (#17) — but no release has been tagged since 2024. That gap between the spec's 2026 activity and the library's 2024 release is the honest state of NIP-29 implementation.

Client-side listings put NIP-29 in 0xChat, chachi.chat, the web client at groups.nip29.com, and Flotilla (partially), with Amethyst also listed by some directories. Relay-side, groups.nip29.com and groups.fiatjaf.com are the named instances.

Part 2 — NIP-34: git over Nostr

The model

NIP-34 "defines all the ways code collaboration using and adjacent to git can be done using Nostr". Repositories still live on git servers; what Nostr carries is the announcement, the state, the patches, the pull requests, the issues and their status.

The repository announcement is a kind:30617 event with a d tag as the repository id, plus name, description, web and clone URLs (both may repeat), relays (the relays that will monitor for patches and issues), maintainers, hashtags in t tags, and an r tag carrying the earliest unique commit id marked euc — the commit id that identifies this repository among forks and groups it with repositories hosted elsewhere that represent essentially the same project. That is usually the root commit; in the case of a permanent fork, it is the first commit after the fork. Only d is required.

The u tag is the subordinate-fork marker, and it points at a base repository announcement with a relay hint and the author pubkey.

An optional kind:30618 event carries repository state: refs/<heads|tags>/<name> tags mapping to commit ids, plus a HEAD tag with a ref: refs/heads/<branch> value.

Patches, pull requests, issues

A patch is kind:1617 whose content is the output of git format-patch. It references the repository with an a tag and carries r (earliest unique commit) and p tags for the repository owner and other interested users, t tags of root and root-revision for series structure, and optionally commit, parent-commit, commit-pgp-sig and committer tags — the last group being what makes the applied commit reproducible, including a stable commit id and a PGP signature. A patch revision should include a NIP-10 e reply tag pointing to the previous patch, and the first revision should also reply to the root patch. Patches should be used if each event is under 60 kB, otherwise PRs should be used.

A pull request is kind:1618 with subject, optional t labels, c for the tip commit, one or more clone URLs, an optional branch-name, an optional e pointing at a root patch the PR revises, and an optional merge-base. A PR update is kind:1619, which changes the tip of a referenced PR and follows the NIP-22 convention with uppercase E and P tags for the PR event and its author.

An issue is kind:1621 — markdown text with an optional subject and any number of t labels. Replies to issues, patches and PRs follow the NIP-22 comment format.

Status events

Status defaults to Open and is set by issuing status events: kind:1630 Open, kind:1631 Applied/Merged for patches and Resolved for issues, kind:1632 Closed, kind:1633 Draft. The most recent status event by created_at, from either the issue or patch author or a maintainer, is the valid one. A patch revision's status is that of its root patch, except that a revision is 1632 if the root patch is 1631 and the revision is not tagged in the 1631 event. The 1631 event can carry a q tag with the applied patch event id and, when merged, a merge-commit tag plus the r tag for that commit; when applied rather than merged, an applied-as-commits tag with the resulting commit id.

The clone URL format

A nostr:// URL can reference a repository announcement in a way compatible with git clone when a git-remote-nostr helper is installed:

nostr://<naddr>
nostr://<npub|nip05>/<identifier>
nostr://<npub|nip05>/<relay-hint>/<identifier>

Both the relay hint and the identifier must be percent-encoded per RFC 3986 §2.1; the relay URL's wss:// scheme may be omitted for brevity. The identifier is the d tag value of the kind:30617 event.

The grasp list

A kind:10317 event lists the grasp servers a user generally wants for NIP-34 activity, in g tags holding grasp service websocket URLs in order of preference. It is functionally the same idea as the NIP-65 relay list and the Blossom list.

Part 3 — ngit: the working client

ngit is the Rust implementation, described in its own README as a "nostr plugin for git". What it does:

  • Clone a Nostr repository, or add it as a remote, using nostr://<npub|nip05-address>/<identifier> or a NIP-AD web address such as nostr://ngit.dev/ngit.git.
  • Remote branches beginning with pr/ are open pull requests from contributors; ngit list shows all PRs.
  • To open a PR, push a branch with the pr/ prefix, or use ngit send for advanced options.
  • Publish a repository to Nostr with ngit init.
  • ngit pr checkout <id> performs the familiar git fetch, git pull and git push sequence.
  • It can publish a site through Blossom and NIP-5A with ngit nsite publish, publish a signed kind-30624 tag map with ngit container (aliased ngit oci), and drive a CI workflow coordinator.

Installation is one line (curl -Ls https://ngit.dev/install.sh | bash), or via cargo, nix (nix profile add 'git+https://ngit.dev/ngit.git?ref=stable'), or prebuilt binaries. Two binaries are needed: ngit and git-remote-nostr, the latter a small compatibility launcher that git discovers by name with the implementation living in ngit.

Configuration. ngit --customize lists supported git config keys and their environment-variable overrides. Documented examples include nostr.repo-relay-only (publish Nostr events only to the repository's relays), nostr.auto-pr-branches (fetch every open and draft PR branch, default false), nostr.relay-timeout-secs (default 45 seconds), nostr.relay-connect-timeout-secs (default 7 seconds, covering both connect attempts and quorum grace) and nostr.http-io-timeout-ms (default 600000, allowing large GRASP pushes up to ten minutes of socket silence).

Trust model. The README states the constraint plainly: a git server is still required for data storage and for syncing state. Multiple git servers can be used for redundancy and can be swapped out by maintainers "just like nostr relays". The relay is the transport, not the source of truth.

Release engineering. v3.1.0, released 2026-11-15, is the current stable release. Its own notes describe expanding CI controls and live status, simplifying signer and agent workflows, and improving release delivery, PR handling and security. Concrete additions include an optional software_target manifest field for release assets (emitted as a T tag), rehearsals of the post-release GitHub and documentation updates without publishing, applying reviewed repair code to an existing signed release without rebuilding binaries, and standalone installers that retry other Blossom servers and the versioned GitHub mirror when a download fails or its checksum differs — verifying the signed hash before extracting any archive. The v3.0.0 release-candidate series ran from 2026-09-03 to 2026-09-04 through eight candidates, hardening malformed maintainer-role recovery and adding canonical bootstrap installers.

Trade-offs

Decision Gain Cost
Relay-enforced groups (NIP-29) vs key-only group membership Real moderation, role hierarchy, invite codes, private groups, join/leave workflow The relay is the authority and the single point of failure; "not trustless" in the plain sense
Forkable group ids A dissident faction can leave with its own history and governance The same id means different things on different relays — clients must fetch and compare, and can be fooled by a stale kind:10009
Timeline previous references Prevents out-of-context rebroadcast to relays holding a fork Loss of messages if a relay prunes the referenced events; a relay can reject valid messages referencing events it no longer stores
Relay-generated metadata A client has one authoritative snapshot for rendering It is a snapshot, not the state; the moderation history is the state, and reconstructing it is the client's job
LiveKit AV in the group Voice and video rooms with relay-issued JWTs and relay-enforced access control The relay mints identity into the JWT — it must set sub to the hex pubkey or the room loses the link to the Nostr identity
Git over Nostr (NIP-34) Patches, PRs, issues and status as signed Nostr events; no forge account required A git server is still required for storage and state; the relay is transport only
pr/ branch convention for PRs Ordinary git semantics — push a branch, get a PR Branch-name-as-protocol is not self-describing; the client has to interpret the ref namespace
Publicly documented u tag and euc commit id A repository announces itself as a fork of a specific base, and identical projects can be grouped across forges Both depend on the maintainer publishing them correctly; nothing verifies that a claim is honest

Attack surface

The relay is the moderation authority. A NIP-29 relay decides which moderation events are valid, which roles exist, whether member lists are visible, and whether old or out-of-context messages are accepted. Clients can verify signatures and timeline references, but the group's actual state rests on relay policy. A hostile relay can show a different membership list to different users, or refuse to serve history it once held.

Forks enable split-view attacks. Because the same group id can exist on multiple relays with different admins, moderation policy and history, an adversary who convinces clients to migrate to a fork can partition a community — or fork it silently and use the divergence as a signal. This is why the spec mandates the kind:10009 relay-hint check and requires clients to cache admin pubkeys locally.

Stale hints mislead. A client that trusts a cached kind:10009 pointer will keep talking to a relay that no longer hosts the group, and a client that never re-checks will silently miss a migration. Both directions are failure modes.

Timeline references can be weaponised. A relay is expected to reject events referencing events it does not have. If a relay prunes history and clients keep emitting references into that pruned range, legitimate messages are rejected. The reverse also holds: a relay that does not enforce the rule can receive a message anchored to a foreign fork's event, which is precisely the out-of-context rebroadcast the mechanism exists to stop.

JWT identity in the LiveKit path. The relay issues the LiveKit JWT and is required to set sub to the user's 64-character hex pubkey. A relay that mints a JWT with a different or shared sub silently breaks the binding between the Nostr identity and the room participant — and a room that cannot attribute speech to a pubkey is an unauthenticated room.

git over Nostr inherits git's own attack surface plus a relay's. Patches carry git format-patch output, and a commit-pgp-sig tag can carry a PGP signature — but the signature is carried as data in an event, so whether anything verifies it is a client decision, not a protocol guarantee. A malicious patch is a malicious patch with extra reach: it is broadcast to every relay listed in the repository's relays tag. Whoever controls that tag controls the blast radius.

The maintainer is the trust root. A kind:30617 announcement asserts, by signature, that the author is a maintainer of the primary project — unless a u tag is included. A fork can announce itself as a fork (via u) but nothing prevents a hostile fork from claiming to be the original. Clients group repositories by the euc earliest-unique-commit tag, so that tag is a meaningful claim worth checking against the actual git history.

GRASP as a dependency. The kind:10317 grasp list is a user-published preference list; the servers in it are third-party. The nostr.relay-timeout-secs and nostr.http-io-timeout-secs defaults (45 s and 600 s) show how much of the workflow is waiting on a remote party that can be slow or gone. The installer's own fallback logic — retry other Blossom servers and the versioned GitHub mirror when a download fails or its checksum differs — exists precisely because a single download path is a single point of failure, and because a mismatched checksum is the signal that something is wrong.

The ngit install path. curl -Ls https://ngit.dev/install.sh | bash is the documented one-line install. It is the standard convenience-and-risk trade-off; the release signing and checksum verification are the mitigation.

Evidence at a glance

Item Source Date read What it supports
NIP-29 status draft optional relay; group id is a random string; relays create the rules nips/29.md 2026-11-17 The spec's own framing of group creation and status
"The group is only as durable as that relay's willingness and ability to keep hosting it" nips/29.md 2026-11-17 The trust model in one sentence
Migration, forking and "Forks are not bugs" nips/29.md 2026-11-17 Governance-fork behaviour and the fork-as-feature principle
kind:10009 relay-hint check, SHOULD/MUST cadence, local admin-pubkey caching nips/29.md 2026-11-17 How a client detects migration or fork
Replica relay for history preservation, no moderation duty nips/29.md 2026-11-17 The specified resilience mechanism
h tag requirement; previous tag = first 8 chars of any of the last 50 events; ≥3 recommended; relays must reject foreign references nips/29.md 2026-11-17 Timeline-reference mechanics and enforcement
Moderation kind table 9000–9010; join 9021 with duplicate: prefix; leave 9022 nips/29.md 2026-11-17 The full moderation event set
private / restricted / hidden / closed semantics; supported_kinds may be empty nips/29.md 2026-11-17 Group privacy model and defaults
LiveKit: kind:27235 auth, /.well-known/nip29/livekit/<group-id>, sub = 64-char hex pubkey, 204 capability probe nips/29.md 2026-11-17 AV rooms and the identity binding requirement
NIP-29 file commit history: subgroups spec #2319 and banner tag #2383 (2026-07-16), pin-list a tags #2416 (2026-07-17), migration/fork clarification (2026-07-22), previous example (2026-08-08) GitHub per-file commit feed 2026-11-17 The spec was actively revised in mid-2026
relay29 supports khatru29, strfry29, relayer29 relayrunner.org and relay29 2026-11-17 Implementation surface for NIP-29 relays
relay29 latest tagged release v0.5.1 (2024-12-07); master commits through 2025-06-21 (#17 GetAuthed, #18 Closed negation, #16 deps, AddToPreviousChecking fix) GitHub releases and commits 2026-11-17 The implementation lags the spec by roughly two years
Client/relay listings: 0xChat, chachi.chat, groups.nip29.com, Flotilla (partial), Amethyst; groups.fiatjaf.com Nostrbook, Nostr Compass, OpenSats 2026-11-17 Where NIP-29 actually runs (secondary listings)
NIP-34 status draft optional; kinds 30617, 30618, 1617, 1618, 1619, 1621, 1630–1633, 10317 nips/34.md 2026-11-17 The complete event vocabulary
euc earliest-unique-commit tag semantics; u subordinate-fork tag nips/34.md 2026-11-17 Repository identity and fork declaration
60 kB patch/PR threshold; commit-pgp-sig, parent-commit, committer tags nips/34.md 2026-11-17 Reproducibility of applied commits
nostr:// URL forms and RFC 3986 percent-encoding requirement nips/34.md 2026-11-17 Clone-address grammar
NIP-34 file commits: #2503 typos (2026-10-16), GRASP-06 replacing personal-fork (2026-06-24), #2325 removing the unused refs extension (2026-04-25) GitHub per-file commit feed 2026-11-17 Spec revision cadence through 2026
ngit README: pr/ branch convention, ngit list, ngit init, ngit pr checkout, git-remote-nostr launcher, Blossom/NIP-5A publishing, ngit container/ngit oci kind-30624 tag map DanConwayDev/ngit-cli README 2026-11-17 The working client surface
Config keys nostr.repo-relay-only, nostr.auto-pr-branches (default false), nostr.relay-timeout-secs (45), nostr.relay-connect-timeout-secs (7), nostr.http-io-timeout-ms (600000) ngit-cli README 2026-11-17 Operational defaults and their timeout exposure
"a git server is still required for data storage and syncing state" ngit-cli README 2026-11-17 The stated limit of the model
ngit v3.1.0 (2026-11-15): software_target/T tag, publish rehearsals, signed-release repair without rebuild, installer retry with checksum verification GitHub release feed 2026-11-17 Current release and its supply-chain hardening
ngit v3.0.0-rc.8 (2026-09-04) and the eight-candidate series from 2026-09-03 GitHub release feed 2026-11-17 Release maturity: long RC series before 3.1.0
ngit-cli license MIT; ngit also installable via cargo and nix with a stable branch GitHub repo page and README 2026-11-17 Licence and install paths

Also in Sovereign Applications

Page history

Updated
2026-11-17
Origin
Compiled from the ungovernable.tech research notes.
Improve this page
Suggest an edit — issues and pull requests are welcome.