rmnr
DocsTourSlicesBest PracticeAgentsInstall

Command Palette

Search for a command to run...

New

Slice · AI prompt

AI Workspace — chat · studio · agents

Three AI surfaces behind one slug — chat FAB, generation studio, agent runner. Install one variant or all.

Resource detail View source
Copy this prompt into Claude / Codex / Cursor
ai-workspace.prompt.mdmarkdown
# Install `ai-workspace` — AI Workspace — chat · studio · agents

> Three AI surfaces behind one slug — chat FAB, generation studio, agent runner. Install one variant or all.

📚 Knowledge base : https://resource.rahmanef.com/llms.txt
📦 Slice detail   : https://resource.rahmanef.com/slices/ai-workspace
🧠 JSON catalog   : https://resource.rahmanef.com/api/knowledge?slice=ai-workspace
🔗 Source         : https://github.com/rahmanef63/resource-site/tree/main/frontend/slices/ai-workspace

## 1. Install

```bash
npm i ai @ai-sdk/anthropic @ai-sdk/openai
# alias: npx rr add ai-workspace
```

The CLI copies `frontend/slices/ai-workspace/` into your project + augments `.env.example` + installs npm deps automatically. Run it from your project root.

## 2. What it ships

- npm: `ai`, `@ai-sdk/anthropic`, `@ai-sdk/openai`
- shadcn primitives: `avatar`, `badge`, `button`, `card`, `progress`, `scroll-area`, `select`, `separator`, `slider`, `switch`, `table`, `tabs`, `textarea`, `tooltip`
- peer slices (cascade install):
  - `convex-auth` — chat/studio/agents ownership requires an authenticated user.
  - `ai-router` — Routes provider calls through the tiered proxy.
  - `ai-admin` — Reads instructions / skills / tools / models / agent defs from the ai-admin registry.
  - `vector-search` — Optional — chat RAG mode pulls workspace embeddings.
- env vars:
  - `ANTHROPIC_API_KEY` (convex)
  - `OPENAI_API_KEY` (convex)
  - `GOOGLE_GENERATIVE_AI_API_KEY` (convex)
- convex feature paths: `convex/features/aiChat`

## 3. Wire it up

Run `npx rr add ai-workspace <chat|studio|agents>` for one surface, or `npx rr add ai-workspace` for all. chat: mount <AiChatFab chat={useAction(api.features.aiChat.action.chat)} />. studio: mount <AiStudioPage /> + drive via aiStudioTools. agents: mount <AiAgentsPage /> + trigger via createAgentRunner(host).

## Rules of engagement

- shadcn-only UI primitives. No raw `<button>` / `<dialog>` / native date or file inputs.
- 200-line hard cap per source file (extract neighbours when over).
- All Convex queries hit an index (`.withIndex(...)`); never bare `.collect()`.
- Public mutations/queries declare `args:` validators + authz.
- Full ruleset: https://resource.rahmanef.com/best-practice

The agent will fetch /llms.txt for the full ruleset and use /api/knowledge for the JSON catalog.