AGENTS.md
AGENTS.mdAGENTS.mdroot
Quality
89/100
Scores the file, not the repository.Length
1,391 words
17 headings · 7 code blocksRepository
76
— · pushed 9 days agoLast changed
3 days ago
First indexed 3 days ago.1# AGENTS.md23This file provides guidance to Codex and other coding agents when working with code in this repository. `CLAUDE.md` mirrors the same project guidance for Claude Code.45## Project Overview67Sidekick Agent Hub is an AI coding assistant with real-time agent monitoring. It ships as a VS Code extension and a terminal dashboard, using Claude Max, Claude API, OpenCode, or Codex CLI for inference and session monitoring.89The repo is a small monorepo:1011- `sidekick-vscode/` — VS Code extension, extension-host services, and webview source12- `sidekick-shared/` — shared TypeScript library used by the extension and CLI; published as `sidekick-shared`13- `sidekick-cli/` — Ink-based terminal dashboard; published as `sidekick-agent-hub` with the `sidekick` binary14- `docs/`, `mkdocs.yml`, `assets/`, `images/` — documentation site content and assets15- `scripts/` — cross-package build, lint, and version helpers1617## Build & Development Commands1819Extension commands run from `sidekick-vscode/`:2021```bash22npm run compile # Dev build with source maps (esbuild)23npm run build # Production build, minified24npm run watch # Watch mode for development25npm test # Run all tests (Vitest)26npm run test:watch # Watch mode for tests27npm run lint # ESLint check28npm run lint:fix # ESLint auto-fix29npm run format # Prettier write for this package30npm run format:check # Prettier check for this package31npm run package # Create .vsix for distribution32```3334Run a single test file: `npx vitest run src/services/ModelResolver.test.ts` (from `sidekick-vscode/`).3536Press **F5** in VS Code with `sidekick-vscode/` open to launch the Extension Development Host.3738Shared library commands run from `sidekick-shared/`:3940```bash41npm run build # tsc build to dist/42npm test # Build, then run Vitest43npm run lint # ESLint check44npm run format # Prettier write for this package45npm run format:check # Prettier check for this package46```4748CLI commands run from `sidekick-cli/`:4950```bash51npm run build # esbuild ESM binary to dist/sidekick-cli.mjs52npm test # Run Vitest53npm run lint # ESLint check54npm run format # Prettier write for this package55npm run format:check # Prettier check for this package56```5758**Monorepo-wide helpers** (run from repo root) cover all three packages — `sidekick-shared`, `sidekick-vscode`, `sidekick-cli`:5960```bash61bash scripts/lint-all.sh # Lint all three packages (CI lints each separately)62bash scripts/lint-all.sh --fix # Lint + auto-fix all three63bash scripts/format-all.sh # Prettier write across packages, docs, root markdown/YAML, and workflows64bash scripts/format-check-all.sh # Prettier check across packages, docs, root markdown/YAML, and workflows65bash scripts/build-all.sh # npm install + build all three; CLI binary at sidekick-cli/dist/sidekick-cli.mjs66bash scripts/bump-version.sh X.Y.Z # Update package.json versions; sync lockfiles separately67```6869### Documentation Site7071The docs site uses **zensical** (not mkdocs). Config is in `mkdocs.yml` at the repo root, content in `docs/`.7273```bash74zensical build --strict # Build docs site (from repo root)75zensical serve # Local dev server with hot reload76```7778Do **not** use `mkdocs build` or `mkdocs serve` — use `zensical` instead.7980## Architecture8182### Build System (esbuild.js)8384`sidekick-vscode/esbuild.js` produces five bundles:8586| Output | Format | Platform |87| -------------------------------------------- | -------- | -------- |88| `out/extension.js` (from `src/extension.ts`) | CommonJS | Node.js |89| `out/webview/explain.js` | IIFE | Browser |90| `out/webview/error.js` | IIFE | Browser |91| `out/webview/chartjs-vendor.js` | IIFE | Browser |92| `out/webview/d3-vendor.js` | IIFE | Browser |9394Only `vscode` is externalized from the extension-host bundle. Other extension dependencies (including `@anthropic-ai/claude-agent-sdk`, `@opencode-ai/sdk`, and `sidekick-shared`) are bundled by esbuild. The `conditions: ['import']`, `banner`, and `define` settings in `esbuild.js` polyfill `import.meta.url` for ESM deps bundled into CJS. Chart.js and D3.js are bundled into local browser vendor files so the dashboard and mind map work offline.9596### Dual Provider System9798Two separate provider concepts exist:991001. **Inference providers** (`InferenceProviderId` in `src/types/inferenceProvider.ts`): `claude-max | claude-api | opencode | codex` — which service generates AI completions1012. **Session providers** (`SessionProvider` in `src/types/sessionProvider.ts`): `claude-code | opencode | codex` — which CLI agent's sessions to monitor102103Both use auto-detection via `ProviderDetector` based on filesystem presence and most-recent mtime.104105### ClaudeClient Interface106107All inference clients implement `ClaudeClient` from `src/types.ts`:108109```typescript110interface ClaudeClient {111 complete(prompt: string, options?: CompletionOptions): Promise<string>;112 isAvailable(): Promise<boolean>;113 dispose(): void;114}115```116117`AuthService` is the central entry point — lazily initializes the correct client and routes all `complete()` calls.118119### Model Resolution120121`ModelResolver.resolveModel()` handles: `"auto"` → per-feature default tier (from `FEATURE_AUTO_TIERS`) → provider-specific model ID. Legacy names (`haiku`/`sonnet`/`opus`) map through `LEGACY_TIER_MAP`. Tiers (`fast`/`balanced`/`powerful`) map through `DEFAULT_MODEL_MAPPINGS`. Anything else passes through as a literal model ID.122123### Session Monitoring Pipeline124125```126CLI agent writes JSONL/DB files127 → SessionProvider (normalizes to ClaudeSessionEvent)128 → SessionMonitor (watches files, aggregates stats, emits events)129 → Dashboard / MindMap / KanbanBoard / TreeViews / Notifications130```131132Provider implementations live in `src/services/providers/`. Each normalizes raw data into `ClaudeSessionEvent` format defined in `src/types/claudeSession.ts`.133134### Request Management135136- **Debouncing**: Configurable delay (default 1000ms) before firing inline completion requests137- **LRU cache**: `CompletionCache` — 100 entries, 30s TTL138- **Cancellation**: `AbortController` linked through `CompletionOptions.signal`139- **Timeouts**: `TimeoutManager` provides per-operation timeouts with context-size scaling140141### Key Source Locations142143- **Entry point**: `src/extension.ts` — `activate()`, all command/provider registration144- **Core types**: `src/types.ts` (ClaudeClient, CompletionOptions), `src/types/` (per-feature types)145- **Prompt templates**: `src/utils/prompts.ts`, `src/utils/analysisPrompts.ts`, `src/utils/summaryPrompts.ts`146- **Inference clients**: `src/services/AuthService.ts`, `MaxSubscriptionClient.ts`, `ApiKeyClient.ts`, `OpenCodeClient.ts`, `CodexClient.ts` (spawns CLI directly, no SDK)147- **Session providers**: `src/services/providers/ClaudeCodeSessionProvider.ts`, `OpenCodeSessionProvider.ts`, `CodexSessionProvider.ts`148- **z.ai quota** (shared): `sidekick-shared/src/zaiQuotaApi.ts` — `resolveZaiQuota()` reads z.ai's authoritative `api/monitor/usage/quota/limit` endpoint (5-Hour / Weekly windows), discovering credentials from OpenCode's stored z.ai token (`zai-coding-plan` → `zai`) or `ANTHROPIC_BASE_URL` / `ANTHROPIC_AUTH_TOKEN`, with cached-snapshot fallback. The older observed-traffic estimator (`zaiQuota.ts` / `zaiQuotaWatcher.ts`) is retained for backward compatibility but deprecated and no longer used for product quota display. z.ai is monitored-only — no z.ai inference provider or account-management surface yet149- **Webview UI**: `src/webview/` — vanilla TS bundled as IIFE; Chart.js and D3.js load from local vendor bundles150151### Persistence152153Cross-session data stored in `~/.config/sidekick/`:154155- `historical-data.json` — token/cost/tool usage stats156- `tasks/{projectSlug}.json` — kanban board carry-over157- `decisions/{projectSlug}.json` — decision log158159## Sidekick CLI and Shared Library160161The CLI reads from `~/.config/sidekick/` (same data as the VS Code extension). Build everything with `bash scripts/build-all.sh`. Shared data access lives in `sidekick-shared/` (tsc-built TypeScript library); the terminal dashboard lives in `sidekick-cli/` (esbuild-bundled ESM binary).162163- **npm package**: `sidekick-agent-hub` — the **binary name** is `sidekick` (defined in `sidekick-cli/package.json` `bin` field), not `sidekick-agent-hub`164- **shared npm package**: `sidekick-shared` — published independently for consumers that need readers, providers, schemas, formatting, model info, and session asset extraction165- **CLI discovery**: `SidekickCliService.ts` searches configured path → common paths (including nvm) → `which sidekick`166- **VS Code terminal launch gotcha**: `vscode.window.createTerminal({ shellPath })` bypasses shell init (`.bashrc`/`.zshrc`), so nvm/volta `node` is not in PATH. The service injects the CLI's bin directory into the terminal `env.PATH` to fix this.167168## Testing169170Tests use **Vitest** with co-located files (`Foo.ts` / `Foo.test.ts`). The `vscode` module must be mocked in test files using `vi.mock("vscode", ...)` since VS Code is not available in the test runner.171172## Conventions173174- **TypeScript**: `strict: true`, target ES2022. The extension uses `noEmit: true` and builds with esbuild; `sidekick-shared` emits declarations and JavaScript via `tsc`.175- **Linting**: ESLint 9 + typescript-eslint; `@typescript-eslint/no-explicit-any` is `warn`; unused vars prefixed with `_` are allowed176- **Commits**: Conventional Commits (`feat(scope):`, `fix(scope):`, etc.)177- **Branches**: `feature/`, `fix/`, `docs/`, `refactor/` prefixes178- **File naming**: PascalCase for classes/services, camelCase for utilities179- **Settings prefix**: All VS Code settings use `sidekick.*`180181## Release Process182183Releases are triggered by pushing a `v*` tag to `main`. The CI workflow (`.github/workflows/release.yml`) runs five jobs:1841851. **Validate Version** — verifies tag is on `main` and all three `package.json` versions match the tag1862. **Publish VS Code Extension** — lint, test, package `.vsix`, upload as artifact, publish to Open VSX1873. **Publish Shared Library to npm** — lint, test, build, publish `sidekick-shared` (skips if version already published)1884. **Publish CLI to npm** — build shared lib, test CLI, build CLI, verify binary, publish `sidekick-agent-hub` (skips if version already published)1895. **Create GitHub Release** — downloads `.vsix` artifact, extracts changelog section, creates release with `.vsix` attached190191**Version bump checklist** (all must match the tag):192193- `bash scripts/bump-version.sh <version>` bumps the three `package.json` files at once. It does **not** touch lockfiles, so still:194 - `sidekick-vscode/package-lock.json`, `sidekick-cli/package-lock.json`, and `sidekick-shared/package-lock.json` (run `npm install --package-lock-only` in each workspace)195- If bumping by hand instead, the three `package.json` files are: `sidekick-vscode/`, `sidekick-cli/`, `sidekick-shared/`196197**Changelogs to update** (five total):198199- `CHANGELOG.md` (root — full project)200- `sidekick-vscode/CHANGELOG.md` (extension-specific)201- `sidekick-cli/CHANGELOG.md` (CLI-specific)202- `sidekick-shared/CHANGELOG.md` (shared-library-specific)203- `docs/changelog.md` (documentation site)204
Also in cesarandreslopez/sidekick-agent-hub
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| cesarandreslopez/sidekick-agent-hubCLAUDE.md · 76 | CLAUDE.md | setupbuildtestlint-format+7 | 89/100 | 3 days ago |
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| n8n-io/n8npackages/@n8n/agents/AGENTS.md · 199k | AGENTS.md | buildteststylearch+3 | 100/100 | 3 days ago | |
| TryGhost/Ghoste2e/AGENTS.md · 55k | AGENTS.md | setupteststylearch+2 | 100/100 | 3 days ago | |
| SkeneTechnologies/skene-cookbookAGENTS.md · 51 | AGENTS.md | setupbuildtestlint-format+7 | 100/100 | 2 days ago | |
| mui/material-uiAGENTS.md · 99k | AGENTS.md | setupbuildtestlint-format+9 | 100/100 | 3 days ago | |
| aaif-goose/gooseAGENTS.md · 52k | AGENTS.md | setupbuildtestlint-format+6 | 100/100 | 3 days ago | |
| duckduckgo/content-scope-scriptsspecial-pages/AGENTS.md · 70 | AGENTS.md | buildteststylearch+3 | 100/100 | 3 days ago | |
| trick77/agents-md-syncAGENTS.md · 2 | AGENTS.md | setupbuildteststyle+5 | 100/100 | 3 days ago | |
| code-yeongyu/oh-my-openagentpackages/web/AGENTS.md · 67k | AGENTS.md | setupbuildtestlint-format+6 | 100/100 | 2 days ago |
