From 27381fefcfa2415f055ca68dee16125005d35369 Mon Sep 17 00:00:00 2001 From: Ben Weeks Date: Thu, 16 Apr 2026 11:48:36 +0100 Subject: [PATCH 1/4] docs: add progressive disclosure documentation add L0 repo card, 8 L1 structured summaries, 3 L2 deep dives, and AGENTS.md entry point following the progressive disclosure standard --- AGENTS.md | 41 ++++++ CLAUDE.md | 2 + docs/ai/L0_repo_card.md | 27 ++++ docs/ai/L1/01_setup.md | 91 ++++++++++++ docs/ai/L1/02_architecture.md | 106 ++++++++++++++ docs/ai/L1/03_code_map.md | 83 +++++++++++ docs/ai/L1/04_conventions.md | 93 +++++++++++++ docs/ai/L1/05_workflows.md | 92 +++++++++++++ docs/ai/L1/06_interfaces.md | 130 ++++++++++++++++++ docs/ai/L1/07_gotchas.md | 84 +++++++++++ docs/ai/L1/08_security.md | 81 +++++++++++ docs/ai/L1/deep_dives/_index.md | 7 + docs/ai/L1/deep_dives/build_pipeline.md | 64 +++++++++ docs/ai/L1/deep_dives/event_system.md | 78 +++++++++++ docs/ai/L1/deep_dives/rendering_controller.md | 72 ++++++++++ 15 files changed, 1051 insertions(+) create mode 100644 AGENTS.md create mode 100644 docs/ai/L0_repo_card.md create mode 100644 docs/ai/L1/01_setup.md create mode 100644 docs/ai/L1/02_architecture.md create mode 100644 docs/ai/L1/03_code_map.md create mode 100644 docs/ai/L1/04_conventions.md create mode 100644 docs/ai/L1/05_workflows.md create mode 100644 docs/ai/L1/06_interfaces.md create mode 100644 docs/ai/L1/07_gotchas.md create mode 100644 docs/ai/L1/08_security.md create mode 100644 docs/ai/L1/deep_dives/_index.md create mode 100644 docs/ai/L1/deep_dives/build_pipeline.md create mode 100644 docs/ai/L1/deep_dives/event_system.md create mode 100644 docs/ai/L1/deep_dives/rendering_controller.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..69f76a8 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,41 @@ +# AI Agent Instructions + +This repository uses progressive disclosure documentation. Docs live under +`docs/ai/` in three levels. + +## How to Load + +1. Read [docs/ai/L0_repo_card.md](docs/ai/L0_repo_card.md) to identify the repo. +2. Load ALL 8 files in `docs/ai/L1/`. They are small — load all upfront. +3. Follow L2 deep-dive links only when L1 isn't detailed enough. + +## Git Conventions + +### Commit messages — conventional commits + +- **Format:** `type: description` or `type(scope): description` +- **Types:** `feat:` (new feature), `fix:` (bug fix), `chore:` (maintenance, version bumps), `test:` (test additions/changes), `docs:` (documentation) +- **Scoped variant:** `feat(scope):`, `fix(scope):` — e.g. `feat(auth): add token refresh` +- **Lowercase after prefix** — `feat: add feature`, not `feat: Add feature` +- **Present tense** — "add feature", not "added feature" + +### Branch names + +- **Format:** `type/short-description` — lowercase, hyphen-separated +- **Types match commit types:** `feat/`, `fix/`, `chore/`, `test/`, `docs/` +- **Examples:** `feat/token-refresh`, `fix/null-pointer`, `docs/progressive-disclosure` + +### General rules + +- **No AI tool names** — never mention claude, cursor, copilot, cody, aider, gemini, codex, chatgpt, or gpt-3/4 +- **No Co-Authored-By trailers** — omit AI attribution lines +- **No --no-verify** — let git hooks run normally +- **No git config changes** — do not modify user.name or user.email + +## Doc Commands + +| Command | When to use | +| ------------- | --------------------------------------------- | +| generate docs | no `docs/ai/` directory exists yet | +| update docs | code changed since last `last_reviewed` date | +| test docs | verify docs give agents the right context | diff --git a/CLAUDE.md b/CLAUDE.md index b596914..9f09612 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,5 +1,7 @@ # CLAUDE.md +Read @AGENTS.md for AI agent instructions, git conventions, and progressive disclosure docs. + Guidelines for AI-assisted development in this repository. ## Package manager diff --git a/docs/ai/L0_repo_card.md b/docs/ai/L0_repo_card.md new file mode 100644 index 0000000..7aab8fe --- /dev/null +++ b/docs/ai/L0_repo_card.md @@ -0,0 +1,27 @@ +# agora-agent-client-toolkit — Repo Card + +> Framework-agnostic TypeScript SDK for integrating Agora Conversational AI into web applications, with optional React hooks. + +## Identity + +| Field | Value | +| ------------- | -------------------------------------------------- | +| Repo | `AgoraIO-Conversational-AI/agent-client-toolkit-ts` | +| Type | `sdk-library` | +| Language | TypeScript | +| Deploy Target | npm registry (CJS + ESM) | +| Owner | Agora Conversational AI | +| Last Reviewed | 2026-04-16 | + +## L1 — Summaries + +| File | Purpose | Audience | +| ---------------------------------------- | ---------------------------------------------------- | -------------- | +| [01_setup](L1/01_setup.md) | Environment setup, quick commands, env vars | Use & Maintain | +| [02_architecture](L1/02_architecture.md) | System design, component diagram, data flow | Maintain | +| [03_code_map](L1/03_code_map.md) | Directory tree, module map, "where does X live?" | Maintain | +| [04_conventions](L1/04_conventions.md) | Naming, patterns, error handling, testing | Maintain | +| [05_workflows](L1/05_workflows.md) | Step-by-step: add feature, release, test | Use | +| [06_interfaces](L1/06_interfaces.md) | API contracts, event schemas, message formats | Use & Maintain | +| [07_gotchas](L1/07_gotchas.md) | Critical gotchas, tribal knowledge, incident lessons | Maintain | +| [08_security](L1/08_security.md) | Security model, trust boundaries, auth, secrets | Maintain | diff --git a/docs/ai/L1/01_setup.md b/docs/ai/L1/01_setup.md new file mode 100644 index 0000000..b9eb8a2 --- /dev/null +++ b/docs/ai/L1/01_setup.md @@ -0,0 +1,91 @@ +# 01 Setup + +> Environment setup, dependencies, build commands, and local development for the toolkit monorepo. + +## Prerequisites + +| Requirement | Version | Notes | +| ----------- | --------- | -------------------------------- | +| Node.js | ≥20 | CI tests on 20, 22, 24 | +| pnpm | ≥9 | Only supported package manager | + +- npm and yarn lockfiles are rejected; pnpm only +- No `.env` files required — this is a library, not a service + +## Install and Build + +```bash +pnpm install +pnpm build # builds both core and react packages +``` + +## Quick Commands + +| Command | What It Does | +| -------------------- | ----------------------------------------------- | +| `pnpm install` | Install all workspace dependencies | +| `pnpm build` | Build core + react packages (tsup) | +| `pnpm test` | Run all tests (vitest) | +| `pnpm lint` | Run ESLint across all packages | +| `pnpm format` | Run Prettier across all packages | +| `pnpm format:check` | Check Prettier formatting without writing | +| `pnpm typecheck` | Type-check all packages | + +## Package Manager + +- **pnpm only** — workspace uses `pnpm-workspace.yaml` +- Workspaces: `packages/*` and `apps/*` +- The `packages/conversational-ai` package references source in root `src/` (no source duplication) + +## Build System + +- **tsup** — bundles both packages to CJS + ESM + type declarations +- Output: `dist/index.js`, `dist/index.mjs`, `dist/index.d.ts`, `dist/index.d.mts` +- Tree-shakeable (`sideEffects: false`) + +## Running Demo Apps + +```bash +cd apps/demo && pnpm dev # Vanilla TS demo (Vite) +cd apps/playground && pnpm dev # React playground +``` + +Both apps require valid Agora App ID and token — see their respective README files. + +## CI Pipeline + +- GitHub Actions: `.github/workflows/ci.yml` +- Matrix: Node 20, 22, 24 on Ubuntu +- Steps: lint → format check → build → typecheck → test → coverage (Node 20 only) +- Publish: triggered by tag push; publishes both packages to npm with provenance + +## Package Filter Names + +| Filter Name | Resolves To | +| ------------------------------------ | ------------------------ | +| `agora-agent-client-toolkit` | Core SDK package | +| `agora-agent-client-toolkit-react` | React hooks package | +| `agora-conversational-ai-demo` | Vanilla TS demo app | + +Use with `pnpm --filter