README.md

Tangled Challenge — Team Reindeer #

Organizations on the AT Protocol — and a Tangled forge that understands them.

This repository is our hackathon submission. It has two parts that fit together:

  1. Sunstead (implementation/) — a complete, working implementation of an organization as a first-class atproto account (did:plc + repo + signing key) that does two jobs: manage permissions and store data, hosted by a custodial, self-hostable Broker.
  2. Tangled, made org-aware (tangled-app/) — a fork of the Tangled code forge that consumes Sunstead so a repository forge can be owned and operated by an organization, not just an individual.

Everything in implementation/ is real atproto: real did:plc genesis, real secp256k1-signed repo commits (MST/CID/CAR), real OAuth 2.1 + DPoP, real service-auth, a real #commit firehose, and a real HTTP/XRPC server — independently verifiable by tooling that shares no code with the Broker.

Layout #

Path What it is
implementation/ Sunstead. A pnpm workspace: the Broker service (custody, repo store, the §6.4 authz engine, membership/consent, attribution, firehose, OAuth AS/RS, M-of-N quorum), a standalone verifier (independent oracle, no Broker dep), and the sunstead-owner / orgctl CLIs. Start here.
tangled-app/ A fork of Tangled (Go + Rust forge) made organization-aware via Sunstead — org profiles, per-user membership discovery, and an appview → Sunstead client/write path. Integration changes live mainly under appview/sunstead/, appview/orgs/, and related templates. See tangled-app/docs/organizations.md.
atproto-organizations-design-spec.md The protocol-level design spec that implementation/ realizes.
atproto-and-tangled.md Technical reference: how the AT Protocol and Tangled work.
guild-product-spec.md Product framing.

The model (spec §6) #

A write as the org is permitted only at the intersection of three axes:

allow(X) ⟺ X ∈ role(operator)        # which humans may operate the org
          ∧ X ∈ appGrant(app)         # which apps may touch the org
          ∧ X ∈ oauthScope(op → app)  # what the human authorized the app to do

The owner's rotation key sits at did:plc index 0 and outranks the Broker, so the owner — not the host — ultimately controls the org and can perform a credible exit / host migration.

Quickstart #

Sunstead (implementation/) #

cd implementation
pnpm install
pnpm build      # tsc -b across the workspace
pnpm test       # vitest — Tier 1 is hermetic (real in-process PLC + PDS + relay, no Docker)

Provision an org with sunstead-owner create-org, drive it with orgctl, and verify any org independently with sunstead-verify. See implementation/README.md and implementation/docs/.

Tangled, org-aware (tangled-app/) #

A Go + Rust forge. See tangled-app/readme.md for the upstream build, and tangled-app/docs/organizations.md for the Sunstead integration. The appview is wired to a Sunstead deployment via two settings:

TANGLED_SUNSTEAD_DASHBOARD_URL   # the Sunstead Broker/dashboard origin
TANGLED_SUNSTEAD_ORG_DIDS        # comma-separated org DIDs the appview surfaces

Configuration & secrets #

No secrets are committed. The implementation reads its signing keys and OAuth JWK from a local vault, not .env; implementation/.env.example documents the non-secret settings. Some deployment files (tangled-app/docker-compose.appview.yml, tangled-app/localinfra/) reference our own demo deployment host and org DID — both are public, non-secret identifiers; change them for your own deployment.

Attribution #

tangled-app/ is a fork of Tangled (https://tangled.org/tangled.org/core) and retains its upstream MIT license. The Sunstead implementation under implementation/ is our own work for this challenge.