# AGENTS.md Guidelines for AI agents (and developers) working on this codebase. ## Project Overview Goose2 is a Tauri 2 + React 19 desktop app. It uses TypeScript strict mode, Vite, and Tailwind CSS 4. The codebase follows a feature-sliced architecture organized under `src/app/`, `src/features/`, and `src/shared/`. ## First Steps Treat this repo as partially Hermit-managed. Do not assume `just`, `pnpm`, `node`, or `lefthook` are available globally. - In bash/zsh, run `source ./bin/activate-hermit` before using repo tools if the shell cannot find `just`, `pnpm`, or other managed binaries. - In fish, run `source ./bin/activate-hermit.fish`. - If PATH still looks wrong or you want to avoid shell assumptions, prefer repo-local binaries such as `./bin/just`, `./bin/pnpm`, and `./bin/lefthook`. - Biome is installed from `package.json` devDependencies, not from Hermit. Run it through `pnpm`, `pnpm exec biome`, or `npx biome` after `just setup`. - On a fresh clone, a newly created worktree, or after `just clean`, run `just setup` before relying on `pnpm`, Biome, or app-local tooling. - In new clones and worktrees, ensure git hooks are installed early with `lefthook install`. If `lefthook` is not on PATH, use `./bin/lefthook install`. - Agents starting in a fresh clone or worktree should do the setup and hook-install steps proactively rather than assuming the environment is already bootstrapped. - Use `just dev` for the normal desktop workflow. Use `just dev-frontend` only when you intentionally want the Vite app without Tauri. ## Common Commands - `just setup` installs frontend dependencies with `pnpm install` and builds the Rust backend once. - `just dev` starts the desktop app in dev mode and wires Tauri to the local Vite server. - `just check` runs Biome checks and file-size checks. - `just test` runs the Vitest suite. - `just tauri-check` runs `cargo check` in `src-tauri`. - `just ci` is the main local verification gate. - `just clean` removes Rust build artifacts, `dist`, and `node_modules`, so `just setup` is required again before `just dev`. ## Architecture & File Structure ``` src/ app/ — App shell, entry point, top-level providers features/ — Feature modules (see Feature Organization below) / ui/ — React components (required) hooks/ — Custom React hooks for feature logic (when needed) stores/ — Zustand state management (when feature needs shared state) api/ — Backend API integration (when feature calls backend) types.ts — Feature-specific type definitions (when needed) shared/ types/ — Canonical shared type definitions (single source of truth) agents.ts — Agent, Persona, Provider types chat.ts — ChatState, TokenState, Session, SSE events messages.ts — Message, MessageContent, type guards ui/ — Reusable UI components (button, etc.) lib/ — Utilities (cn.ts for class merging) theme/ — Theme provider, appearance settings styles/ — Global CSS, design tokens hooks/ — Shared hooks api/ — API integration constants/ — Shared constants context/ — Shared contexts ``` ### Feature Organization Not every feature needs every subdirectory. Use only what the feature requires: | Pattern | Structure | Examples | |----------------------|----------------------------------|----------------------| | **Full-featured** | `stores/` + `hooks/` + `ui/` | agents, chat | | **Data-driven** | `stores/` + `api/` + `ui/` | projects | | **API features** | `api/` + `ui/` | skills | | **Simple features** | `ui/` only | home, settings, sidebar, status | | **Tabs** | `ui/` + `types.ts` | tabs | ### Import Rules for Features - Shared types live in `src/shared/types/` — this is the single source of truth for cross-feature types. - There should be NO root-level `src/stores/` or `src/types/` directories. - Feature stores use feature-relative imports (e.g., `../stores/featureStore`). - Cross-feature imports use `@/features/*/stores/` or `@/shared/types/`. ## Coding Conventions - Use `cn()` from `@/shared/lib/cn` for Tailwind class merging. - Import paths use the `@/` alias (maps to `./src`). - Components are controlled where possible (state lifted to parent). - Use `@tabler/icons-react` for icons (transitioning from `lucide-react`; existing `lucide-react` usage is fine until migrated). - All `