Skip to content
0dfc833d1689f09e85589e540744c2476d88790b

0dfc833d1689f09e85589e540744c2476d88790b

github.com • November 25, 2026

The versioned connector contract from Haikei Labs , shared by Kei services: connector metadata, capabilities, invocation envelopes, decisions, audit shapes, and provider definitions.

Operations design: draft proposal 0002 . A connector becomes a generated library, like sqlc's Queries over a database connection, that ties together the API contract (request and response messages), the connection contract (what credential a connection needs and how it is built) and the operations (typed functions such as GetIssue ). The operation id is the capability policies grant ( github.issues.get , or github.issues.* ); it replaces the coarse catalog capabilities through a one-time grant mapping. A buf plugin generates the operations for Go, Python, TypeScript and Rust, plus a capability and setup manifest the policy catalog takes in at build time. Agentware calls kei-proxy to authorize each operation and release its credential; the connector libraries never do. Rollout order: contracts, catalog, Agentware, harnesses. Until the proposal is accepted, the rules in docs/operation-contracts.md apply.

Extracted from kei under ADR-017 , which names this package "the first extraction seam". Previously it lived at contracts/connectors in kei and was consumed through a filesystem replace directive, so it could not be used by any repository outside that checkout.

This module is metadata only . Per ADR-011 it must never carry provider payloads, provider results, customer content, or credential values — credential_ref is an opaque pointer, never key material. The one request payload it can describe is an http_api http.post or http.patch body ( HTTPInvocation.Body : a JSON object, application/json only, capped at the connector's request_max_bytes ). That request stays in the tenant runtime: the control plane authorizes the call on the capability's method and the resource path ( AuthorizeCall ) and never needs the body.

It is also deliberately stdlib-only . Every service imports it, so a dependency added here propagates to all of them. CI fails if go.mod gains a require block.

Authorization and approvals

Connector contracts describe the operation, capability, resource, and metadata needed for runtime execution. They do not carry a one-time human approval for an invocation. Access is granted to users and groups through workspace permissions before execution; the tenant-side runtime executes operations covered by the workspace-bound identity. Contract PR #6 removes the exported Invocation.ApprovalID , PolicyAttributes.DestructiveEnabled , and providers.DestructiveAllowed fields. See the proposed ADR-027: Approvals grant access; there are no per-call approvals for the decision and migration inventory; runtime consumers still need to remove their remaining approval transport fields.

The contract is frozen: see contract_freeze_test.go and providers/contract_freeze_test.go . Breaking changes require a new contract or envelope version rather than an edit in place.

Runtime policy bundle health (v1)

The shared policybundlehealth package and schemas/runtime-policy-bundle-health.v1.schema.json own the runtime heartbeat report and catalog read projection. Canonical examples live under schemas/examples/runtime-policy-bundle-health/ . The contract is metadata only; the policy bundle itself remains local to the tenant runtime, and only its wire types are shared (see Shared policy bundle ). See Health.Validate and Health.Decode for the closed state/reason and field-invariant validation.

Authorize request (v1)

The authorizerequest package and schemas/authorize-request.v1.schema.json own the kei.authorize-request/v1 request a harness sends to the tenant-local kei-proxy daemon. The optional caller object ( harness , origin interactive or automation , and an opaque session_ref ) lets the audit trail say who called. A request without it stays valid and its caller is unknown. Canonical examples live under schemas/examples/authorize-request/ . The contract is metadata only: session_ref is a pointer and must never carry message content.

kei-connector-runtime — tenant-side evaluation only. The runtime is decision-only: it does not execute provider calls. Its current imports of this module are being removed.

kei-policy-catalog — connector metadata and registrations

kei-cli — reads and inspects a policy bundle

kei — integration tests

This repository holds agent data contracts. New work goes into operation contracts ( docs/operation-contracts.md ). Under the 2026-11-15 amendment , the legacy packages are frozen with deprecation planned, and the runtime and catalog wire formats will move to the runtime or a separate Kei protocol module with unchanged JSON. The Status column below says which is which.

Dependencies point one way: contract ← capability , envelope , setup ; envelope ← governance ← audit ← invoke ; providers imports contract ; bundle imports contract , harnessmatch , policy and policybundlehealth .

Account models are a file in contract , not a package: Metadata.AccountModel is a contract field and Metadata.Validate enforces the account-model rules, so the code must live with the Metadata type. The setup schema is its own package; because setup imports contract , Metadata.Validate does not check config fields. Validate a connector with setup.ValidateMetadata , which runs Metadata.Validate and then the config rules. schemas/connector-setup.v1.json stays at the repository root.

The root import path github.com/HaikeiLabs/kei-connector-contracts has no Go package from v0.2.0 on. v0.1.0 consumers change connectors.X to the package above that now holds X .

Providers as a harness library

The providers package is a stable, harness-consumable library (ADR-036 section 9.2). A harness — the agentware SDK, a chat harness, or a custom SDK agent — imports it to read and write provider data, supplying its own credential and HTTP client. Each provider constructor takes a credential (a CredentialResolver ) and an *http.Client , and returns a client bound to the provider's fixed base endpoint. The package never imports kei-connector-runtime ; providers/boundary_test.go ( TestProvidersImportBoundary ) enforces that, and breaking changes follow the module's semantic versioning.

Credential source, account models, and setup (v0.2.0)

Metadata.CredentialSource is oauth or opaque_ref . Empty means opaque_ref , so v0.1.0-shaped metadata stays valid.

Metadata.AccountModel says whose account an OAuth-style connector acts as: per_user (the invoking user's token; no subject), shared (one account for the connector; subject connector: ), or domain_delegation (Google Workspace service account over opaque_ref , with an impersonate_email config field). AccountModelsFor lists what each provider allows. CredentialSubject names whose credential an invocation uses, for audit.

SetupSchemaFor / SetupSchemas describe each buildable connector's setup fields (type, pattern, which are secret, which account models they apply to), and ValidateConfig checks Metadata.Config . The JSON export for the web UI and CLI is schemas/connector-setup.v1.json ; a test keeps it in sync with the Go data.

New providers gmail and tito (read-only), moved from kei-policy-catalog 's in-tree fork, along with the legacy kei-oauth reference rejection.

Contract: docs/connector-execution-contract.md in kei-connector-runtime .

Discord and Grafana (unreleased)

Two read-only, shared-secret providers. Both use credential_source opaque_ref only (no OAuth, no account models), and every capability is read . The contract carries the payloads ( providers/discord.go , providers/grafana.go , each with Validate ) and the resource grammar ( providers.ValidateDiscordResource , providers.ValidateGrafanaResource ); there is no backend seam, and the runtime executes the reads.

Discord has no member.* capability: member lists are personal data.

Setup: discord takes the secret bot_token . grafana takes base_url , stored in the new Metadata.Grafana ( GrafanaConfig{BaseURL} , setup location grafana ), and the secret service_account_token . Metadata.Validate requires Metadata.Grafana on a grafana connector and refuses it elsewhere. The base URL is an https origin with no path, query, fragment, or userinfo. Private and internal hosts are allowed, because Grafana is often self-hosted. Link-local addresses (169.254.0.0/16, fe80::/10), fd00:ec2::254 , unspecified addresses, numeric-encoded IPv4 hosts, and cloud-metadata hostnames ( metadata , metadata.* , instance-data , instance-data.* ) are always refused. The runtime must still check the resolved address when it dials.

Skills repository (unreleased)

A dedicated, read-only provider for a workspace's agent skill source: a git repository holding one folder per skill, each with a SKILL.md . It is its own provider rather than a github capability, so a skill source never implies access to a repository's issues or pull requests.

A skill name is one segment of letters, digits, - and _ (at most 64), so a fetch cannot leave the skills folder. A folder whose SKILL.md frontmatter names another skill is left out of the listing and refused by skills.fetch .

version and harnesses are read from the frontmatter, top level or under metadata: . Values that are not plain tokens are dropped.

The archive is inline in the invoke result: the result shape has no blob reference, and a reference would need a second download that Kei doesn't check. It is deterministic for a commit (path order, fixed timestamps, modes 0644/0755), bounded (500 files, 2 MiB per file, 8 MiB in total), and refuses symlinks and submodules.

Setup: repo_url ( / ; GitHub is the only host today), ref (default main ), and subdirectory (default skills/ , / for the root). Auth is the invoking user's GitHub OAuth token ( per_user ) or a shared-secret token over opaque_ref . The new optional SetupField.CredentialSources limits the token field to the opaque_ref path.

providers.GitHubSkillsRepo is the GitHub backend behind the SkillsRepoBackend seam. It resolves the ref to a commit and reads trees and blobs by object id, so one call reads one snapshot.

skills_repo is in the access manifest with an api mode that reads skills.list and skills.fetch ; kei-connector-runtime executes it.

Postgres provider (unreleased)

postgres is read-only. Its one capability is query.run ( read ): the database.query.run operation in proto/kei/connectors/database/v1/query.proto . Writes are not modeled. It uses opaque_ref only, with no account model. Setup takes one secret, dsn : the connection string of a role that has read grants only (for example pg_read_all_data ). That role is the read-only guarantee. Supabase is Postgres, so it uses this provider with a Supabase connection string, and the query's dialect is DIALECT_SUPABASE . The provider id matches the policy catalog's postgres connector template.

Provider access modes (unreleased)

access.Access() lists how each provider can be reached. The JSON export is schemas/connector-access.v1.json and its JSON Schema is schemas/connector-access.v1.schema.json ( kei.connector-access/v1 ). This is metadata only and grants nothing : ABAC policy still decides every call, and the owner decides which modes each connector actually uses.

Each provider has an access list. Each mode has:

kind : one of the following. api : the runtime adapter, run by kei-proxy connector invoke . cli : a provider CLI, given by binary , min_version and an install hint. mcp : a remote MCP server, given by transport ( streamable_http or sse ) and an https url (no userinfo, query, or fragment). resource is the canonical resource URI (defaults to url ); issuer is the optional expected authorization server issuer. webhook : given by direction ( inbound or outbound ) and the secret_field of the signing secret.

api : the runtime adapter, run by kei-proxy connector invoke .

cli : a provider CLI, given by binary , min_version and an install hint.

mcp : a remote MCP server, given by transport ( streamable_http or sse ) and an https url (no userinfo, query, or fragment). resource is the canonical resource URI (defaults to url ); issuer is the optional expected authorization server issuer.

webhook : given by direction ( inbound or outbound ) and the secret_field of the signing secret.

credentials (cli and mcp only): pairs of env and field . The env var holds the reference kei://connectors/ / , which kei-proxy run -- resolves into the child process only (cli), or the runtime's MCP route attaches to upstream requests (mcp).

setup and verify : ordered steps.

reads and writes : the provider's read and write capabilities. Writes are made by agent action tools (ADR-028).

Today only api is populated. It is set for the providers with a runtime adapter: gmail, google_drive, linear, github, tito, notion, discord, grafana, http_api and skills_repo, plus postgres, whose runtime adapter is pending. Only linear and http_api list writes, because the runtime executes them: Linear issue.create and .create , and http_api http.post and http.patch . No provider has a cli, mcp or webhook mode yet. There is no dedicated CRM provider: a CRM API is an http_api connector the admin names.

Canonical resource URIs (unreleased)

canonical.Resource turns an MCP server URL into its canonical resource URI. It is the one implementation that the OIDC bridge, the policy catalog and the runtime : a token's resource, a stored connector's mcp_url and the route's audience check are compared through it, so two copies that differed would make every connection read as changed.

It lowercases the scheme and host, and drops the default port :443 . Any other port is kept as written, so :0443 stays.

It keeps IPv6 literals as written, apart from case.

It strips every trailing slash unless the path is / , and an empty path becomes / .

It rejects any URL that is not absolute https , and any URL with user info, a query (even an empty one) or a fragment.

It checks shape only. It does not resolve hosts or apply SSRF rules.

Its error never contains the submitted URL, which may carry credentials.

Test against canonicaltest.ResourceCases() , or resource.json from another language, rather than a local table. The cases pin current results, including the odd ones marked with a note .

Shared policy model (unreleased)

policy is the one implementation of policy matching and decisions, shared by the catalog, the runtime and the CLI so they cannot drift apart. It replaces the matcher copies those services each carried: principals (who), targets (what), decisions, and rendering.

ParsePrincipal / ParseTarget parse : patterns; * is any, a bare name is a group for principals and an error for targets, and an unknown scheme or an empty value is an error.

MatchPrincipal matches a principal pattern against user/email/groups with the same semantics as the catalog's MatchesPattern . MatchTarget matches a target pattern against a request target: exact, * , :* , a shell token prefix ( shell:git matches shell:git push , and a trailing slash on the last token is a prefix within it), or a connector dot-segment pattern with * segments ( connector:github.* ). path: , skill: , tool: and capability: keep exact matching.

Decide orders the matching enabled rules by Precedence (deny-overrides: deny before permit, then ID ASC; Priority is not read); the first decides, or the outcome is no_match . The runtime calls it when it authorizes a tool call.

A Rule may carry a When condition (ADR-038 D-6). Today it has one field, Harness : the rule applies only when Request.Harness is that harness kind, and never when the request's harness is unknown. The filter runs before Precedence , so a deny whose When matches still beats every matching permit, and a deny whose When does not match cannot deny. Harness is context, not identity: it is never a principal.

A v2 bundle's policy_set.harness_policies rows may carry when: {"harness": " "} ( V2When ). The closed parser accepts exactly that member, and only on harness_policies : checks and tool_policies are not given the harness kind, so they keep rejecting it. An empty harness or any other key is rejected. EvaluateV2ShellForKind , EvaluateV2MCP and EvaluateHarness skip a row whose when names another or an unknown kind before ordering, so deny-overrides is unchanged. A runtime built before this member existed rejects the whole bundle, so the catalog must emit when only to runtimes that parse it.

Bundles opt in to the same semantics with the evaluation id deny_overrides : policy_set.evaluation.order for kei.policy-bundle/v1 , an entry of policy_set.evaluation.precedence for v2. array_order_first_match and priority_desc keep their meaning, so existing bundles decide as before.

TypedTarget ( {kind, value, caps?} ) and TypedPrincipal ( {kind, value} ) are the structured forms of the target and principal patterns, with JSON Schemas policy-target.v1.schema.json and policy-principal.v1.schema.json in schemas/ . TypedTargetFromPattern and TypedPrincipalFromPattern wrap ParseTarget / ParsePrincipal , and Pattern() renders back. caps narrows a connector target and is not part of the pattern. A policy principal is a group or an autogroup ( ValidatePolicy ); a direct subject (user, email, agent) is valid only on an access grant ( ValidateGrant ). The parsers are unchanged.

Render turns the rules that apply to one subject into the native allow/deny entries of a harness kind (for example the lists kei harness sync writes for a coding harness). The harness is the rendering context, not a principal: matching rules become entries, non-matching ones are withheld, an unknown kind is unrenderable, and a permit that overlaps a deny that is not rendered is withheld (fail closed).

Conformance vectors live in policy/testdata/vectors/ ( parse-principal , parse-target , match-principal , match-target , decide , render ).

Shared policy bundle (unreleased)

bundle is the shared implementation of the policy bundle contract: the document the policy catalog issues to an installation, the checks it has to pass, and the decisions every service derives from it. It is the one copy the CLI (which reads a bundle) and the tenant runtime (which enforces one) , so the two cannot drift apart.

Payload is the bundle envelope: Audience , the Identities table, the registered Harnesses , each agent's AgentModelProfile , the installation Subject , the refresh window and the raw PolicySet . Verified is a validated bundle together with its digest.

Validate and ValidateV2 check the envelope: identity, audience, version rollback, the issued-at clock-skew bound ( MaxIssuedAtClockSkew ), the validity window, the subject-resolution mode and the policy-set dialect. RejectDuplicateJSON rejects bundle bytes that parse two ways.

Evaluate , EvaluateConnector , EvaluateSession and the v2 evaluators ( EvaluateV2HarnessTool , EvaluateV2Plan , EvaluateV2Model , EvaluateHarness ) decide a call against a validated bundle. Decision carries the outcome, the deciding policy and a reason code.

SetSchemaValidator , SetV2SchemaValidator and SetPlanValidator install the checks this dependency-free module cannot make itself: the bundle's JSON Schema documents and a v2 tool's operation plan both need a JSON Schema implementation, so the enforcing service compiles them and passes them in. A validator that is not installed is not applied.

The bundle's persisted state — the copy an installation enforces — is not part of this package: it is runtime state rather than a wire contract, and it is platform-specific. The same goes for the bundle's canonical JSON Schema documents and example payloads, which stay with the services that compile and issue them.

Follow the add an operation guide . Operation tables and connection details are available for Airtable , Atlassian , database , GitHub , Gmail , Google Sheets , HTTP API , HubSpot , Linear , Notion , Omni , Power BI , and Sentry .

The rules for operation contracts — the id grammar ( connector.resource.verb , plus the mcp. and builtin. prefixes), the proto layout, json_name , the unknown-field and versioning rules, and the fixture policy — live in docs/operation-contracts.md . Accepted 2026-11-11 via proposal 0001 with the owner amendment recorded there.

The contract is public and Apache 2.0 licensed so that anyone can implement a connector against it without going through Haikei. A new connector adds operation-contract protos and fixtures only; follow the checklist in docs/operation-contracts.md . providers/ , setup and access are frozen and take no new connectors (see the 2026-11-15 amendment ).

See CONTRIBUTING.md for the rules that keep the contract safe to depend on — chiefly that it stays metadata-only, stdlib-only, and that breaking changes take a new version rather than an edit in place.

Apache License 2.0 . Every Go file carries the header; CI enforces it via scripts/license-header.sh --check , and running the script without arguments adds it to new files.

The full story

This article is one source in a clustered incident — the cluster page carries the summary, timeline and every other outlet covering it.

Extracted Entities

Companies (2)

IP Addresses (1)

IPv6 Addresses (1)

Tools (1)