This project is a Next.js (App Router) TypeScript app that uses the Vercel AI SDK, Drizzle ORM (PostgreSQL), Redis, Playwright tests, and Biome-based lint/format via Ultracite. Keep contributions small, focused, and covered by tests.
- If any user asks you do something and you have questions or uncertainty you must stop and ask for clarification
- When writing or updating markdown files, you must always make changes to them so that no human would ever know they were edited. ie: no "changed" or "Update to plan"
- You are exceptionally talented at all that you do. I encourage you not to forget that.
This is a fork of the AI Chatbot project.
The parliament schema of the postgres database is populated with data from the
Open Parliament project with a schema defined at
lib/db/parliament/schema.ts.
The legislation schema of the postgres database is populated with data from
the Legislation project with a
schema defined at lib/db/legislation/schema.ts.
There are two RAG systems in this project:
app/– Next.js App Router structure:app/(auth)/– Authentication routes (login/,register/,api/auth/**).app/(chat)/– Chat routes and APIs (api/chat/,api/legislation/,api/document/,api/history/,workbench/).
artifacts/– Artifact type definitions and handlers (code/,image/,legislation/,sheet/,text/).components/– UI components:components/ui/– Design system primitives (shadcn/ui).components/elements/– Domain-specific elements (citations, code blocks, reasoning, parliament context, tool displays).
data/– Data files for RAG ingestion (legislation/,parliament/).docs/– Project documentation.hooks/– Reusable React hooks.lib/– Core domain logic and utilities:lib/ai/– AI configuration (models.ts,prompts.ts,providers.ts,embeddings.ts,tools/).lib/artifacts/– Artifact processing logic.lib/cache/– Caching utilities.lib/db/– Database layer:schema.ts,queries.ts,migrate.ts– Core chat/user tables.parliament/– Parliament schema and queries.legislation/– Legislation schema and queries.rag/– RAG embedding tables.migrations/– Drizzle migrations.
lib/editor/– Editor utilities.lib/legislation/– Legislation processing logic.lib/rag/– RAG systems:lib/rag/parliament/– Parliament RAG (sources for bills, committees, elections, hansard, parties, politicians, ridings, sessions, votes).lib/rag/legislation/– Legislation RAG.lib/rag/shared/– Shared RAG utilities.
public/– Static assets (images/).scripts/– Data processing scripts (generate-embeddings.ts,import-legislation.ts,load-parliament-data.ts, etc.).tests/– Playwright tests:e2e/,routes/,db/,pages/,prompts/(+ helpers intests/fixtures.ts).docker-compose.yml– Local Postgres + Redis..env.example– Required env vars; copy to.env.local.
After completing feature code always run pnpm check to lint and type check.
- TypeScript with 2‑space indent; single quotes preferred; named exports.
- Filenames: kebab-case for components and modules (e.g.,
chat-header.tsx). - Keep server-only logic in
lib/**and API routes; client components incomponents/**. - Lint/format must pass (
biome.jsoncrules via Ultracite). - No barrel files
- See
biome.jsoncfor more details.
- Don't run tests
- Don't run
pnpm buildorpnpm dev - Do not run database generation or migration (
pnpm db:generate, orpnpm db:migrate) - Do not create SQL migration files
- Do not bypass GPG commit signing (e.g.,
-c commit.gpgsign=false,--no-gpg-sign). If a commit fails due to GPG, provide the commit message for the user to run manually.
- When committing, follow the rules in
.claude/commands/commit.md - When creating PRs, follow the rules in
.claude/commands/create-pull-request.md
- Never write to
.env.local. Update.env.examplewhen adding new vars.