Implement `.ai-rules`, formalize `MEMORY.md` as the source of truth, and initialize `docs/` structure to ensure consistent architectural context across development environments.
18 lines
2.0 KiB
Plaintext
18 lines
2.0 KiB
Plaintext
# Universal Cross-IDE AI Rules (`.ai-rules`)
|
|
|
|
CRITICAL RULE: This is a multi-IDE project. Whenever any modification, update, or bug fix is completed in our session, you must automatically update the `MEMORY.md` file or provide the exact markdown blocks so the project context remains perfectly synchronized across all IDEs.
|
|
|
|
## Session Startup Protocol
|
|
1. Read `MEMORY.md` and `AGENTS.md` before planning or editing code to restore accurate multi-IDE project context, runtime boundaries, and architecture constraints.
|
|
2. Treat `MEMORY.md` as the single cross-IDE source of truth for current tech stack, directory structure, active features, and recent fixes.
|
|
|
|
## Architectural & Engineering Guardrails
|
|
- **Dual-Runtime Boundary**: Keep Next.js 15 web/API routes (`app/`, Port `3000`) and Express 5 + Socket.IO ingestion (`server/index.js`, Port `4000`) cleanly decoupled. Never initialize Socket.IO servers inside Next.js API routes.
|
|
- **Storage Boundary**: Persist telemetry events exclusively to partitioned CSVs (`/storage/data/{clientId}/{YYYY-MM-DD}.csv`) via `DataBufferEngine` / `CSVStorageManager` / Redis queue. Use PostgreSQL (`pg` + `prisma/schema.prisma`) strictly for metadata (`admin_users`, `admin_login_attempts`, `client_sdks`, `deleted_clients`, `admin_settings`).
|
|
- **UI Consistency**: Assemble pages from existing primitives in `components/ui/` and `components/layout/` adhering to design tokens in `app/globals.css` (`--radius: 0rem`, `--shadow: none`).
|
|
- **Non-Destructive Persistence**: Never add destructive SQL (`DROP`, `TRUNCATE`) or automatic startup scripts that purge production CSV partitions without hydrated DB settings confirmation.
|
|
|
|
## Verification & Sync Before Finishing Any Change
|
|
1. Run `npm run lint` and `npm run build` plus relevant test suites (`npx --yes tsx --test tests/phase*.test.ts` and `python3 -m unittest tests/phase05_sdk_test.py` when applicable).
|
|
2. Update `MEMORY.md` with any structural, dependency, endpoint, environment variable, or status changes made during the session before finishing.
|