-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.cursorrules
184 lines (164 loc) · 8.12 KB
/
.cursorrules
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
You are not to make sql migration files directly. Simply update the schema file and I can run the migration.
we use drizzle-kit, so pnpm drizzle-kit generate will generate the migration file, and pnpm drizzle-kit migrate will push the migration to the database.
So do not write any sql migration files.
If I tell you to do something, do it. Do not ask for confirmation.
Make sure to avoid ambiguous sql statements. It happens a lot so be as specific as possible. Never be implicit, this is a database. Come on now.
Follow existing code style for the schema, views, and tables.
When you write raw sql to be inserted into the database to see what it's in it, make sure you return all in one row.
Additionally, use drizzle syntax for sql statements.
Do not use the active column in the effectiveRestakesView view for anything ever. It is soon to be removed.
// Restake System Rules:
// 1. Restakes are commitments to change one's mind about a parent point IF a negation is true
// 2. Slashes are fulfillments of that commitment - admitting the negation changed your mind
// 3. Doubts bet on restakers following through on their commitments
// Implementation Rules:
// 1. For UI visibility, check slashedAmount < originalAmount
// 2. totalRestakeAmount Rules:
// - Sum of all effectiveAmounts from non-fully-slashed restakes for a point-negation pair
// - Used as the maximum amount that can be doubted
// - Excludes restakes where slashedAmount >= originalAmount
// - Includes both the user's own restakes and others' restakes
// - Reduced by slashes but not by existing doubts
// 3. For restake visibility, check amount > 0 && slashedAmount < originalAmount
// 4. Doubts are immutable once placed, can only be reduced by slashes
// 5. When calculating effectiveAmount, account for both slashes and doubts
// 6. Hide fully slashed restakes (slashedAmount >= originalAmount) from UI entirely
// Query Rules:
// 1. When calculating totalRestakeAmount:
// SELECT SUM(effectiveAmount)
// WHERE slashedAmount < originalAmount
// AND pointId/negationId match the point-negation pair
// 2. Viewer-specific data must be clearly separated in query structure
// 3. Global totals must be calculated independently of viewer context
// 4. Ownership flags must be explicitly calculated using userId equality
// 5. All amounts must use COALESCE to handle NULL values consistently
// Core System Rules:
// 1. Points are arguments, negations are counterarguments
// 2. Negations alone don't change minds - restakes make that commitment
// 3. Restaking costs cred immediately but grants favor bonus to parent point
// 4. Slashing removes favor bonus and punishes doubters but costs no additional cred
// 5. Doubters bet against restakers admitting they're wrong
// 6. Multiple doubts don't stack in reducing favor (uses max(slashed, doubted))
// 7. Restakes specifically commit to changing mind about parent point endorsement
// 8. Favor bonus shows extra conviction by stating change conditions
// 9. Endorsement amount limits restake amount on parent point
// 10. Endorsement reductions can affect existing restakes
// Component Detection Rules:
// 1. PointCard:
// - Shows current states only
// - Displays restake/doubt icons based on amount > 0 && slashedAmount < originalAmount
// - Uses totalRestakeAmount for doubt possibility
// - Delegates state changes to RestakeDialog
// - Never handles transitions directly
// - Shows restake icon when restake exists and isn't fully slashed
// - Shows doubt icon when doubt amount exists
// - Enables doubt interaction if totalRestakeAmount > 0
// - Checks endorsement amount for restake possibility
// - Hides restake option if no parent point endorsement
// 2. RestakeDialog:
// - Handles full state lifecycle
// - Manages three modes: restaking, slashing, doubting
// - Enforces system rules and limits
// - Calculates state transitions and their impacts
// - Validates all state changes
// - Handles proportional doubt reductions on slash
// - Enforces doubt immutability
// - Manages favor impact calculations
// - Shows warnings for state-specific conditions
// - Tracks endorsement reductions
// - Handles partial slash calculations
// - Enforces endorsement-based restake limits
// - Shows endorsement reduction warnings
// - Explains favor bonus mechanics
// - Clarifies slash vs doubt implications
// Economic Rules:
// 1. Restaking:
// - Costs cred immediately on placement
// - Grants favor bonus to parent point
// - Bonus reduced by max(slashed, doubted)
// - Represents commitment to change mind
// - Shows intellectual honesty by stating change conditions
// - Cannot be increased after placement
// - Can be slashed partially or fully
// - Limited by parent point endorsement
// - Demonstrates extra conviction in parent point
// 2. Doubting:
// - Bets against restaker integrity
// - Wins if restaker doesn't slash
// - Loses proportionally if restaker slashes
// - Immutable after placement
// - Limited by totalRestakeAmount
// - Multiple doubts share proportional losses
// - Cannot be modified even by owner
// - Forces choice between ego and integrity
// 3. Slashing:
// - Costs no additional cred
// - Removes favor bonus
// - Punishes doubters proportionally
// - Can be partial or complete
// - Represents admission of changed mind
// - Reduces all doubts proportionally
// - Shows intellectual integrity
// - Often motivated by already-lost favor from doubts
// Favor Calculation Rules:
// 1. Base favor from point/negation cred ratio
// 2. Restake bonus added to parent point
// 3. Bonus reduced by max(slashed, doubted)
// 4. Multiple doubts don't stack
// 5. Slashes permanently reduce favor
// 6. Favor impact immediate on restake
// 7. Favor reduced before slash if doubted
// 8. Endorsement changes can affect favor calculation
// 9. Parent point gets favor bonus from restake commitment
// State Transition Rules:
// 1. Restakes:
// - Start with full amount and favor
// - Can only decrease through slashing
// - Cannot be undone or increased
// - Must respect endorsement limits
// 2. Doubts:
// - Immutable after placement
// - Only reduced by slashes
// - Cannot be voluntarily removed
// - Force restaker choice between ego/integrity
// 3. Slashes:
// - Can be partial or complete
// - Trigger doubt reductions
// - Remove favor proportionally
// - Cannot be undone
// - Often motivated by doubt-reduced favor
// Incentive Structure Rules:
// 1. Intellectual Honesty:
// - Restaking shows willingness to change mind
// - Slashing demonstrates follow-through
// - Doubting keeps restakers accountable
// - Extra conviction shown through restake commitment
// 2. Economic Balance:
// - Immediate cred cost for restaking
// - Favor bonus as reward for honesty
// - Doubt potential as risk factor
// - Endorsement limits as natural constraint
// 3. Game Theory:
// - Slashing decision balances ego vs integrity
// - Doubt placement considers restaker history
// - Multiple doubters share risk/reward
// - Doubts force meaningful integrity choices
// UI Representation Rules:
// 1. Icons always present in outline form as base state
// 2. Fill state and percentages only shown for owned positions
// 3. Ownership checks must gate all personal metrics
// 4. Base styling preserved when adding state-based styles
// 5. Related UI elements (restake/doubt) share consistent styling and alignment
// 6. Base icon styling (size, stroke) must be consistent across all states
// 7. Interactive states (hover, fill) build on top of base styles
// 8. Percentages and icons must maintain vertical alignment
// Data Structure Rules:
// 1. Queries must explicitly separate:
// - Viewer specific data (restakes, doubts owned by viewer)
// - Global data (total amounts for favor calculation)
// 2. Ownership must be explicitly marked in database queries
// 3. Ownership flags must propagate through all transformations
// 4. Transformations must preserve ownership context through the entire stack
// 5. Data structures must include explicit ownership flags for UI consumption
Current tasks:
N/A