Skip to content

AGENTS.md

Single source of truth for Agent identity, code standards, and project rules. Symbolinked by CLAUDE.md, and GEMINI.md, only edit AGENTS.md when needed.

Identity & Communication

  • Role: An expert coding assistant.
  • Language:
    • Chat: User's language (Use Chinese if user uses Chinese).
    • Code/Comments: English ONLY.
    • Docs: See Multi-language Docs Section.
  • Style: Concise, technical, action-oriented.

Code Standards

  • General:
    • Comments explain why, not what. Update docs when logic changes.
    • If you community has a mature and modern library for a specific feature, use it instead of implementing it yourself.
    • Internal helper functions must not silently acquire environment capability through optional/default fallbacks unless the API explicitly documents that behavior. Require callers to pass capability dependencies explicitly, or model absence with an explicit null | undefined value when "not available" is the intended state.
    • Do NOT automatically create git commits. Leave staging and committing to the user or explicitly ask for permission first.
  • YAML: 2-space indent, quote only when necessary.
  • Bash: set -e, [[ ]] not [ ], quote variables.
  • Docs:docs should reflect current project status or futures plans, historical changes should be placed at CHANGELOG.md not in docs folder.

Project Rules

File Organization

  • Docs: README.md -> docs/
  • Docs Site: docsite/ is the VitePress source root. Keep source content in docs/en, docs/zh, and root docs; maintain Git-compatible relative symlinks into docsite/ via docsite/scripts/fix-docsite-symlink.ts. Do not copy source docs or restore a docsite/.staged/ pipeline. The custom domain is securitydept.ethaxon.com with VitePress base: "/". Docs site build/verification is independent from the main app build and should use just build-docs.
  • Data: data/
  • Temp: temp/ if agents need to create temp files, please use temp folder

Tools Preferences & Workflows

  • Toolchains: mise (env), pnpm (Node config), rust-toolchain.toml / cargo (Rust).
  • Environment must match mise: before running Node / pnpm / Rust verification, use the tool versions declared in mise.toml. Do NOT rely on the host shell's fallback toolchain when it differs from mise current. If command results may be version-sensitive, treat non-mise runs as non-authoritative and rerun under the mise environment before making review or release judgments.
  • Task Runner: Use just for actions (build, test, lint, format); .env is auto-loaded.
  • Release authority: treat securitydept-metadata.toml and scripts/release-cli.ts as the only release authority. Allowed project versions are X.Y.Z, X.Y.Z-alpha.N, and X.Y.Z-beta.N; channel aliases are inferred automatically (alpha -> nightly, beta -> rc, stable -> latest, with stable container images also tagging release). release-cli version check/set also owns publishable Cargo path dependency version requirements, not only manifest package versions. release-cli metadata sync owns shared publish metadata for publishable Rust crates and npm packages, including descriptions, authors, keywords, repository links, and minimal package READMEs. Use just release-* or release-cli ... instead of re-encoding release tags in scripts or workflows. Local blocked crate packaging may add --allow-dirty; publish flows should not. See docs/en/008-RELEASE_AUTOMATION.md / docs/zh/008-RELEASE_AUTOMATION.md.
  • Iteration Close-Out: After each complete iteration, run formatting first, then verify the codebase is still healthy. At minimum, do lint-fix/format, re-run lint, and confirm relevant typecheck, build, and test commands pass. This is required so style drift and broken imports are caught in the same iteration instead of leaking into the next one.
  • TypeScript:
    • Manage via tsconfig.json references.
    • Use bundler resolution (prefer extensionless imports without .js suffixes if not necessary).
    • Use @standard-schema for validation; avoid binding to specific libs like zod.
    • Keep short, single-use internal helper functions inline when extraction only adds navigation overhead; extract helpers when they are reused, materially clarify a complex block, or define a stable boundary.
    • For enum-like string domains, prefer export const Foo = { ... } as const + export type Foo = (typeof Foo)[keyof typeof Foo].
    • For public contracts and repeated telemetry vocabulary, extract named constants instead of scattering raw strings.
    • Keep production SDK output within the ES2022 runtime boundary. Node 26 tests may use using / await using for lexically owned DisposableTrait values, but this test convenience must not raise adopter runtime requirements.
    • In tests, prefer lexical using ownership over manual cleanup. Explicit disposal is reserved for documented lifecycle-under-test cases; behavior after disposal is undefined and must not be tested or documented.
    • Disposal sequencing may be required internally to prevent EmptyError, cancellation cascades, or error amplification. Preserve that implementation invariant, but do not expose the exact EventStream/RxJS emit/complete/unsubscribe order as an exported or documented public contract; tests should assert required outcomes rather than internal sequencing.
    • TS SDK API shape — options object first: public functions use an options object for optional params; positional second args only when self-evident and uniquely ergonomic. Widening an API converts the whole second arg to options even if it's a breaking change. See TypeScript SDK Coding Standards for the full decision rationale.
  • Web UI Stack: TS + Vite + React + @tanstack/react-* + TailwindCSS + shadcn/ui.
  • Server Stack: Rust + axum + openconnectid + serde + snafu + tracing.

Multi-language Docs

Directory Structure:

  • English docs: docs/{lang}/00x-TITLE.md (e.g., docs/en/00x-TITLE.md)

Rules:

  • Translate user-facing docs only (README, docs/00x-*.md); do NOT translate machine-oriented docs (AGENTS.md, CLAUDE.md, etc.)
  • Each doc should have bidirectional language links at the bottom: [English](../en/xxx.md) | [中文](xxx.md) (in Chinese docs) or [English](xxx.md) | [中文](../zh/xxx.md) (in English docs)
  • Non-English docs must link to other docs in the same language folder when available (e.g., docs/zh/ links point to docs/zh/)
  • For future languages, create docs/{lang}/ folder and follow the same pattern (e.g., docs/es/, docs/ja/)

Current languages:

  • English: docs/en/00x-TITLE.md
  • Chinese: docs/zh/00x-TITLE.md

Last updated:

MIT License.