tyger
Copilot instructions75 starsChanged 2 months agoMITView on GitHub
Tyger is a REST API and CLI for remote signal processing. It accepts streaming input, runs containerized user code on Kubernetes (cloud) or Docker (local), and exposes the results via WORM data streams ("buffers"). It is deployed as an ASP.NET Core control-plane service, a data plane service in local mode, plus a set of Go-based CLIs and sidecars. Always read the surrounding code before changing it, and prefer minimal, targeted edits that match the conventions described below. - .NET SDK…
- Installs packages
The file
Show its rules and text
We split this copilot-instructions.md into the rules it gives an agent
18 rules. About 0 are common, 6 are distinctive, and 12 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
12
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 9
Always read the surrounding code before changing it, and prefer minimal, targeted edits that match the conventions described below.
- Very specific: line 73
Run the VS Code task build for fast incremental C# builds with the $msCompile problem matcher (see .vscode/tasks.json).
- Very specific: line 106
Every source file has the standard MIT copyright header.
- Distinctive: line 112
Don't introduce new top-level dependencies casually — both projects use lockfiles and the dependency graph is reviewed.
- Very specific: line 125
Use file-scoped namespaces, simple using statements, pattern matching, collection/object initializers, and predefined type keywords (int, …
- Very specific: line 176
Use the existing logger: github.com/rs/zerolog/log.
- Very specific: line 182
Follow the existing NewXxxCommand() *cobra.Command factory pattern, and use cobra.Command.SilenceUsage = true (inherited from the common …
- Distinctive: line 187
Update both when changing the API.
- Very specific: line 226
Redaction: never log raw URLs or HTTP errors — use RedactUrl / RedactHttpError, which strip query-string values (preserving only …
- Very specific: line 232
All scripts begin with #!/usr/bin/env bash and set -euo pipefail (or -ecuo pipefail for the Makefile recipes).
- Very specific: line 234
Prefer the helpers in scripts/ over re-implementing config lookup.
- Very specific: line 282
Always open the docker workspace via make open-docker-window (or code /workspaces/tyger-docker) rather than cd-ing into the symlinked path …
- Distinctive: line 288
Don't try to "support both modes" with a manually exported env var inside a cloud window.
- Distinctive: line 294
Don't break the lockfiles: After bumping NuGet or Go modules, regenerate both the manifest and the lockfile and commit them together.
- Very specific: line 310
Don't generate or commit secrets: Test client certs come from Key Vault via make download-test-client-cert.
- Distinctive: line 319
Read the existing file and its siblings in the same folder.
- Very specific: line 322
Run make build and the relevant test target (make unit-test is usually enough.
- Very specific: line 325
Run make verify-format before declaring done.
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Tyger — Copilot Instructions
Tyger is a REST API and CLI for remote signal processing. It accepts streaming input, runs containerized user code on Kubernetes (cloud) or Docker (local), and exposes the results via WORM data streams ("buffers"). It is deployed as an ASP.NET Core control-plane service, a data plane service in local mode, plus a set of Go-based CLIs and sidecars.
Always read the surrounding code before changing it, and prefer minimal, targeted edits that match the conventions described below.
Repository layout
| Path | Purpose |
| server/ | .NET 10 solution (tyger.sln) |
| server/ControlPlane/ | tyger-server — runs jobs, manages codespecs/runs/buffers |
| server/DataPlane/ | tyger-data-plane — local buffer I/O endpoint (Docker mode) |
| server/Common/ | Shared library (configuration, middleware, versioning, UDS) |
| server/ControlPlane.UnitTests/ | xUnit tests for the control plane |
| cli/ | Go module github.com/microsoft/tyger/cli (Go 1.26+) |
| cli/cmd/tyger/ | The tyger CLI entry point (cobra) |
| cli/cmd/tyger-proxy/ | Local HTTP/Unix-socket proxy to a remote Tyger API |
| cli/cmd/buffer-sidecar/ | Sidecar that bridges named pipes <-> buffer storage |
| cli/cmd/buffer-copier/ | Server-side cross-region buffer replication |
| cli/cmd/worker-waiter/ | Init container for distributed runs |
| cli/cmd/loader/ | Load/perf testing utility |
| cli/integrationtest/ | End-to-end tests (build tag integrationtest) |
| cli/internal/install/ | cloudinstall (AKS/Azure) and dockerinstall (local) installers |
| scripts/ | Shell helpers used by the Makefiles |
| deploy/config/microsoft/ | Source-of-truth dev/cloud/docker config templates |
| deploy/helm/tyger/ | Helm chart published with releases |
| .devcontainer/ | Dev container (Ubuntu + .NET + Go + Azure CLI + kubectl + helm) |
Toolchain
- .NET SDK pinned in server/global.json (
net10.0, Nullable on,TreatWarningsAsErrors=true,AnalysisMode=Recommended,RestorePackagesWithLockFile=true). When you add or upgrade NuGet packages, update the correspondingpackages.lock.json(runmake restore). - Go version is in cli/go.mod. Modules use a lock file
(
go.sum); rungo mod tidyafter dependency changes. - System tools assumed on
PATH:make,bash,jq,yq,docker,kubectl,helm,az,psql. The devcontainer installs all of these.
Build, test, and format
The top-level Makefile is the canonical entry point for almost
every task. It selects between Makefile.cloud (default) and
Makefile.docker based on the TYGER_ENVIRONMENT_TYPE
environment variable (cloud or docker). Some targets only exist in one of
the two; check both files before assuming a target is missing.
Common targets:
| Target | What it does |
make build | dotnet build server/tyger.sln + go build ./... |
make build-csharp / make build-go | One side only |
make restore | dotnet restore + go mod download |
make format | dotnet format (do this before pushing C# changes) |
make verify-format | What CI runs; also enforces analyzer warnings |
make unit-test | Runs all *.csproj tests and go test ./... (excludes the integrationtest build tag) |
make integration-test | Brings the environment up and runs cli/integrationtest with -tags=integrationtest |
make integration-test-no-up | Skips up; assumes a running deployment |
make integration-test-fast-only | Adds -fast (skips long-running scenarios) |
make up / make down | Install/uninstall Tyger into the target environment |
make install-cli | go install the tyger, tyger-proxy, buffer-sidecar binaries with version + container image metadata baked in via -ldflags |
make run | Run the control plane locally (after make set-localsettings) |
make full | make test INSTALL_CLOUD=true (full CI-style run) |
make pretty-print-config-templates | Regenerate the canonical config YAML; CI fails if the result differs |
Run the VS Code task build for fast incremental C# builds with the
$msCompile problem matcher (see .vscode/tasks.json).
The Go integration tests require the integrationtest build tag
(go test -tags=integrationtest ./... from cli/integrationtest). The
devcontainer's gopls is already configured with this tag.
Typical inner-loop workflows
- Changing Go code (CLI, sidecars, installers). Edit, then
make install-clito rebuild and reinstall thetyger,tyger-proxy, andbuffer-sidecarbinaries on$PATH(with the right-ldflagsbaked in), then exercise the change by runningtyger ...(ortyger-proxy .../buffer-sidecar ...) directly. Nomake upis needed unless the change also requires a redeployed server. - Changing server code (C#). The normal loop is
make up, which builds and pushes the server image and (re)deploys it via Helm/Docker, then runtyger ...against it. For very fast inner iteration you can instead run the control plane locally withmake set-localsettings && make runand pointtyger loginathttp://localhost:5000(cloud) or the local Unix socket (docker). In cloud modemake login-localdoes this for you; in docker mode usemake login. - Changing the API contract (anything that touches DTOs, route handlers,
or the OpenAPI surface): update both the C# model in
server/ControlPlane/Model/and the Go model in cli/internal/controlplane/model/, bump the API version if it's a breaking change, then runmake integration-test-no-up-fast-onlyso the OpenAPI snapshot diff runs.
Coding conventions
General
- Every source file has the standard MIT copyright header. If you create a new
.cs,.go,.sh,.ps1/.psm1, orMakefile, add the matching header — scripts/add-copyright-headers.sh can add missing headers automatically. .editorconfigis authoritative: 4-space indent for C#, tabs preserved in Makefiles, trim trailing whitespace, final newline required.- Don't introduce new top-level dependencies casually — both projects use lockfiles and the dependency graph is reviewed.
C# (server)
- Targets
net10.0, nullable reference types enabled. Treat any new warning as a build break locally (make verify-formatuses-p:EnforceCodeStyleInBuild=true). - Naming (enforced by
.editorconfig):- Public/protected/internal members:
PascalCase. - Instance fields:
_camelCase(leading underscore). - Static fields:
s_camelCase. - Constants & non-private readonly fields:
PascalCase. - Locals and parameters:
camelCase.
- Public/protected/internal members:
- Use file-scoped namespaces, simple
usingstatements, pattern matching, collection/object initializers, and predefined type keywords (int, notInt32). The analyzers will flag the alternatives. - Wire new services through the existing
builder.AddXxx()/app.UseXxx()/app.MapXxx()extension pattern visible in server/ControlPlane/Program.cs. Each feature area (AccessControl,Buffers,Codespecs,Compute,Database,Runs, ...) lives in its own folder underControlPlane/. - API surface is versioned via
Tyger.ControlPlane.Versioning; new endpoints should be registered insideapp.ConfigureVersionedRouteGroup(...)and documented in OpenAPI (server/ControlPlane/OpenApi/). Integration tests diff the generated spec against cli/integrationtest/expected_openapi_spec.yaml; regenerate it when changing the public API. - Logging uses source-generated
LoggerExtensionspartial classes (seeBuffers/LoggerExtensions.csetc.) — add new log entries there rather than calling_logger.LogInformation("literal")ad hoc.
Data plane
- server/DataPlane/ is its own minimal ASP.NET Core
service (
tyger-data-plane) that handles buffer storage in Docker mode. It sharesTyger.Commonwith the control plane and follows the samebuilder.AddXxx()/app.UseXxx()wiring (see server/DataPlane/Program.cs), including its ownConfigureVersionedRouteGroupandTyger.DataPlane.Versioning. It binds to a Unix domain socket and is configured bymake set-data-plane-localsettings/ run withmake run-data-plane. Keep its surface small — buffer storage logic lives inDataPlaneStorageHandler.cs.
Database and migrations
- Database access lives in server/ControlPlane/Database/
(
Repository.cs,Database.cs). Schema changes are versioned, ordered migrations under server/ControlPlane/Database/Migrations/ (1.cs,2.cs, ...). To add one: create the nextMigratorNclass (subclassMigrator, implementApply), then register it as a new entry in theDatabaseVersionenum inMigrations/DatabaseVersions.cswith[Migrator(typeof(MigratorN))]and a[Description(...)]. - Migrations are designed to run without downtime (additive, idempotent
SQL — e.g.
ADD COLUMN IF NOT EXISTS); see docs/reference/database-management.md. They are applied viatyger api migrations apply(make upruns this in cloud mode) and listed withtyger api migrations list. The cli/integrationtest/migrations_test.go end-to-end test exercises this path, so runmake integration-test-no-up-fast-onlyafter touching migrations.
Go (CLI)
- Use the existing logger:
github.com/rs/zerolog/log. Don't addfmt.Printlnfor diagnostics. - Errors propagate via standard
errorreturns; CLI top-level errors are printed by cobra. Uselog.Fatal().Err(err).Msg(...)only at the program edges. - New
tygersubcommands plug into cli/internal/cmd/rootcommand.go. Follow the existingNewXxxCommand() *cobra.Commandfactory pattern, and usecobra.Command.SilenceUsage = true(inherited from the common root). - Control-plane DTOs live in
cli/internal/controlplane/model/ and
are kept in lockstep with the server's
Tyger.ControlPlane.Modeltypes. Update both when changing the API. - Integration test files must start with
//go:build integrationtestand declarepackage integrationtest. Use the helpers in cli/integrationtest/testutils.go (NewTygerCmdBuilder,runTyger,runCommandSucceeds, etc.) instead of shelling out manually.
HTTP client transport (tread carefully)
The CLI talks to a Tyger endpoint over several connection types, all built in cli/internal/client/. This is one of the subtler areas — understand the layering before changing it:
client.NewClient(in client.go) wraps a base*http.Transportin a stack ofhttp.RoundTrippers (clock-skew check, optional debug logging) on top of aretryablehttp.Client. Layers are injected viaClientOptions.CreateTransport(MakeRoundTripper) andCreateDialer(MakeDialer) rather than by rewritingNewClient. UseNewControlPlaneClient/NewDataPlaneClient(the latter sets a longer timeout) instead of callingNewClientdirectly.- The connection type is driven by the login URL scheme, surfaced by
TygerClient.ConnectionType():http/https(TCP),http+unix(Unix domain socket),ssh, anddocker. - Unix sockets: requests use the
http+unixscheme with the socket path base32-encoded into the host (prefixunix----);makeUnixDialer/unixAwareTransport(unixtransport.go) decode it back to aunixdial. Don't put raw filesystem paths in the URL host. - SSH and Docker tunnels are implemented as a
CommandTransport(commandtransport.go) that shells out tossh/docker, writing the HTTP request to the process's stdin and reading the response from stdout. It only interceptshttp+unixrequests and otherwise delegates tonext. URL parsing/formatting for these lives in sshurl.go and dockerurl.go; the transport is wired up in cli/internal/controlplane/login.go. - Proxies:
ParseProxyacceptsnone,auto/automatic/"", or an explicit URL, andhttpCheckProxyFuncdeliberately bypasses proxies for plaintexthttp(thetyger→tyger-proxypath) unless it's a Unix socket. - Redaction: never log raw URLs or HTTP errors — use
RedactUrl/RedactHttpError, which strip query-string values (preserving only non-sensitive keys likeapi-version).
Shell scripts
- All scripts begin with
#!/usr/bin/env bashandset -euo pipefail(or-ecuo pipefailfor the Makefile recipes). Keep that contract. - Prefer the helpers in scripts/ over re-implementing config
lookup. Use
make get-configto render the cloud/docker/dev configuration; fall back toscripts/get-config.shdirectly only when you need its special options.
Deployment model — short version
- Cloud mode (
Makefile.cloud): thetygerCLI installs cloud infrastructure into Azure (tyger cloud install) and then the API (tyger api install) into an AKS cluster via Helm. Container images are pushed to an ACR identified bywipContainerRegistryin the dev config. Authentication uses Microsoft Entra (cert, managed identity, or GitHub federated identity, controlled byTYGER_AUTH_METHOD). - Docker mode (
Makefile.docker): everything runs locally as Docker containers; auth is disabled; the data plane runs alongside the control plane and they talk over Unix domain sockets under install/local/. - The Go installers live in cli/internal/install/cloudinstall/ and cli/internal/install/dockerinstall/. Configuration templates they consume are in cli/internal/install/cloudinstall/ and the deploy/helm/tyger chart.
Switching between cloud and docker mode
The repo is intentionally checked out once but exposed under two paths so that VS Code can host a cloud window and a docker window side by side against the same source tree:
- The devcontainer sets up a symlink
/workspaces/tyger-docker → /workspaces/tyger(see .devcontainer/Dockerfile). make open-cloud-windowopenscode /workspaces/tyger(cloud is the default —TYGER_ENVIRONMENT_TYPEis unset, so the top-level Makefile includesMakefile.cloud).make open-docker-windowopenscode /workspaces/tyger-docker. .devcontainer/devcontainer.bashrc detects that path and exportsTYGER_ENVIRONMENT_TYPE=dockerplus a dedicatedTYGER_CACHE_FILE=~/.cache/tyger/.tyger-docker. That alone is what flips the Makefile toMakefile.dockerand keeps the docker-modetyger loginsession isolated from the cloud one.- .vscode/launch.json has a matching "CLI Docker"
debug configuration that points at the same cache file and uses
substitutePathto translate/workspaces/tyger-docker↔/workspaces/tygerfor the debugger; use it when stepping into the CLI from the docker window.
Practical rules:
- Always open the docker workspace via
make open-docker-window(orcode /workspaces/tyger-docker) rather thancd-ing into the symlinked path from a cloud terminal — otherwiseTYGER_ENVIRONMENT_TYPEwon't be set andmakewill silently run the cloud recipes. - You can verify which mode a terminal is in with
echo $TYGER_ENVIRONMENT_TYPE; it should printdockerin a docker window and be empty in a cloud window. - Don't try to "support both modes" with a manually exported env var inside a cloud window. Open the dedicated window so the cache, env vars, and Makefile selection all line up.
Pitfalls and house rules
- Don't break the lockfiles. After bumping NuGet or Go modules, regenerate both the manifest and the lockfile and commit them together.
- Don't bypass the Makefile. CI invokes the same targets you do; reproducing
a CI failure usually means running the exact
make ...target locally with the sameTYGER_ENVIRONMENT_TYPE. - Don't add API fields without versioning. The server uses
Tyger.ControlPlane.Versioningand the CLI keeps a default version constant (controlplane.DefaultApiVersion). Add new fields behind a new minor version and update the OpenAPI snapshot test. - Don't manually edit
server/ControlPlane/appsettings.local.json. It is regenerated bymake set-localsettings(in cloud mode from live Helm values, in docker mode from the rendered config); persistent changes belong inappsettings.jsonor the chart. - Don't disable analyzers or warnings as a quick fix. The build treats warnings as errors on purpose; fix the underlying issue or scope a targeted suppression with a justifying comment.
- Don't generate or commit secrets. Test client certs come from Key Vault
via
make download-test-client-cert; never hard-code credentials or PII. - Don't run destructive
maketargets without confirming:down,remove-environment,purge-runs, andpublish-official-imagesall touch shared infrastructure.
Quick start checklist for an edit
- Identify the area: server (C#) or CLI/installer (Go).
- Read the existing file and its siblings in the same folder; mimic the patterns (extension methods, naming, logging).
- Make the change with the minimal diff.
- Run
make buildand the relevant test target (make unit-testis usually enough; runmake integration-test-no-up-fast-onlyif you touched the API contract or CLI commands). - Run
make verify-formatbefore declaring done.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

