Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
531 changes: 531 additions & 0 deletions docs/.cursor/rules/spacetimedb-csharp.mdc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These files have been moved here (they are used by spacetime init so that we can initialize a project with rules):

https://github.com/clockworklabs/SpacetimeDB/tree/master/docs/static/ai-rules

Could you please move them to here and merge them with the pre-existing ones?

Large diffs are not rendered by default.

463 changes: 463 additions & 0 deletions docs/.cursor/rules/spacetimedb-rust.mdc

Large diffs are not rendered by default.

488 changes: 488 additions & 0 deletions docs/.cursor/rules/spacetimedb-typescript.mdc

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions docs/.cursor/rules/spacetimedb.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
description: "⛔ MANDATORY: Core SpacetimeDB concepts (all languages)."
globs: **/*.ts,**/*.tsx,**/*.js,**/*.jsx,**/*.rs,**/*.cs
alwaysApply: true
---
# SpacetimeDB Rules (All Languages)

## Core Concepts

1. **Reducers are transactional** — they do not return data to callers
2. **Reducers must be deterministic** — no filesystem, network, timers, or random
3. **Read data via tables/subscriptions** — not reducer return values
4. **Auto-increment IDs are not sequential** — gaps are normal, don't use for ordering
5. **`ctx.sender` is the authenticated principal** — never trust identity args

---

## Index System

SpacetimeDB automatically creates indexes for:
- Primary key columns
- Columns marked as unique

You can add explicit indexes on non-unique columns for query performance.

**Index names must be unique across your entire module (all tables).** If two tables have indexes with the same declared name → conflict error.

**Schema ↔ Code coupling:**
- Your query code references indexes by name
- If you add/remove/rename an index in the schema, update all code that uses it
- Removing an index without updating queries causes runtime errors

---

## Editing Behavior

- Make the smallest change necessary
- Do NOT touch unrelated files, configs, or dependencies
- Do NOT invent new SpacetimeDB APIs — use only what exists in docs or this repo
- Do NOT add restrictions the prompt didn't ask for — if "users can do X", implement X for all users
46 changes: 46 additions & 0 deletions docs/llms/oneshots/GRADE_SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# LLM One-Shot Benchmark Summary

**Generated:** 2026-01-28
**Total Runs:** 13

## Overall Results by Backend

| Backend | Runs | Avg Score | Best | Worst |
|---------|------|-----------|------|-------|
| SpacetimeDB | 7 | 91.7% | 100.0% | 76.0% |
| PostgreSQL | 6 | 62.7% | 76.4% | 41.7% |

**SpacetimeDB advantage:** +29.0 percentage points

## Results by LLM

| LLM | STDB Runs | STDB Avg | PG Runs | PG Avg | Delta |
|-----|-----------|----------|---------|--------|-------|
| gemini-3-pro | 1 | 85.4% | 1 | 71.9% | +13.5% |
| gpt-5-2 | 1 | 100.0% | 1 | 41.7% | +58.3% |
| grok-code | 1 | 76.0% | 1 | 46.9% | +29.1% |
| opus-4-5 | 4 | 95.1% | 3 | 72.0% | +23.1% |

## Results by App

| App | STDB Runs | STDB Avg | PG Runs | PG Avg | Delta |
|-----|-----------|----------|---------|--------|-------|
| chat-app | 7 | 91.7% | 6 | 62.7% | +29.0% |

## All Runs

| App | LLM | Backend | Date | Score | % |
|-----|-----|---------|------|-------|---|
| chat-app | gemini-3-pro | PG | 2026-01-08 | 17.25/24 | 71.9% |
| chat-app | gemini-3-pro | STDB | 2026-01-07 | 20.5/24 | 85.4% |
| chat-app | gpt-5-2 | PG | 2026-01-08 | 10/24 | 41.7% |
| chat-app | gpt-5-2 | STDB | 2026-01-07 | 24/24 | 100.0% |
| chat-app | grok-code | PG | 2026-01-28 | 11.25/24 | 46.9% |
| chat-app | grok-code | STDB | 2026-01-07 | 18.25/24 | 76.0% |
| chat-app | opus-4-5 | PG | 2026-01-04 | 27.5/36 | 76.4% |
| chat-app | opus-4-5 | PG | 2026-01-04 | 27.25/36 | 75.7% |
| chat-app | opus-4-5 | PG | 2026-01-04 | 23/36 | 63.9% |
| chat-app | opus-4-5 | STDB | 2026-01-05 | 36/36 | 100.0% |
| chat-app | opus-4-5 | STDB | 2026-01-02 | 32.5/36 | 90.3% |
| chat-app | opus-4-5 | STDB | 2026-01-02 | 34.5/36 | 95.8% |
| chat-app | opus-4-5 | STDB | | 34/36 | 94.4% |
58 changes: 58 additions & 0 deletions docs/llms/oneshots/chat-app/GRADE_SUMMARY.md
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the difference between this GRADE_SUMMARY.md and the one in the directory above?

Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# chat-app Benchmark Summary

**Generated:** 2026-01-28
**Total Runs:** 13

## Results by Backend

| Backend | Runs | Avg Score | Best | Worst |
|---------|------|-----------|------|-------|
| SpacetimeDB | 7 | 91.7% | 100.0% | 76.0% |
| PostgreSQL | 6 | 62.7% | 76.4% | 41.7% |

## Results by LLM

| LLM | STDB Runs | STDB Avg | PG Runs | PG Avg | Delta |
|-----|-----------|----------|---------|--------|-------|
| gemini-3-pro | 1 | 85.4% | 1 | 71.9% | +13.5% |
| gpt-5-2 | 1 | 100.0% | 1 | 41.7% | +58.3% |
| grok-code | 1 | 76.0% | 1 | 46.9% | +29.1% |
| opus-4-5 | 4 | 95.1% | 3 | 72.0% | +23.1% |

## Feature Scores (Average)

| Feature | Max | STDB Avg | PG Avg | Winner |
|---------|-----|----------|--------|--------|
| 1. Basic Chat Features | 3 | 2.79 | 1.71 | STDB |
| 2. Typing Indicators | 3 | 2.93 | 2.50 | STDB |
| 3. Read Receipts | 3 | 3.00 | 1.58 | STDB |
| 4. Unread Message Counts | 3 | 2.86 | 1.33 | STDB |
| 5. Scheduled Messages | 3 | 2.36 | 1.75 | STDB |
| 6. Ephemeral/Disappearing Messages | 3 | 2.64 | 2.67 | PG |
| 7. Message Reactions | 3 | 2.89 | 1.79 | STDB |
| 8. Message Editing with History | 3 | 2.93 | 1.83 | STDB |
| 9. Real-Time Permissions | 3 | 2.25 | 1.58 | STDB |
| 10. Rich User Presence | 3 | 2.88 | 2.67 | STDB |
| 11. Message Threading | 3 | 3.00 | 2.00 | STDB |
| 12. Private Rooms & Direct Messages | 3 | 3.00 | 2.17 | STDB |
| 13. Room Activity Indicators | 3 | 0.00 | - | - |
| 14. Draft Sync | 3 | 0.00 | - | - |
| 15. Anonymous to Registered Migration | 3 | 0.00 | - | - |

## All Runs

| LLM | Backend | Date | Score | % | Level |
|-----|---------|------|-------|---|-------|
| gemini-3-pro | PG | 2026-01-08 | 17.25/24 | 71.9% | 5 |
| gemini-3-pro | STDB | 2026-01-07 | 20.5/24 | 85.4% | 5 |
| gpt-5-2 | PG | 2026-01-08 | 10/24 | 41.7% | 5 |
| gpt-5-2 | STDB | 2026-01-07 | 24/24 | 100.0% | 5 |
| grok-code | PG | 2026-01-28 | 11.25/24 | 46.9% | 5 |
| grok-code | STDB | 2026-01-07 | 18.25/24 | 76.0% | 5 |
| opus-4-5 | PG | 2026-01-04 | 27.5/36 | 76.4% | 9 |
| opus-4-5 | PG | 2026-01-04 | 27.25/36 | 75.7% | 9 |
| opus-4-5 | PG | 2026-01-04 | 23/36 | 63.9% | 9 |
| opus-4-5 | STDB | 2026-01-05 | 36/36 | 100.0% | 9 |
| opus-4-5 | STDB | 2026-01-02 | 32.5/36 | 90.3% | 9 |
| opus-4-5 | STDB | 2026-01-02 | 34.5/36 | 95.8% | 9 |
| opus-4-5 | STDB | | 34/36 | 94.4% | 9 |
Loading
Loading