unyolo

module
v0.2.1-0...-d05ecd0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2026 License: MIT

README

unYOLO

unYOLO

unYOLO is an access-control framework for coding agents. It keeps provider credentials in separate broker processes and checks each requested operation against a policy you control.

An agent can push its own branch and open a pull request without ever receiving a GitHub token. A force-push to main can be refused outright or kept waiting for an operator. The same model applies to Hugging Face and privileged Unix commands.

The repository includes ready-to-run GitHub and Hugging Face brokers. sudo-broker handles approved Unix commands, and the OpenClaw plugin provides an approvals UI.

Policy example

Policy lives in ordinary JSON. This rule gives agent-a read access to one repository and allows fast-forward pushes under its own branch namespace:

{
  "rules": [
    {
      "id": "agent-a-branches",
      "effect": "allow",
      "clients": ["agent-a"],
      "operations": ["contents.read", "git.fetch", "git.push.fast_forward"],
      "targets": [{ "kind": "repo", "owner": "acme", "name": "api" }],
      "attrs": { "refs": ["refs/heads/agent-a/**"] }
    }
  ]
}

No rule grants access to refs/heads/main or git.push.force, so both requests are denied. Git remotes stay as ordinary GitHub URLs and contain no credential:

$ git push origin agent-a/parser-fix
   4d1e07c..9f2c1ab  agent-a/parser-fix -> agent-a/parser-fix

$ git push --force origin main
 ! [remote rejected] main -> main
   (gh-broker: no rule allows git.push.force on refs/heads/main)

Set a rule's effect to request when the operation needs a human decision. The broker keeps the original command blocked and resumes it after approval.

Request path

Every broker uses the same request path:

authenticate client
classify into client + operation + target + attrs
policy decision: deny / active grant / allow / request / no_match
optional operator approval
provider executor
audit log

An unclassified request is refused. A deny rule also overrides any active grant it covers. Provider-specific code is limited to classification and execution.

Included components

Directory Component
brokers/github gh-broker holds GitHub App credentials and handles Git, pull requests, and the GitHub APIs
brokers/huggingface hf-broker handles Hugging Face Git, LFS, Hub operations, and inference
brokers/sudo sudo-broker runs one approved command as another Unix user
plugins/openclaw OpenClaw approvals UI and broker skills
protocol Agent V1 and Operator V1 wire contracts

Each broker has its own process, listener, credential domain, state directory, release artifact, and audit stream.

Build

Use the Go version declared in go.mod:

go build ./brokers/github/cmd/gh-broker
go build ./brokers/huggingface/cmd/hf-broker
go build ./brokers/sudo/cmd/sudo-broker ./brokers/sudo/cmd/sudo-broker-exec
go build ./cmd/unyolo ./cmd/unyolo-telegram

A broker's setup command writes its configuration and protected credential files, then installs the service. For a production host, unyolo system install activates every service as one signed bundle. See docs/OPERATIONS_RUNTIME.md.

Custom brokers

A custom broker supplies a request classifier and executor along with an operation registry and approval text. The shared packages handle authentication, policy, grants, the operator inbox, audit records, service installation, and host checks.

scripts/check-architecture.sh rejects shared code that imports a provider. Package ownership rules are documented in docs/OWNERSHIP.md.

Security boundary

Provider credentials stay inside the broker and are never returned to clients. They must never appear in logs or errors. Agent credentials and operator credentials are separate, and every endpoint except GET /healthz requires authentication.

Run each broker where its clients cannot inspect the broker process or read its files. The <broker> doctor command checks that boundary. See docs/security/THREAT_MODEL.md for the complete threat model.

License

MIT

Directories

Path Synopsis
agent
api
Package agentapi serves the provider-neutral Agent Operations V1 HTTP API.
Package agentapi serves the provider-neutral Agent Operations V1 HTTP API.
client
Package agentclient provides the provider-neutral Agent Operations V1 client.
Package agentclient provides the provider-neutral Agent Operations V1 client.
conformance
Package agentconformance provides reusable black-box Agent Operations V1 tests.
Package agentconformance provides reusable black-box Agent Operations V1 tests.
mcp
Package agentmcp bridges provider-owned MCP tools to Agent Operations V1.
Package agentmcp bridges provider-owned MCP tools to Agent Operations V1.
runtime
Package agentops owns the provider-neutral Agent Operations V1 lifecycle.
Package agentops owns the provider-neutral Agent Operations V1 lifecycle.
v1
Package agentv1 defines the provider-neutral Agent Operations V1 lifecycle.
Package agentv1 defines the provider-neutral Agent Operations V1 lifecycle.
wire
Package agentv1wire translates generated Agent V1 wire models and domain types.
Package agentv1wire translates generated Agent V1 wire models and domain types.
Package approval provides shared approval-channel decision handling.
Package approval provides shared approval-channel decision handling.
notification
Package approvalnotify defines semantic approval notifications shared by all brokers and presentation channels.
Package approvalnotify defines semantic approval notifications shared by all brokers and presentation channels.
notifier
Package notify defines broker approval notification interfaces.
Package notify defines broker approval notification interfaces.
notifier/telegram
Package telegram implements a reusable Telegram approval notifier.
Package telegram implements a reusable Telegram approval notifier.
view
Package approvalview defines the bounded, provider-neutral display projection shared by operator APIs and approval notification channels.
Package approvalview defines the bounded, provider-neutral display projection shared by operator APIs and approval notification channels.
Package auth authenticates named broker clients from shared secrets.
Package auth authenticates named broker clients from shared secrets.
Package authorization coordinates policy decisions and durable approval requests.
Package authorization coordinates policy decisions and durable approval requests.
admission
Package admission provides bounded admission control for authenticated agent operations.
Package admission provides bounded admission control for authenticated agent operations.
budget
Package usebudget models finite and unlimited approval use budgets.
Package usebudget models finite and unlimited approval use budgets.
client
Package grantclient provides provider-neutral temporary-grant HTTP mechanics.
Package grantclient provides provider-neutral temporary-grant HTTP mechanics.
decision
Package decision owns the single unYOLO decision path used by every transport.
Package decision owns the single unYOLO decision path used by every transport.
grants
Package grants stores short-lived broker approval grants.
Package grants stores short-lived broker approval grants.
policy
Package policy evaluates broker authorization rules.
Package policy evaluates broker authorization rules.
preset
Package policypreset owns provider-neutral managed policy artifact lifecycles.
Package policypreset owns provider-neutral managed policy artifact lifecycles.
broker
conformance
Package conformance provides reusable black-box broker contract tests.
Package conformance provides reusable black-box broker contract tests.
controlplane
Package controlplane assembles unYOLO's shared broker control plane.
Package controlplane assembles unYOLO's shared broker control plane.
brokers
github/internal/appmanifest
Package appmanifest generates minimum GitHub App permission manifests.
Package appmanifest generates minimum GitHub App permission manifests.
github/internal/approval
Package approval renders GitHub-specific operator approval details.
Package approval renders GitHub-specific operator approval details.
github/internal/ghplan
Package ghplan owns immutable GitHub execution plans.
Package ghplan owns immutable GitHub execution plans.
github/internal/githubauth
Package githubauth owns every GitHub credential used by gh-broker.
Package githubauth owns every GitHub credential used by gh-broker.
github/internal/githubdoctor
Package githubdoctor verifies local isolation and GitHub-native enforcement.
Package githubdoctor verifies local isolation and GitHub-native enforcement.
github/internal/githubsurface
Package githubsurface validates the complete generated GitHub operation surface.
Package githubsurface validates the complete generated GitHub operation surface.
github/internal/graphqlmanifest
Package graphqlmanifest owns reviewed persisted GitHub GraphQL documents.
Package graphqlmanifest owns reviewed persisted GitHub GraphQL documents.
github/internal/inventory
Package inventory owns exhaustive dispositions for pinned GitHub surfaces.
Package inventory owns exhaustive dispositions for pinned GitHub surfaces.
github/internal/mcpcatalog
Package mcpcatalog filters typed GitHub MCP tools and pages discovery.
Package mcpcatalog filters typed GitHub MCP tools and pages discovery.
github/internal/mcpprojection
Package mcpprojection owns GitHub canonical-to-MCP field aliases.
Package mcpprojection owns GitHub canonical-to-MCP field aliases.
github/internal/opbinding
Package opbinding loads immutable generated GitHub REST bindings.
Package opbinding loads immutable generated GitHub REST bindings.
github/internal/opcatalog
Package opcatalog owns the generated GitHub capability vocabulary.
Package opcatalog owns the generated GitHub capability vocabulary.
github/internal/operations
Package operations owns generated GitHub operation adapters.
Package operations owns generated GitHub operation adapters.
github/internal/policypreset
Package policypreset adapts GitHub authorization semantics to the shared managed policy artifact lifecycle.
Package policypreset adapts GitHub authorization semantics to the shared managed policy artifact lifecycle.
github/internal/schemaregistry
Package schemaregistry owns closed generated GitHub operation schemas.
Package schemaregistry owns closed generated GitHub operation schemas.
github/internal/targetregistry
Package targetregistry owns GitHub target kinds and safe policy fields.
Package targetregistry owns GitHub target kinds and safe policy fields.
github/internal/upstream
Package upstream owns the pinned GitHub source snapshots used by generators.
Package upstream owns the pinned GitHub source snapshots used by generators.
github/internal/upstreamdrift
Package upstreamdrift compares official GitHub metadata with reviewed snapshots.
Package upstreamdrift compares official GitHub metadata with reviewed snapshots.
huggingface/internal/config
Package config loads broker configuration from the environment.
Package config loads broker configuration from the environment.
huggingface/internal/credentialauth
Package credentialauth validates Hugging Face provider credentials without exposing their secret value.
Package credentialauth validates Hugging Face provider credentials without exposing their secret value.
huggingface/internal/gitproxy
Package gitproxy contains git smart-HTTP request parsing and append-only push enforcement helpers.
Package gitproxy contains git smart-HTTP request parsing and append-only push enforcement helpers.
huggingface/internal/hfgrant
Package hfgrant maps Hugging Face request fields onto canonical unYOLO grants.
Package hfgrant maps Hugging Face request fields onto canonical unYOLO grants.
huggingface/internal/hfplan
Package hfplan owns immutable Hugging Face execution plans.
Package hfplan owns immutable Hugging Face execution plans.
huggingface/internal/httpapi
Package httpapi exposes the broker HTTP surface.
Package httpapi exposes the broker HTTP surface.
huggingface/internal/hubclient
Package hubclient is the typed, bounded Hugging Face Hub administration client used by hf-broker operation adapters.
Package hubclient is the typed, bounded Hugging Face Hub administration client used by hf-broker operation adapters.
huggingface/internal/isolation
Package isolation checks whether a local agent identity is isolated from hf-broker's upstream credential on the broker host.
Package isolation checks whether a local agent identity is isolated from hf-broker's upstream credential on the broker host.
huggingface/internal/jsend
Package jsend builds small JSend response envelopes.
Package jsend builds small JSend response envelopes.
huggingface/internal/mcpprojection
Package mcpprojection owns Hugging Face canonical-to-MCP field aliases.
Package mcpprojection owns Hugging Face canonical-to-MCP field aliases.
huggingface/internal/mirror
Package mirror manages commits-only bare mirrors used for append-only ancestry checks.
Package mirror manages commits-only bare mirrors used for append-only ancestry checks.
huggingface/internal/opbinding
Package opbinding loads the pinned, fixed Hugging Face operation bindings.
Package opbinding loads the pinned, fixed Hugging Face operation bindings.
huggingface/internal/opcatalog
Package opcatalog owns the complete Hugging Face capability vocabulary.
Package opcatalog owns the complete Hugging Face capability vocabulary.
huggingface/internal/operations
Package operations owns Hugging Face operation adapters and their registry.
Package operations owns Hugging Face operation adapters and their registry.
huggingface/internal/policy
Package policy parses and evaluates hf-broker rule-based scope files.
Package policy parses and evaluates hf-broker rule-based scope files.
huggingface/internal/policypreset
Package policypreset adapts Hugging Face policy semantics to the shared managed policy artifact lifecycle.
Package policypreset adapts Hugging Face policy semantics to the shared managed policy artifact lifecycle.
huggingface/internal/upstreamdrift
Package upstreamdrift monitors the official Hugging Face OpenAPI surface.
Package upstreamdrift monitors the official Hugging Face OpenAPI surface.
huggingface/internal/xethash
Package xethash validates provider-owned Xet content hashes.
Package xethash validates provider-owned Xet content hashes.
huggingface/internal/xetuploader
Package xetuploader uploads broker-owned files through the maintained hf_xet implementation without exposing Hub or Xet credentials to Agent clients.
Package xetuploader uploads broker-owned files through the maintained hf_xet implementation without exposing Hub or Xet credentials to Agent clients.
sudo/internal/catalog
Package catalog validates and resolves the root-owned sudo command catalog.
Package catalog validates and resolves the root-owned sudo command catalog.
sudo/internal/executorclient
Package executorclient connects the unprivileged frontend to the Unix helper.
Package executorclient connects the unprivileged frontend to the Unix helper.
sudo/internal/executorprotocol
Package executorprotocol defines the bounded frontend-to-helper wire protocol.
Package executorprotocol defines the bounded frontend-to-helper wire protocol.
sudo/internal/executorserver
Package executorserver validates and executes one-shot sudo plans.
Package executorserver validates and executes one-shot sudo plans.
sudo/internal/hostcheck
Package hostcheck validates privileged filesystem facts.
Package hostcheck validates privileged filesystem facts.
sudo/internal/operations
Package operations owns sudo-broker's provider-specific Agent V1 adapter.
Package operations owns sudo-broker's provider-specific Agent V1 adapter.
sudo/internal/plan
Package plan owns immutable sudo execution plans and activation validation.
Package plan owns immutable sudo execution plans and activation validation.
sudo/internal/presenter
Package presenter renders bounded sudo command approval details.
Package presenter renders bounded sudo command approval details.
sudo/internal/privexec
Package privexec performs the final no-shell Unix privilege transition.
Package privexec performs the final no-shell Unix privilege transition.
sudo/internal/routes
Package routes assembles sudo-broker's unprivileged HTTP frontend.
Package routes assembles sudo-broker's unprivileged HTTP frontend.
sudo/internal/sudopolicy
Package sudopolicy defines sudo-broker's provider-owned policy vocabulary.
Package sudopolicy defines sudo-broker's provider-owned policy vocabulary.
cmd
unyolo command
unyolo-coverage command
unyolo-release command
unyolo-telegram command
credential
lifecycle
Package credentiallifecycle records secret-safe credential lifecycle events.
Package credentiallifecycle records secret-safe credential lifecycle events.
provider
Package providercredential defines provider-neutral credential capabilities and the immutable snapshots used by broker discovery and execution.
Package providercredential defines provider-neutral credential capabilities and the immutable snapshots used by broker discovery and execution.
store
Package credentialstore persists generated provider credentials in named, broker-owned encrypted slots.
Package credentialstore persists generated provider credentials in named, broker-owned encrypted slots.
deployment
api
Package api defines the closed setup-component V1 protocol.
Package api defines the closed setup-component V1 protocol.
component
Package component provides provider-neutral setup adapter mechanics.
Package component provides provider-neutral setup adapter mechanics.
flow
Package flow defines the renderer-neutral guided setup contract.
Package flow defines the renderer-neutral guided setup contract.
plan
Package plan creates canonical secret-safe host deployment plans.
Package plan creates canonical secret-safe host deployment plans.
profile
Package profile loads immutable, digest-bound unYOLO deployment packs.
Package profile loads immutable, digest-bound unYOLO deployment packs.
runtime
Package runtime launches signed setup-component adapters over a bounded protocol.
Package runtime launches signed setup-component adapters over a bounded protocol.
session
Package session stores resumable nonsecret guided setup progress.
Package session stores resumable nonsecret guided setup progress.
transaction
Package transaction coordinates durable host deployment steps and rollback.
Package transaction coordinates durable host deployment steps and rollback.
git
client
Package gitclient installs and diagnoses unYOLO's user-level Git routing.
Package gitclient installs and diagnoses unYOLO's user-level Git routing.
protocol
Package gitx contains provider-neutral Git smart-HTTP helpers.
Package gitx contains provider-neutral Git smart-HTTP helpers.
server
Package gitserver restricts a broker listener to authenticated Git data-plane traffic.
Package gitserver restricts a broker listener to authenticated Git data-plane traffic.
Package installer contains the canonical broker-family binary installer.
Package installer contains the canonical broker-family binary installer.
internal
buildinfo
Package buildinfo exposes the release identity embedded in unYOLO binaries.
Package buildinfo exposes the release identity embedded in unYOLO binaries.
clockx
Package clockx contains shared clock selection helpers.
Package clockx contains shared clock selection helpers.
config/client
Package clientconfig writes per-client broker environment files.
Package clientconfig writes per-client broker environment files.
config/envfile
Package envfile reads the strict environment files generated for broker services.
Package envfile reads the strict environment files generated for broker services.
config/secretfile
Package secretfile reads and renders deterministic named-secret files.
Package secretfile reads and renders deterministic named-secret files.
copyx
Package copyx contains small internal copy helpers.
Package copyx contains small internal copy helpers.
fsx
Package fsx provides small durability helpers for trusted filesystem paths.
Package fsx provides small durability helpers for trusted filesystem paths.
host/bundle
Package bundle owns atomic unYOLO host release activation.
Package bundle owns atomic unYOLO host release activation.
host/deployment
Package deployment orchestrates one canonical unYOLO host deployment.
Package deployment orchestrates one canonical unYOLO host deployment.
host/doctor
Package doctor provides secret-safe local broker isolation checks.
Package doctor provides secret-safe local broker isolation checks.
host/identity
Package identity inspects and plans safe unYOLO agent identities.
Package identity inspects and plans safe unYOLO agent identities.
host/layout
Package layout defines the native unYOLO host release layout.
Package layout defines the native unYOLO host release layout.
host/privilege
Package privilege implements the short-lived setup worker protocol.
Package privilege implements the short-lived setup worker protocol.
host/service
Package service renders provider-neutral broker service definitions.
Package service renders provider-neutral broker service definitions.
host/setup
Package setup provides reusable broker setup command primitives.
Package setup provides reusable broker setup command primitives.
keyfile
Package keyfile loads or creates private symmetric keys for local stores.
Package keyfile loads or creates private symmetric keys for local stores.
openapidrift
Package openapidrift compares the structural surface of two OpenAPI documents.
Package openapidrift compares the structural surface of two OpenAPI documents.
optional
Package optional contains small helpers for generated optional fields.
Package optional contains small helpers for generated optional fields.
pathutil
Package pathutil provides shared lexical path checks.
Package pathutil provides shared lexical path checks.
schemautil
Package schemautil contains provider-neutral closed-schema helpers.
Package schemautil contains provider-neutral closed-schema helpers.
secretset
Package secretset validates and matches named shared-secret identities.
Package secretset validates and matches named shared-secret identities.
securefile
Package securefile owns durable writes shared by unYOLO-private stores.
Package securefile owns durable writes shared by unYOLO-private stores.
setx
Package setx contains small shared set operations.
Package setx contains small shared set operations.
slicex
Package slicex contains small shared slice invariants.
Package slicex contains small shared slice invariants.
sortedlookup
Package sortedlookup provides lookup for immutable sorted registries.
Package sortedlookup provides lookup for immutable sorted registries.
storage/command
Package statecmd exposes provider-neutral offline state maintenance commands.
Package statecmd exposes provider-neutral offline state maintenance commands.
storage/files
Package store provides small durable local storage helpers.
Package store provides small durable local storage helpers.
storage/sealed
Package sealedstore stores short-lived encrypted operation payloads outside the broker database.
Package sealedstore stores short-lived encrypted operation payloads outside the broker database.
storage/state
Package state owns unYOLO's local transactional database and process lease.
Package state owns unYOLO's local transactional database and process lease.
storage/stream
Package streamstore persists bounded, short-lived provider byte streams in private files without loading them into memory or SQLite.
Package streamstore persists bounded, short-lived provider byte streams in private files without loading them into memory or SQLite.
strictjson
Package strictjson provides structural checks missing from encoding/json.
Package strictjson provides structural checks missing from encoding/json.
terminal/setup
Package setup implements unYOLO's inline guided setup renderer.
Package setup implements unYOLO's inline guided setup renderer.
tooling/coverage
Package coverage runs a consistent Go coverage gate for broker repositories.
Package coverage runs a consistent Go coverage gate for broker repositories.
tooling/release
Package release builds reproducible broker release archives.
Package release builds reproducible broker release archives.
validatex
Package validatex contains small validation helpers shared inside unyolo.
Package validatex contains small validation helpers shared inside unyolo.
mcp
grant
Package mcpgrant owns the provider-neutral, transcript-safe MCP grant projection layered over unYOLO grant APIs.
Package mcpgrant owns the provider-neutral, transcript-safe MCP grant projection layered over unYOLO grant APIs.
operation
Package mcpoperation owns the provider-neutral MCP operation projection and recovery mechanics layered over Agent Operations V1.
Package mcpoperation owns the provider-neutral MCP operation projection and recovery mechanics layered over Agent Operations V1.
server
Package mcpserver provides a provider-neutral, line-oriented MCP server.
Package mcpserver provides a provider-neutral, line-oriented MCP server.
operation
capability
Package capability defines provider-neutral operation catalog metadata and structural validation.
Package capability defines provider-neutral operation catalog metadata and structural validation.
digest
Package plandigest provides content identifiers for immutable broker plans.
Package plandigest provides content identifiers for immutable broker plans.
payload
Package sealedpayload owns the provider-neutral upload and expiry lifecycle for encrypted, single-use operation inputs.
Package sealedpayload owns the provider-neutral upload and expiry lifecycle for encrypted, single-use operation inputs.
runtime
Package operationruntime owns the provider-neutral capability adapter registry and Agent Operations V1 lifecycle orchestration.
Package operationruntime owns the provider-neutral capability adapter registry and Agent Operations V1 lifecycle orchestration.
operator
api
Package operatorapi exposes unYOLO Operator V1 over protected HTTP.
Package operatorapi exposes unYOLO Operator V1 over protected HTTP.
auth
Package operatorauth authenticates operator identities independently of broker clients.
Package operatorauth authenticates operator identities independently of broker clients.
client
Package operatorclient implements the unYOLO Operator V1 Source contract.
Package operatorclient implements the unYOLO Operator V1 Source contract.
fake
Package operatorfake provides a real in-process operator API for consumer tests.
Package operatorfake provides a real in-process operator API for consumer tests.
inbox
Package operatorinbox projects durable grants into bounded, operator-safe records.
Package operatorinbox projects durable grants into bounded, operator-safe records.
v1
Package operatorv1 defines the provider-neutral Operator V1 domain contract.
Package operatorv1 defines the provider-neutral Operator V1 domain contract.
wire
Package operatorv1wire maps Operator V1 domain values to generated wire values.
Package operatorv1wire maps Operator V1 domain values to generated wire values.
plugins
openclaw/deployment/cmd/openclaw-unyolo-setup command
Command openclaw-unyolo-setup applies signed OpenClaw integration files.
Command openclaw-unyolo-setup applies signed OpenClaw integration files.
protocol
agentwire
Package agentwire provides primitives to interact with the openapi HTTP API.
Package agentwire provides primitives to interact with the openapi HTTP API.
operatorwire
Package operatorwire provides primitives to interact with the openapi HTTP API.
Package operatorwire provides primitives to interact with the openapi HTTP API.
telemetry
audit
Package audit writes secret-safe structured broker audit events.
Package audit writes secret-safe structured broker audit events.
metrics
Package observability owns unYOLO's bounded operational metrics.
Package observability owns unYOLO's bounded operational metrics.
transport
endpoint
Package endpoint defines provider-neutral broker listener and client endpoints.
Package endpoint defines provider-neutral broker listener and client endpoints.
http
Package httpx contains small HTTP safety helpers for broker proxies.
Package httpx contains small HTTP safety helpers for broker proxies.
http/client
Package clienthttp contains shared safety defaults for broker HTTP clients.
Package clienthttp contains shared safety defaults for broker HTTP clients.
http/server
Package serverhttp owns reviewed broker HTTP server profiles and shutdown.
Package serverhttp owns reviewed broker HTTP server profiles and shutdown.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL