dstack AGENTS.md

Repository-specific instructions for dstack, a software project for running workloads and services. They describe its folder layout, development commands, coding conventions, and testing practices.

In plain words
What is it for?
For installing dependencies, running the dstack command or server, formatting and checking Python code, finding tests, and working on the frontend or documentation.
Why use it?
They save developers from guessing how the repository is organized or which commands maintainers expect. This helps changes fit the project and be checked consistently.

Instructions file for CodexOpenCode

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/dstackai/dstack/agents-md
Clone the repo
git clone --depth 1 https://github.com/dstackai/dstack

Made for: Codex, OpenCode.

Per session 1,242 This file is loaded in full into every session.
When invoked 1,242 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.01242 $0.01242
Opus 5 $0.00621 $0.00621
Sonnet 5 $0.00248 $0.00248
Haiku 4.5 $0.00124 $0.00124

Measured yesterday against content hash b7036458ef45, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

dstack AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 53 lines

How it starts

The opening of the file, as written. The whole thing — 53 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Repository Guidelines

Before touching a subsystem, read the relevant notes in contributing/: ARCHITECTURE.md, PIPELINES.md, LOCKING.md, MIGRATIONS.md, RUNS-AND-JOBS.md, AUTOSCALING.md, BACKENDS.md, GPUHUNT.md, PROXY.md, RUNNER-AND-SHIM.md, FRONTEND.md, DOCS.md, DEVELOPMENT.md, RELEASE.md.

Project Structure & Module Organization

  • Core Python package lives in src/dstack; internal modules (including server) sit under _internal, API surfaces under api, and plugin integrations under plugins.
  • Tests reside in src/tests and mirror package paths; add new suites alongside the code they cover.
  • Frontend lives in frontend (React/webpack) and is built into src/dstack/_internal/server/statics.
  • Docs sources are in mkdocs/docs/ with extra contributor notes in contributing/*.md.

Build, Test, and Development Commands

  • Install deps (editable package with extras): uv sync --all-extras (uses .venv in repo).
  • Run CLI/server from source: uv run dstack ... (e.g., uv run dstack server --port 8000).
  • Lint/format: uv run ruff check . and uv run ruff format ..
  • Type check: uv run pyright -p ..
  • Test suite: uv run pytest.
  • Frontend: from frontend/ run npm install, npm run build, then copy frontend/build into src/dstack/_internal/server/statics/; for dev, npm run start with API on port 8000.

Coding Style & Naming Conventions

  • Python targets 3.10+ with 4-space indentation and max line length of 99 (see pyproject.toml; E501 is ignored but keep lines readable).
  • Imports are sorted via Ruff’s isort settings (dstack treated as first-party).
  • Keep primary/public functions before local helper functions in a module section.
  • Roughly keep function definitions in the order they are referenced within a file so call flow stays easy to follow.
  • Prefer early returns over nested if/else blocks when they make the control flow simpler.
  • Keep private classes, exceptions, and similar implementation-specific types close to the private functions that use them unless they are shared more broadly in the module.
  • Prefer pydantic-style models in core/models.
  • Document attributes when the note adds behavior, compatibility, or semantic context that is not obvious from the name and type. Use attribute docstrings without leading newline.
  • Tests use test_*.py modules and test_* functions; fixtures live near usage.
  • Never make network calls inside a DB session or transaction. Fetch what you need before opening the session, or commit and close it before the call.
  • Don't use function-level (inner) imports to break circular imports. Inject the dependency or move the shared code to a lower-level module instead.
  • Never edit a migration that has already been applied or released; add a new migration instead.
  • Derive paths under SERVER_DIR_PATH on access (a get_* function), not as module-level constants, so that patching settings.SERVER_DIR_PATH redirects all of them. Tests rely on this to keep server state out of the real ~/.dstack.
  • Preserve client/server backward compatibility when updating Pydantic models. New fields must be excluded from client requests when unset, for compatibility with older servers (see core/compatibility/*.py). If the allowed domain/type of an existing field is extended, server responses may need to be patched for older clients (see server/compatibility/*.py). No need to exclude new fields from server responses, since clients rely on validate_extra_ignore.

Read the full file on GitHub · 53 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 53 lines · 1,242 tokens per session scan A b7036458ef45

Subscribe to this mod's changes

dstack AGENTS.md is an instructions file published in the GitHub repository dstackai/dstack (2,229 stars, last pushed 4d ago), licensed MPL-2.0. It adds 1,242 tokens to every session, about $0.0062 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.