# Agent Guidelines for XControl ## Repository scope These instructions apply to the entire repository. Create a more specific `AGENTS.md` inside a subdirectory only when you need to override or augment the guidance below for that subtree. ## Project overview XControl is a polyglot monorepo that ships: - Multiple Go services (API server, account service, RAG server, supporting CLIs) under the top-level Go module `xcontrol`. - A Next.js dashboard (`dashboard/`) implemented in TypeScript with Tailwind CSS and Vitest/Playwright tests. - CMS configuration, SQL migrations, deployment manifests, and documentation that are consumed by the services and UI. ## General expectations - Match the existing language of the file (English vs. Chinese or bilingual) and retain the bilingual structure when you touch documentation that already mixes both. - Prefer structured logging (`log/slog`) or existing helper utilities over raw `fmt.Println` in Go code. - Keep configuration files and generated assets deterministic. If you edit files under `config/`, `docs/cms/`, or `scripts/`, mention any required regeneration steps in your commit message or PR description. ## Go code (all directories except `dashboard/`) - Format Go code with `gofmt` (or `go fmt ./...`) before committing. - Organize imports using `goimports` if available; otherwise maintain the existing standard library / third-party separation. - Run `go test ./...` from the repository root (or a narrower package path) after changing Go files. Use `make test` in submodules such as `rag-server/` when you need the module-specific workflow. - Keep configuration structs in sync with their YAML/JSON sources and update default values when you add new fields. ## TypeScript / Next.js dashboard (`dashboard/`) - Use `yarn` (not `npm` or `pnpm`). Install dependencies with `yarn install` and run scripts with `yarn --cwd dashboard