{"owner":"usememos","repo":"memos","hasSkills":true,"hasMcp":false,"mcpConfig":null,"found":["AGENTS.md"],"skills":{"AGENTS.md":"# AGENTS.md\n\nRepository instructions for AI coding agents. Keep this file short, concrete, and tied to commands that actually work in this\nrepo. If a fact here conflicts with source files or CI config, trust the source file and update this guide.\n\n## Project Snapshot\n\nMemos is a self-hosted note-taking app.\n\n- Backend: Go 1.26.2, Echo v5, Connect RPC, gRPC-Gateway, Protocol Buffers.\n- Frontend: React 19, TypeScript 6, Vite 8, Tailwind CSS v4, React Query v5.\n- Storage: SQLite, MySQL, PostgreSQL.\n- Generated API outputs: `proto/gen/` for Go/OpenAPI, `web/src/types/proto/` for TypeScript.\n\n## Working Rules\n\n- Read relevant code before editing; prefer local patterns over new abstractions.\n- Keep diffs scoped. Do not do repo-wide cleanup, dependency churn, or generated-file rewrites unless the task requires it.\n- Do not hand-edit generated proto outputs. Change `.proto` files, then run `buf generate`.\n- Add migrations for all database drivers when schema changes, and update each driver's `LATEST.sql`.\n- Add public API endpoints to `server/router/api/v1/acl_config.go`.\n- Ask before adding heavy dependencies, changing auth/token behavior, or altering Docker/release workflows.\n\n## Commands\n\nRun from the repository root unless a command starts with `cd`.\n\n```bash\n# Backend\ngo run ./cmd/memos --port 8081    # Start backend dev server\ngo test ./...                      # Run all Go tests\ngo test -v ./store/...             # Store tests, including DB drivers via TestContainers\ngo test -v -race ./server/...      # Server tests with race detector\ngo test -v -race ./internal/...    # Internal package tests with race detector\ngo test -v -run TestFoo ./pkg/...  # Run matching Go tests\ngo mod tidy -go=1.26.2             # Match CI tidy check\ngolangci-lint run                  # Go lint, config: .golangci.yaml\ngolangci-lint run --fix            # Auto-fix lint, including goimports\n\n# Frontend\ncd web && pnpm install             # Install dependencies\ncd web && pnpm dev                 # Dev server on :3001, proxying API to :8081\ncd web && pnpm lint                # Type check + Biome lint\ncd web && pnpm test                # Vitest unit tests\ncd web && pnpm build               # Production build\ncd web && pnpm release             # Build SPA into server/router/frontend/dist\n\n# Protocol Buffers\ncd proto && buf generate           # Regenerate Go + TypeScript + OpenAPI\ncd proto && buf lint               # Lint proto files\ncd proto && buf format -w          # Format proto files\n```\n\n## Code Map\n\n| Path | Purpose |\n| --- | --- |\n| `cmd/memos/main.go` | Cobra/Viper CLI setup and server startup |\n| `server/server.go` | Echo HTTP server and background runner wiring |\n| `server/auth/` | JWT access tokens, refresh tokens, PAT handling |\n| `server/router/api/v1/` | Connect/gRPC-Gateway services, ACL config, SSE hub |\n| `server/router/frontend/` | Static SPA serving |\n| `server/router/fileserver/` | Native HTTP file serving, thumbnails, range requests |\n| `server/runner/` | Background memo processing and S3 presign refresh |\n| `store/` | Store facade, cache, migrations, driver interface |\n| `store/db/{sqlite,mysql,postgres}/` | Database-specific drivers and SQL |\n| `proto/api/v1/` | Public API service definitions |\n| `proto/store/` | Internal storage proto messages |\n| `internal/` | App-private packages: scheduler, cron, email, CEL filter, markdown, idp, S3 |\n| `web/src/connect.ts` | Connect RPC clients, auth interceptor, access-token refresh |\n| `web/src/auth-state.ts` | Token storage and BroadcastChannel cross-tab sync |\n| `web/src/hooks/` | React Query hooks for server state |\n| `web/src/contexts/` | React context for client/UI state |\n| `web/src/components/` | Radix/Tailwind UI components and feature components |\n| `web/src/themes/` | CSS themes using OKLch color tokens |\n\n## Change Routing\n\n| Change | Update | Verify |\n| --- | --- | --- |\n| Go service or router behavior | Service code under `server/`, tests near package | `go test -v -race ./server/...` |\n| Store or migration behavior | `store/`, all three DB driver migrations, `LATEST.sql` | `go test -v ./store/...` |\n| Internal package logic | Relevant `internal/` package tests | `go test -v -race ./internal/...` |\n| Frontend behavior | Components/hooks/contexts under `web/src/` | `cd web && pnpm lint && pnpm test` |\n| Frontend production output | Vite config or release-sensitive UI | `cd web && pnpm build` or `pnpm release` |\n| Proto API | `.proto` source plus generated outputs | `cd proto && buf generate && buf lint` |\n| Public unauthenticated route | `server/router/api/v1/acl_config.go` | Targeted server test or manual route check |\n\n## Go Conventions\n\n- Wrap errors with `errors.Wrap(err, \"context\")` from `github.com/pkg/errors`; do not use `fmt.Errorf`.\n- Return service errors with `status.Errorf(codes.X, \"message\")`.\n- Keep imports grouped as stdlib, third-party, then `github.com/usememos/memos`; goimports is run by golangci-lint.\n- Add doc comments for exported identifiers; godot enforces exported comment punctuation.\n- Avoid package-level mutable state unless the surrounding package already uses that pattern.\n\n## Frontend Conventions\n\n- Use `@/` for absolute imports.\n- Follow Biome formatting: 2-space indent, double quotes, semicolons, 140-character line width.\n- Put server data in React Query hooks under `web/src/hooks/`; keep UI-only state in contexts or component state.\n- Use Tailwind CSS v4 utilities, `cn()` for class merging, and CVA for variants.\n- Reuse Radix primitives and existing components before adding new UI primitives.\n- Keep generated proto TypeScript under `web/src/types/proto/` out of manual edits and Biome rewrites.\n\n## Database And Proto Rules\n\n- Schema changes require SQLite, MySQL, and PostgreSQL migrations plus `LATEST.sql` updates.\n- Fresh-install SQL and incremental migrations must stay equivalent.\n- Proto field changes must preserve compatibility unless the task explicitly allows a breaking API change.\n- Regenerate after proto edits and include both Go/OpenAPI and TypeScript generated outputs.\n\n## Verification Policy\n\n- Run the narrowest relevant checks while iterating.\n- Before finishing, run the checks that match the changed surface from \"Change Routing\".\n- For docs-only changes, `git diff --check` is sufficient unless the docs include runnable examples that should be tested.\n- If a required check cannot run locally, report the reason and the exact command that remains.\n\n## CI Reference\n\n- Backend CI: Go 1.26.2, `go mod tidy -go=1.26.2`, golangci-lint v2.11.3, test groups `store`, `server`, `internal`, `other`.\n- Frontend CI: Node 24, pnpm 11.0.1, `pnpm lint`, `pnpm test`, `pnpm build`.\n- Proto CI: `buf lint` and `buf format` check.\n- Docker: `scripts/Dockerfile`, Alpine 3.21 runtime, non-root user, port 5230, multi-arch amd64/arm64/arm/v7.\n"},"files":{"AGENTS.md":"# AGENTS.md\n\nRepository instructions for AI coding agents. Keep this file short, concrete, and tied to commands that actually work in this\nrepo. If a fact here conflicts with source files or CI config, trust the source file and update this guide.\n\n## Project Snapshot\n\nMemos is a self-hosted note-taking app.\n\n- Backend: Go 1.26.2, Echo v5, Connect RPC, gRPC-Gateway, Protocol Buffers.\n- Frontend: React 19, TypeScript 6, Vite 8, Tailwind CSS v4, React Query v5.\n- Storage: SQLite, MySQL, PostgreSQL.\n- Generated API outputs: `proto/gen/` for Go/OpenAPI, `web/src/types/proto/` for TypeScript.\n\n## Working Rules\n\n- Read relevant code before editing; prefer local patterns over new abstractions.\n- Keep diffs scoped. Do not do repo-wide cleanup, dependency churn, or generated-file rewrites unless the task requires it.\n- Do not hand-edit generated proto outputs. Change `.proto` files, then run `buf generate`.\n- Add migrations for all database drivers when schema changes, and update each driver's `LATEST.sql`.\n- Add public API endpoints to `server/router/api/v1/acl_config.go`.\n- Ask before adding heavy dependencies, changing auth/token behavior, or altering Docker/release workflows.\n\n## Commands\n\nRun from the repository root unless a command starts with `cd`.\n\n```bash\n# Backend\ngo run ./cmd/memos --port 8081    # Start backend dev server\ngo test ./...                      # Run all Go tests\ngo test -v ./store/...             # Store tests, including DB drivers via TestContainers\ngo test -v -race ./server/...      # Server tests with race detector\ngo test -v -race ./internal/...    # Internal package tests with race detector\ngo test -v -run TestFoo ./pkg/...  # Run matching Go tests\ngo mod tidy -go=1.26.2             # Match CI tidy check\ngolangci-lint run                  # Go lint, config: .golangci.yaml\ngolangci-lint run --fix            # Auto-fix lint, including goimports\n\n# Frontend\ncd web && pnpm install             # Install dependencies\ncd web && pnpm dev                 # Dev server on :3001, proxying API to :8081\ncd web && pnpm lint                # Type check + Biome lint\ncd web && pnpm test                # Vitest unit tests\ncd web && pnpm build               # Production build\ncd web && pnpm release             # Build SPA into server/router/frontend/dist\n\n# Protocol Buffers\ncd proto && buf generate           # Regenerate Go + TypeScript + OpenAPI\ncd proto && buf lint               # Lint proto files\ncd proto && buf format -w          # Format proto files\n```\n\n## Code Map\n\n| Path | Purpose |\n| --- | --- |\n| `cmd/memos/main.go` | Cobra/Viper CLI setup and server startup |\n| `server/server.go` | Echo HTTP server and background runner wiring |\n| `server/auth/` | JWT access tokens, refresh tokens, PAT handling |\n| `server/router/api/v1/` | Connect/gRPC-Gateway services, ACL config, SSE hub |\n| `server/router/frontend/` | Static SPA serving |\n| `server/router/fileserver/` | Native HTTP file serving, thumbnails, range requests |\n| `server/runner/` | Background memo processing and S3 presign refresh |\n| `store/` | Store facade, cache, migrations, driver interface |\n| `store/db/{sqlite,mysql,postgres}/` | Database-specific drivers and SQL |\n| `proto/api/v1/` | Public API service definitions |\n| `proto/store/` | Internal storage proto messages |\n| `internal/` | App-private packages: scheduler, cron, email, CEL filter, markdown, idp, S3 |\n| `web/src/connect.ts` | Connect RPC clients, auth interceptor, access-token refresh |\n| `web/src/auth-state.ts` | Token storage and BroadcastChannel cross-tab sync |\n| `web/src/hooks/` | React Query hooks for server state |\n| `web/src/contexts/` | React context for client/UI state |\n| `web/src/components/` | Radix/Tailwind UI components and feature components |\n| `web/src/themes/` | CSS themes using OKLch color tokens |\n\n## Change Routing\n\n| Change | Update | Verify |\n| --- | --- | --- |\n| Go service or router behavior | Service code under `server/`, tests near package | `go test -v -race ./server/...` |\n| Store or migration behavior | `store/`, all three DB driver migrations, `LATEST.sql` | `go test -v ./store/...` |\n| Internal package logic | Relevant `internal/` package tests | `go test -v -race ./internal/...` |\n| Frontend behavior | Components/hooks/contexts under `web/src/` | `cd web && pnpm lint && pnpm test` |\n| Frontend production output | Vite config or release-sensitive UI | `cd web && pnpm build` or `pnpm release` |\n| Proto API | `.proto` source plus generated outputs | `cd proto && buf generate && buf lint` |\n| Public unauthenticated route | `server/router/api/v1/acl_config.go` | Targeted server test or manual route check |\n\n## Go Conventions\n\n- Wrap errors with `errors.Wrap(err, \"context\")` from `github.com/pkg/errors`; do not use `fmt.Errorf`.\n- Return service errors with `status.Errorf(codes.X, \"message\")`.\n- Keep imports grouped as stdlib, third-party, then `github.com/usememos/memos`; goimports is run by golangci-lint.\n- Add doc comments for exported identifiers; godot enforces exported comment punctuation.\n- Avoid package-level mutable state unless the surrounding package already uses that pattern.\n\n## Frontend Conventions\n\n- Use `@/` for absolute imports.\n- Follow Biome formatting: 2-space indent, double quotes, semicolons, 140-character line width.\n- Put server data in React Query hooks under `web/src/hooks/`; keep UI-only state in contexts or component state.\n- Use Tailwind CSS v4 utilities, `cn()` for class merging, and CVA for variants.\n- Reuse Radix primitives and existing components before adding new UI primitives.\n- Keep generated proto TypeScript under `web/src/types/proto/` out of manual edits and Biome rewrites.\n\n## Database And Proto Rules\n\n- Schema changes require SQLite, MySQL, and PostgreSQL migrations plus `LATEST.sql` updates.\n- Fresh-install SQL and incremental migrations must stay equivalent.\n- Proto field changes must preserve compatibility unless the task explicitly allows a breaking API change.\n- Regenerate after proto edits and include both Go/OpenAPI and TypeScript generated outputs.\n\n## Verification Policy\n\n- Run the narrowest relevant checks while iterating.\n- Before finishing, run the checks that match the changed surface from \"Change Routing\".\n- For docs-only changes, `git diff --check` is sufficient unless the docs include runnable examples that should be tested.\n- If a required check cannot run locally, report the reason and the exact command that remains.\n\n## CI Reference\n\n- Backend CI: Go 1.26.2, `go mod tidy -go=1.26.2`, golangci-lint v2.11.3, test groups `store`, `server`, `internal`, `other`.\n- Frontend CI: Node 24, pnpm 11.0.1, `pnpm lint`, `pnpm test`, `pnpm build`.\n- Proto CI: `buf lint` and `buf format` check.\n- Docker: `scripts/Dockerfile`, Alpine 3.21 runtime, non-root user, port 5230, multi-arch amd64/arm64/arm/v7.\n"},"items":[{"name":"AGENTS.md","path":"AGENTS.md","title":"AGENTS.md","content":"# AGENTS.md\n\nRepository instructions for AI coding agents. Keep this file short, concrete, and tied to commands that actually work in this\nrepo. If a fact here conflicts with source files or CI config, trust the source file and update this guide.\n\n## Project Snapshot\n\nMemos is a self-hosted note-taking app.\n\n- Backend: Go 1.26.2, Echo v5, Connect RPC, gRPC-Gateway, Protocol Buffers.\n- Frontend: React 19, TypeScript 6, Vite 8, Tailwind CSS v4, React Query v5.\n- Storage: SQLite, MySQL, PostgreSQL.\n- Generated API outputs: `proto/gen/` for Go/OpenAPI, `web/src/types/proto/` for TypeScript.\n\n## Working Rules\n\n- Read relevant code before editing; prefer local patterns over new abstractions.\n- Keep diffs scoped. Do not do repo-wide cleanup, dependency churn, or generated-file rewrites unless the task requires it.\n- Do not hand-edit generated proto outputs. Change `.proto` files, then run `buf generate`.\n- Add migrations for all database drivers when schema changes, and update each driver's `LATEST.sql`.\n- Add public API endpoints to `server/router/api/v1/acl_config.go`.\n- Ask before adding heavy dependencies, changing auth/token behavior, or altering Docker/release workflows.\n\n## Commands\n\nRun from the repository root unless a command starts with `cd`.\n\n```bash\n# Backend\ngo run ./cmd/memos --port 8081    # Start backend dev server\ngo test ./...                      # Run all Go tests\ngo test -v ./store/...             # Store tests, including DB drivers via TestContainers\ngo test -v -race ./server/...      # Server tests with race detector\ngo test -v -race ./internal/...    # Internal package tests with race detector\ngo test -v -run TestFoo ./pkg/...  # Run matching Go tests\ngo mod tidy -go=1.26.2             # Match CI tidy check\ngolangci-lint run                  # Go lint, config: .golangci.yaml\ngolangci-lint run --fix            # Auto-fix lint, including goimports\n\n# Frontend\ncd web && pnpm install             # Install dependencies\ncd web && pnpm dev                 # Dev server on :3001, proxying API to :8081\ncd web && pnpm lint                # Type check + Biome lint\ncd web && pnpm test                # Vitest unit tests\ncd web && pnpm build               # Production build\ncd web && pnpm release             # Build SPA into server/router/frontend/dist\n\n# Protocol Buffers\ncd proto && buf generate           # Regenerate Go + TypeScript + OpenAPI\ncd proto && buf lint               # Lint proto files\ncd proto && buf format -w          # Format proto files\n```\n\n## Code Map\n\n| Path | Purpose |\n| --- | --- |\n| `cmd/memos/main.go` | Cobra/Viper CLI setup and server startup |\n| `server/server.go` | Echo HTTP server and background runner wiring |\n| `server/auth/` | JWT access tokens, refresh tokens, PAT handling |\n| `server/router/api/v1/` | Connect/gRPC-Gateway services, ACL config, SSE hub |\n| `server/router/frontend/` | Static SPA serving |\n| `server/router/fileserver/` | Native HTTP file serving, thumbnails, range requests |\n| `server/runner/` | Background memo processing and S3 presign refresh |\n| `store/` | Store facade, cache, migrations, driver interface |\n| `store/db/{sqlite,mysql,postgres}/` | Database-specific drivers and SQL |\n| `proto/api/v1/` | Public API service definitions |\n| `proto/store/` | Internal storage proto messages |\n| `internal/` | App-private packages: scheduler, cron, email, CEL filter, markdown, idp, S3 |\n| `web/src/connect.ts` | Connect RPC clients, auth interceptor, access-token refresh |\n| `web/src/auth-state.ts` | Token storage and BroadcastChannel cross-tab sync |\n| `web/src/hooks/` | React Query hooks for server state |\n| `web/src/contexts/` | React context for client/UI state |\n| `web/src/components/` | Radix/Tailwind UI components and feature components |\n| `web/src/themes/` | CSS themes using OKLch color tokens |\n\n## Change Routing\n\n| Change | Update | Verify |\n| --- | --- | --- |\n| Go service or router behavior | Service code under `server/`, tests near package | `go test -v -race ./server/...` |\n| Store or migration behavior | `store/`, all three DB driver migrations, `LATEST.sql` | `go test -v ./store/...` |\n| Internal package logic | Relevant `internal/` package tests | `go test -v -race ./internal/...` |\n| Frontend behavior | Components/hooks/contexts under `web/src/` | `cd web && pnpm lint && pnpm test` |\n| Frontend production output | Vite config or release-sensitive UI | `cd web && pnpm build` or `pnpm release` |\n| Proto API | `.proto` source plus generated outputs | `cd proto && buf generate && buf lint` |\n| Public unauthenticated route | `server/router/api/v1/acl_config.go` | Targeted server test or manual route check |\n\n## Go Conventions\n\n- Wrap errors with `errors.Wrap(err, \"context\")` from `github.com/pkg/errors`; do not use `fmt.Errorf`.\n- Return service errors with `status.Errorf(codes.X, \"message\")`.\n- Keep imports grouped as stdlib, third-party, then `github.com/usememos/memos`; goimports is run by golangci-lint.\n- Add doc comments for exported identifiers; godot enforces exported comment punctuation.\n- Avoid package-level mutable state unless the surrounding package already uses that pattern.\n\n## Frontend Conventions\n\n- Use `@/` for absolute imports.\n- Follow Biome formatting: 2-space indent, double quotes, semicolons, 140-character line width.\n- Put server data in React Query hooks under `web/src/hooks/`; keep UI-only state in contexts or component state.\n- Use Tailwind CSS v4 utilities, `cn()` for class merging, and CVA for variants.\n- Reuse Radix primitives and existing components before adding new UI primitives.\n- Keep generated proto TypeScript under `web/src/types/proto/` out of manual edits and Biome rewrites.\n\n## Database And Proto Rules\n\n- Schema changes require SQLite, MySQL, and PostgreSQL migrations plus `LATEST.sql` updates.\n- Fresh-install SQL and incremental migrations must stay equivalent.\n- Proto field changes must preserve compatibility unless the task explicitly allows a breaking API change.\n- Regenerate after proto edits and include both Go/OpenAPI and TypeScript generated outputs.\n\n## Verification Policy\n\n- Run the narrowest relevant checks while iterating.\n- Before finishing, run the checks that match the changed surface from \"Change Routing\".\n- For docs-only changes, `git diff --check` is sufficient unless the docs include runnable examples that should be tested.\n- If a required check cannot run locally, report the reason and the exact command that remains.\n\n## CI Reference\n\n- Backend CI: Go 1.26.2, `go mod tidy -go=1.26.2`, golangci-lint v2.11.3, test groups `store`, `server`, `internal`, `other`.\n- Frontend CI: Node 24, pnpm 11.0.1, `pnpm lint`, `pnpm test`, `pnpm build`.\n- Proto CI: `buf lint` and `buf format` check.\n- Docker: `scripts/Dockerfile`, Alpine 3.21 runtime, non-root user, port 5230, multi-arch amd64/arm64/arm/v7.\n","category":"root","tokens":1708}]}