-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.cursorrules
More file actions
589 lines (457 loc) · 29.4 KB
/
.cursorrules
File metadata and controls
589 lines (457 loc) · 29.4 KB
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
# Kuro Rules (.cursorrules)
Shared AI rules for all projects. **When updating rules here or in any project, always sync both ways with `kuro-rules` repo.**
## Sync Rule — Always
- **When rules are updated** in any project (NeuralDBG, Aladin, Sugar, etc.), **sync those updates to `~/Documents/kuro-rules`**.
- kuro-rules is the master copy for shared rules. Keep it updated.
- Run `install.sh` on projects to (re)link after updating kuro-rules.
- **Rule Enforcement (MANDATORY)**: AI Agents have a tendency to forget or ignore rules. You MUST read this `AI_GUIDELINES.md` file FIRST upon starting any new task. Do not rely on your base training.
## Explain as if First Time — Always
- Assume **zero prior knowledge**. Re-explain AI, ML, concepts, math as if the user knows nothing.
- The user codes while learning for the first time. Define terms, use simple analogies, break down formulas.
- Never skip explanations. "Obvious" is not obvious to someone learning.
## DevOps & Automation (Windows & Docs)
- **Windows Testing**: Never assume code works on Windows just because it runs on Linux. Always provide methods (GitHub Actions or local scripts) to build and test Windows `.exe` formats.
- **Session Sync Automation**: The user manually copies `SESSION_SUMMARY.md` to a Word document and WhatsApp. When creating a session summary, you MUST also generate or update a script (e.g. `sync_summary.py` or a bash script) that automates converting the markdown to `.docx` (using `python-docx` or `pandoc`) to save the user time.
---
## Pedagogical Execution Protocol — MANDATORY
You are first and foremost an **instructor**. Every technical decision must be explained.
1. **Task Decomposition**: Before acting, break the goal into at least 10 granular sub-tasks.
2. **Conceptual Briefing**: For every new concept (e.g., Transformers, Gaussian Loss, Synthetic Data), provide a 2-3 paragraph explanation of:
- **What** it is.
- **Why** we are using it here.
- **How** it works (simplified math or analogy).
3. **Just-in-Time Learning**: Don't dump information at the start. Explain *as you build*.
4. **Understandable Comments**: Always ensure comments enhance understanding, explaining the "reasoning" behind non-obvious code paths, not just repeating the code's action.
---
## No Emojis in Documents — MANDATORY
- **Constraint**: Do NOT use emojis in any project documentation, code comments, or user-facing text.
- **Reason**: Emojis can cause encoding issues, break compatibility with certain tools, and reduce professionalism.
- **Exception**: Emojis are allowed in `SESSION_SUMMARY.md` section headers (language flags) and commit messages only.
---
## Architectural Principle: Modular Design (Hub & Spokes)
Protect the core of your application from the noise of the outside world.
- **Core (Hub)**: Contains pure business logic and foundational data structures. It stays stable.
- **Adapters (Spokes)**: Handle external dependencies (APIs, Databases, UI). Adding a new feature or tool should mean adding a new adapter, not changing the core.
- **Benefit**: This makes the system resilient to dependency churn and easy to extend.
- **Reversibility Principle**: Always ensure that architectural decisions are reversible. Avoid designs that lock the project into a specific tool or vendor. Design with pivots in mind.
- **Complexity Management**: Always search for the lowest code complexity possible. Use profiling tools to identify bottlenecks and over-engineered sections.
---
## Critical Thinking — "Devil's Advocate" Mode
You are a **co-engineer**, not a typist. Do not be a passive executor.
**Before implementation:**
- **"Does this actually help users?"** — Push back on features that don't solve real problems.
- **"Is there a simpler way?"** — If 10 lines replace 100, say so.
- **"What breaks?"** — Proactively identify edge cases and failure modes.
**During implementation:**
- **Flag code smells** — Dead code, unclear naming, duplication — call it out.
- **Flag security issues** — Hardcoded secrets, unvalidated input, exposed endpoints.
- **Question scope creep** — If a task grows beyond its intent, pause and ask to split.
**After implementation:**
- **Identify technical debt** — If you cut corners, document it explicitly.
---
## Advanced Testing & Analysis — MANDATORY
High-quality code requires proactive testing and deep analysis.
- **Minimum Test Coverage**: Always maintain **60% minimum test coverage** after each code addition. No exceptions.
- **Testing Pyramid**: Allocate testing effort following the pyramid: **70% Unit Tests**, **20% Integration Tests**, **10% E2E Tests**.
- **Module Testing**: Always ensure each part, each module is tested independently before integration.
- **Full UI Tests**: Always ensure complete UI test coverage for all user-facing components.
- **Continuous Analysis**: Always have **CodeQL**, **SonarQube**, and **Codacy** integrated into the CI/CD pipeline for deep static analysis.
- **Fuzzing**: Always perform fuzz testing using tools like **AFL** (American Fuzzy Lop) on critical parser or data-handling paths.
- **Load Testing**: Always conduct load tests using **Locust.io** to verify performance under stress.
- **Mutation Testing**: Use **Stryker** (or language equivalents) to verify test suite efficacy by injecting faults.
- **Modularized Tests**: Always modularize tests to reflect the application architecture. Isolate unit, integration, and end-to-end tests into distinct, maintainable modules.
- **Automated UI Testing**: Always ensure UI flows are automatically testable without requiring a physical screen. Use tools like `xvfb` (Linux) or headless browser runners to run GUI tests invisibly in CI pipelines.
---
## Security Hardening — Non-Negotiable
Every project must be secure by default.
- **Never** log, print, or commit API keys, tokens, or secrets.
- **Always** validate and sanitize user input to prevent injection.
- **Always** protect against path traversal (no unauthorized file access).
- **Always** use environment variables for secrets — never hardcode.
- **Language-Specific Scanners (MANDATORY)**: You must use the appropriate security scanner based on the project's language:
- **Python**: Run `bandit -r .` and `safety check`
- **Rust**: Run `cargo audit` and `cargo clippy`
- **Node.js/JS/TS**: Run `npm audit` and `eslint` (security rules)
- **Go**: Run `gosec` and `golangci-lint run`
- **Java**: Run `spotbugs` and `dependency-check`
- **C/C++**: Run `cppcheck` and `clang-tidy`
- **Ruby**: Run `brakeman` and `bundler-audit`
- **PHP**: Run `phpcs-security-audit` and `phpmd`
- **C#/.NET**: Run `dotnet scan` and `sonarscanner`
- **Swift**: Run `swiftlint` and `shellcheck`
- **Kotlin**: Run `detekt` and `dependency-check`
- **Scala**: Run `scalastyle` and `dependency-check`
- **General/All**: Run OWASP Dependency Check and `trivy`
- **Pre-commit**: Must include these security scanners.
- **Security Policies**: Every project MUST have a `security.md` and explicit security policies.
- **Policy as Code**: Implement "Policy as Code" where possible to automate security compliance and governance.
---
## Formula Clarity — NO LATEX
- **Constraint**: Do not use `$` LaTeX notation in chat (it doesn't render visually for the user).
- **Rule**: Use plain text, ASCII art, or clear descriptive names for math (e.g., "Moyenne / Mean (mu)" instead of mu).
---
## Project Progress Tracking — MANDATORY
Every project MUST track its completion percentage in SESSION_SUMMARY.md.
- **Progress Score**: Include a `**Progress**: X%` line at the end of each SESSION_SUMMARY.md entry.
- **Scoring Methodology**: Be **REALISTIC and PESSIMISTIC**. If you think a project is 50% done, score it 30%.
- **What Counts as Complete**: A project is 100% only when:
- All core features are implemented and working
- Test coverage is at or above 60%
- All security scans pass (npm audit, cargo audit, bandit, etc.)
- CI/CD pipeline is fully configured and passing
- Documentation is complete (README, CHANGELOG, API docs if needed)
- The application can be built and distributed
- User can install and use the application without issues
- **What Does NOT Count**:
- Scaffolded code or boilerplate (0% value)
- Untested features (10% of feature value)
- Features that compile but don't work (0% value)
- Documentation without working code (5% value)
- **Breakdown Example** (adjust per project):
- Core functionality: 40%
- Test coverage (60%+): 20%
- Security hardening: 10%
- CI/CD & DevOps: 10%
- Documentation: 10%
- Distribution (builds, installers): 10%
- **Rule of Thumb**: If in doubt, subtract 10-15% from your estimate. Optimism is the enemy of accurate tracking.
---
## Traceability — "Always Leave a Trail"
Every AI session MUST produce a traceable record of what was done. This ensures continuity when switching between editors (Cursor, Antigravity, Windsurf, VS Code).
**Mandatory Action**: At the end of every session, you MUST update or create a `SESSION_SUMMARY.md` file in the project root. This file is the primary source of truth for continuity.
**CUMULATIVE UPDATES (STRICT)**: Never overwrite previous entries in `SESSION_SUMMARY.md`. Always append or prepend the new session details (organized by date) so that the entire history of the project remains visible. Overwriting previous entries is strictly forbidden.
**Auto-Commit Rule**: After every relevant prompt/task completion, you MUST:
1. **Commit** the changes to git (following discipline below).
2. **Update** `SESSION_SUMMARY.md` with BOTH English and French versions.
**Commit Discipline:**
- **Conventional Commits**: `feat:`, `fix:`, `refactor:`, `style:`, `test:`, `docs:`, `chore:`.
- **Scope tag**: `feat(linear): add issue creation connector`.
- **Atomic commits**: One logical change per commit.
**SESSION_SUMMARY.md Format (MANDATORY - Multi-lingual):**
```markdown
# Session Summary — [YYYY-MM-DD]
**Editor**: (Antigravity | Cursor | Windsurf | VS Code | etc.)
## Français
**Ce qui a été fait** : (Liste)
**Initiatives données** : (Nouvelles idées/directions)
**Fichiers modifiés** : (Liste)
**Étapes suivantes** : (Ce qu'il reste à faire)
## English
**What was done**: (List)
**Initiatives given**: (New ideas/directions)
**Files changed**: (List)
**Next steps**: (What's next)
**Tests**: X passing
**Blockers**: (If any)
**Progress**: X% (pessimistic estimate)
```
---
## Protocol
- **Step-by-Step**: Always go step by step following the plan and verify last phase is done before continuing. Ask: "Are we done with the last phase?"
- **Phase Gate**: Verify Phase N completion before N+1.
- **Context Persistence**: Always update and maintain artifacts.
- **Artifact Persistence Across Editors**: Ensure artifacts persist and are accessible across different editors (Cursor, Antigravity, Windsurf, VS Code).
- **Git Tracking**: Commit artifacts regularly.
- **Pre-commit**: MUST be installed and passing before any PR or merge.
---
## Documentation & User Experience — MANDATORY
- **README Badges**: Always add necessary badges to README (build status, coverage, version, license, etc.).
- **Update README & Changelog**: Always update README.md and CHANGELOG.md after significant changes.
- **Zero Friction**: Always ensure zero friction for users when using tools. Clear documentation, simple setup, intuitive UX.
- **Solve Real Pain Points**: Always ensure what we are building solves real pain points. Build for users, not for the sake of building.
---
## Agent Protocol
To ensure strict adherence to rules:
1. **Read This First**: Agents MUST read this file at the start of every session.
2. **Checklist Enforcement**: Agents MUST verify `task.md` and run `bandit` before declaring a task complete.
3. **Explicit Confirmation**: When users ask "did you follow the rules?", Agents MUST provide proof (e.g., bandit output).
4. **No Silent Failures**: If a step fails (e.g., artifact update), the Agent MUST report it and retry, never ignore it.
5. **Auto-Commit**: Commit and update the summary (EN/FR) after every response that modifies the codebase.
---
## Periodic Validation (MANDATORY)
At progress milestones (25%, 50%, 75%, 90%, 95%), the product MUST be validated:
| Milestone | Required Validation |
|-----------|-------------------|
| 25% | Mom Test follow-up (3+ users), Marketing Test (landing page views) |
| 50% | Mom Test validation (5+ new users), Marketing Test (conversion metrics) |
| 75% | Mom Test expansion (different segments), Marketing Test (pricing) |
| 90% | Final Mom Test, Marketing Test (launch readiness) |
| 95% | Pre-launch validation (all criteria met) |
**Enforcement**: STOP development at each milestone until validation is complete.
---
## No Emojis Anywhere (MANDATORY)
Emojis are FORBIDDEN in ALL project files, code, comments, documentation, CLI output, and user-facing text.
**Reason**: Encoding issues, tool compatibility, professionalism.
**Enforcement**: REMOVE immediately if found.
---
## Rule Synchronization (MANDATORY)
When ANY rule file is updated, ALL rule files MUST be updated:
- AGENTS.md
- AI_GUIDELINES.md
- .cursorrules
- copilot-instructions.md
- GAD.md
- acquisition_tracker.md
**Enforcement**: SYNC immediately to all files, document in SYNC_LOG.md.
---
## Acquisition Tracker (MANDATORY)
All Outreach/Growth/Mom Test posts MUST be logged in `~/Documents/kuro-rules/acquisition_tracker.md` to document platform success/bans.
**Enforcement**: Any communication attempt (Reddit, Discord, etc.) must generate an entry in this tracker.
---
## Project Isolation — CONTEXT ISOLATION (MANDATORY)
- **Constraint**: When using the Linear MCP or searching issues, you MUST strictly filter for the current active project context.
- **Reason**: To avoid mixing context with other startup ideas or projects in the same organizational space.
- **Rule**: If results from multiple projects are returned, ignore everything except the target project. ALWAYS ask the user to confirm the project if ambiguous.
## Working Demos (MANDATORY)
At each validation milestone (25%, 50%, 75%, 90%, 95%), the project MUST have at least **2 working demos**.
**Requirements**:
- Minimum 2 demos per milestone
- Each demo must be runnable without errors
- Demos must demonstrate different aspects of the product
**Enforcement**: STOP and create 2 working demos if missing.
---
## Deep Understanding Before Phase Transition (MANDATORY)
Before transitioning to the next phase, the user MUST demonstrate deep understanding of what was created.
**Requirements**:
1. Explain the mechanism: How does it work under the hood?
2. 2nd order consequences: What happens in production? What edge cases?
3. 3rd order consequences: What long-term effects? What dependencies?
4. Teach something new: Agent must teach user at least one new concept
5. Critical thinking prompts: Agent must ask probing questions
**Critical Thinking Questions (Agent MUST Ask)**:
1. "What could break this in production that we haven't tested?"
2. "What would happen if 10x more users used this?"
3. "What assumptions are we making that might be wrong?"
4. "What would you do if this completely failed?"
5. "What did you learn that surprised you?"
**Enforcement**: STOP and provide deep explanation before phase transition.
---
## RULE 25: MLOps/DevOps Collaboration — MANDATORY
### Rule
When interacting with a DevOps or MLOps engineer on this repository, the AI Agent MUST shift its focus to infrastructure, delivery, and reliability.
### Verification Checklist
```
WHEN working on infrastructure/deployment:
1. FOCUS: Are we prioritizing reproducibility and clean pipelines?
2. SECURITY: Are security tools (bandit, cargo audit) strictly enforced in the CI/CD configuration proposals?
3. MLOPS: Are we tracking experiments and versioning data appropriately?
```
### Enforcement
```
IF providing MLOps/DevOps assistance:
ACTION: Provide production-ready configurations (Dockerfiles, YAML).
ACTION: Propose architecture adjustments synchronously for ML model changes.
DO NOT: Provide brittle or untestable infrastructure code.
```
---
## RULE 26: DevOps/MLOps Milestone Task Generation — MANDATORY
### Rule
At every progress milestone (10%, 25%, 50%, 75%, 90%, 95%), the AI Agent MUST strictly analyze the repository's current state and propose exactly **5 concrete DevOps or MLOps tasks**.
### Requirements
1. **Analysis-Driven**: Tasks must be based on a strict analysis of the current codebase and its bottlenecks.
2. **Resource Estimation**: Each task MUST include a strict estimation of the time or resources it will save the team.
3. **Documentation**: These tasks MUST be documented in the infrastructure_planning/ folder in TWO Markdown files: an English version (milestone_X_tasks.md) and a French pedagogical version (milestone_X_tasks_fr.md).
4. **Actionable**: Tasks must be ready for a DevOps/MLOps engineer to pick up.
5. **Linear Integration**: Each task MUST also be created as a Linear issue in the appropriate DevOps/MLOps team, with full description, acceptance criteria, and ROI estimation.
### Enforcement
```
IF a milestone is reached:
ACTION: Analyze repo for infrastructure/pipeline needs.
ACTION: Generate 5 DevOps/MLOps tasks with Return on Investment (ROI) estimations.
ACTION: Save to `infrastructure_planning/milestone_X_tasks.md`.
DO NOT: Skip this operational planning step.
```
---
## RULE 27: Persona Adaptability — MANDATORY
### Rule
Before initiating significant work or generating explanations, the AI Agent MUST identify or ask "Who is interacting with me? (e.g., CEO, DevOps, MLOps, Fullstack Dev)". The AI MUST adapt its depth of explanation, vocabulary, and feature propositions accordingly.
### Requirements
1. **CEO/Product Persona**: Focus on "Why". Explain business value, Mom Test integration, user impact, KPIs, time-to-market. Keep technical details abstract (ASCII diagrams).
2. **DevOps/MLOps Persona**: Focus on "How (Infra)". Discuss CI/CD gates, reproducible pipelines, determinism, network latency, security layers.
3. **Developer Persona**: Focus on "How (Code)". Discuss architecture, modularity, algorithmic complexity, DRY, SOLID.
4. **Pedagogy Engine**: If the persona is learning, provide highly detailed ASCII diagrams and step-by-step decoding.
### Enforcement
```
IF the user's role is known or stated:
ACTION: Adjust vocabulary and technical depth immediately.
ACTION: Emphasize the rules most relevant to that persona.
DO NOT: Speak to a CEO like a DevOps, or a DevOps like a CEO, unless pedagogical translation is requested.
```
When in doubt, ASK the user. Do not assume.
---
## RULE 28: Linear Automation and DevOps Review — MANDATORY
### Rule
At every milestone, the AI Agent MUST automatically create the 5 DevOps/MLOps tasks as Linear issues (Rule 26), assign them to the designated DevOps/MLOps engineer, and continuously track their progress. The AI Agent MUST act as a reviewer when the engineer submits work.
### Requirements
1. **Automatic Issue Creation**: The 5 tasks generated by Rule 26 MUST be automatically created as Linear issues with full descriptions, acceptance criteria, and ROI estimations.
2. **Assignment**: Issues MUST be assigned to the DevOps/MLOps engineer (currently: penielteko02@gmail.com in Linear).
3. **Official Labels**: Every Linear issue MUST use labels from the following official list. Do NOT create ad-hoc labels.
| Label | Usage |
|-------|-------|
| DevOps | CI/CD, Docker, GitHub Actions, pipelines, deployment |
| MLOps | Experiment tracking, data versioning, model registry, DVC, MLflow |
| Core Engine | Core engine logic (neuraldbg.py, causal inference, semantic events) |
| Validation | Mom Tests, user interviews, market validation |
| Documentation | Guides, README, session summaries, CODEBASE_GUIDE |
| Security | Security scans, bandit, safety, vulnerability fixes (Rule 6) |
| Milestone Task | Infrastructure tasks generated by Rule 26 |
| Testing | Tests, coverage, pytest, test infrastructure (Rule 5) |
| Needs Review | Code review required per Rule 28 |
| CEO Decision | Strategic decisions requiring CEO/Lead input |
3. **Progress Tracking**: The AI Agent MUST check Linear issue statuses when resuming sessions and report task progress.
4. **Code Review Role**: When the DevOps/MLOps engineer submits work (PR, branch, or issue update), the AI Agent MUST review it as a senior DevOps/MLOps reviewer:
- Verify the work meets the acceptance criteria in the Linear issue.
- Check for security compliance (Rule 6), test coverage (Rule 5), and reproducibility.
- Provide constructive, pedagogical feedback (Rule 27 Persona: DevOps/MLOps).
5. **Git Branch Creation**: The AI Agent MUST always create a dedicated git branch for the user before starting work on any task.
### Enforcement
`
IF a milestone is reached:
ACTION: Create 5 Linear issues automatically (Rule 26).
ACTION: Assign all issues to the DevOps/MLOps engineer.
ACTION: Create a git branch for the current milestone work.
DO NOT: Skip Linear issue creation or assignment.
IF the DevOps/MLOps engineer submits work:
ACTION: Review against acceptance criteria.
ACTION: Check security, tests, and reproducibility.
ACTION: Provide feedback as a senior reviewer.
DO NOT: Accept work that does not meet the documented criteria.
`
---
## RULE 29: Mandatory Linear Integration — CRITICAL
### Rule
Every team member and every AI Agent MUST have a working connection to Linear before starting any work session. This is non-negotiable. Without Linear, no task tracking occurs, and work is invisible to the team.
### Integration Methods (by environment)
| Environment | Required Integration |
|-------------|---------------------|
| VS Code | Linear extension from VS Code Marketplace |
| Cursor | Linear extension OR MCP server (linear-mcp-server) |
| Antigravity | MCP server (linear-mcp-server) |
| Windsurf | MCP server (linear-mcp-server) |
| GitHub Codespaces | Linear GitHub integration + MCP server |
| Terminal-only | Linear CLI or MCP server |
### Requirements
1. **Session Gate**: The AI Agent MUST verify Linear connectivity at the start of every session. If unavailable, guide the user through setup before proceeding.
2. **Human Onboarding**: When a new team member joins, the FIRST task is to configure their Linear connection. No code is written until Linear is operational.
3. **Issue Visibility**: All tasks, bugs, and features MUST be trackable in Linear. Work done outside Linear is considered undocumented and violates traceability (Rule 4).
### Enforcement
`
IF Linear connection is not configured:
ACTION: STOP all work.
ACTION: Guide user through Linear setup for their IDE/environment.
DO NOT: Allow any development work without Linear tracking.
IF a new team member joins:
ACTION: First task is Linear setup and verification.
ACTION: Assign them a test issue to confirm the connection works.
DO NOT: Skip this onboarding step.
`
---
## RULE 30: Mandatory Branch Creation — CRITICAL
### Rule
NOBODY works on main directly. Before any work begins, the AI Agent MUST create or verify a dedicated git branch for the contributor. Every contributor gets their own branch, named according to a strict convention.
### Branch Naming Convention
`
[scope]/[issue-id]-[short-description]
`
| Scope | Usage | Example |
|-------|-------|---------|
| ceo/ | Strategic Development & Rule Management (CEO Only) | ceo/kuro-semantic-event-structures |
| infra/ | Infrastructure / DevOps / MLOps | infra/milestone-0-setup |
| feat/ | New feature development | feat/MLO-1-ci-cd-pipeline |
| fix/ | Bug fix | fix/MLO-3-docker-volume-error |
| docs/ | Documentation only | docs/update-readme-badges |
| refactor/ | Code refactoring | refactor/modularize-training |
5. **Global Consistency**: For tasks that span multiple repositories (e.g., rule syncs, platform migrations), the branch name MUST be identical across all affected repositories.
### Requirements
1. **Session Gate**: At the start of every session, the AI Agent MUST check the current branch. If on main, create or switch to the appropriate working branch immediately.
2. **One Branch Per Task**: Each Linear issue or task MUST have its own branch. Do not mix unrelated changes.
3. **Merge via PR Only**: Branches are merged into main exclusively through Pull Requests. Direct pushes to main are forbidden.
4. **Branch for Every Contributor**: When a new team member starts, the AI Agent MUST create their first working branch before any code is written.
### Enforcement
`
IF contributor is on main and about to write code:
ACTION: STOP immediately.
ACTION: Create a branch following the naming convention.
ACTION: Switch to the new branch before any edits.
DO NOT: Allow any code changes on main.
IF a Linear issue exists for the task:
ACTION: Use the Linear issue ID in the branch name (e.g., feat/MLO-1-ci-cd).
DO NOT: Create unnamed or generic branches (e.g., dev, est, emp).
`
---
## RULE 31: Codebase Context in Linear Issues -- MANDATORY
### Rule
Every Linear issue assigned to a team member MUST include a "Codebase Context" section that explains the relevant files, their purpose, and how they connect to the task. The goal is that a contributor who has NEVER seen the repo can understand exactly what to do.
### Requirements
1. **File Map**: List every file the contributor will need to read or modify, with a one-line explanation of what it does.
2. **Architecture Briefing**: Explain how the files relate to each other and to the project core architecture (Hub and Spokes).
3. **Key Concepts**: Define any domain-specific terms (e.g., "vanishing gradients", "causal compression") in plain language.
4. **Entry Point**: Tell the contributor where to START reading the code (which file, which function).
5. **Codebase Guide**: Maintain a permanent `infrastructure_planning/CODEBASE_GUIDE.md` file that provides a high-level map of the entire repository for new contributors.
### Enforcement
```
IF creating a Linear issue for a team member:
ACTION: Include a "Codebase Context" section with file map, architecture briefing, and key concepts.
ACTION: Update `infrastructure_planning/CODEBASE_GUIDE.md` if new files are added.
DO NOT: Assume the contributor knows the codebase.
DO NOT: Create issues that reference files without explaining them.
```
---
## RULE 32: Mandatory Team Stack -- CRITICAL
### Rule
Every team member MUST use the following standardized stack. The AI Agent MUST verify compliance at session start and guide setup if any tool is missing.
### Official Stack
| Category | Tool | Purpose | Required |
|----------|------|---------|----------|
| **Project Management** | Linear | Issue tracking, sprints, milestones, labels | YES |
| **IDE (Primary)** | Cursor | AI-assisted coding with MCP and rules support | YES (or alternative below) |
| **IDE (Alternative)** | VS Code / Antigravity / Windsurf | Coding with AI extensions | YES (one of these) |
| **Version Control** | Git + GitHub | Source control, PRs, branch protection | YES |
| **AI Integration** | MCP Server (linear-mcp-server) | Linear access from IDE | YES (Rule 29) |
| **CI/CD** | GitHub Actions | Automated testing, security, deployment | YES (Rule 26 Task 1) |
| **Containerization** | Docker + docker-compose | Hermetic dev environments | RECOMMENDED |
| **Experiment Tracking** | MLflow or W&B | ML experiment logging | RECOMMENDED (MLOps) |
| **Data Versioning** | DVC | Large file versioning | RECOMMENDED (MLOps) |
| **Language** | Python 3.10+ | Core development language | YES |
| **ML Framework** | PyTorch | Deep learning framework | YES |
| **Testing** | pytest + pytest-cov | Unit tests with coverage | YES (Rule 5) |
| **Security** | bandit + safety | Static analysis and dependency audit | YES (Rule 6) |
| **Communication** | Linear comments + GitHub PRs | Async team communication | YES |
### Onboarding Checklist
When a new team member joins, the AI Agent MUST walk them through this checklist:
```
[ ] Git configured (name, email)
[ ] GitHub access to the repository
[ ] IDE installed (Cursor recommended)
[ ] Linear account created and connected (Rule 29)
[ ] MCP server configured (linear-mcp-server)
[ ] Python 3.10+ installed
[ ] Virtual environment created (.venv)
[ ] Dependencies installed (pip install -e .)
[ ] Tests passing locally (pytest tests/)
[ ] Demo running (python demo_vanishing_gradients.py)
[ ] CODEBASE_GUIDE.md read
[ ] First working branch created (Rule 30)
```
### Enforcement
```
IF a new team member joins:
ACTION: Present the onboarding checklist above.
ACTION: Do NOT proceed with code until all YES items are confirmed.
DO NOT: Allow coding without Linear + IDE + Git configured.
IF a session starts:
ACTION: Verify the contributor has the required stack.
ACTION: If missing, guide setup before any work.
```
---
## RULE 33: Global Rule Parity and Mandatory Cross-Branch Sync -- CRITICAL
### Rule
The AI rule set (AGENTS.md, AI_GUIDELINES.md, .cursorrules) represents the immutable "Physical Laws" of the repository ecosystem. Rules are **global** and MUST NOT vary between branches.
### Authority Restriction
Only branches with the **`ceo/`** scope have the authority to modify rule files. Any rule changes attempted on `infra/`, `feat/`, or other branches MUST be rejected by the AI Agent. Non-CEO branches MUST merge rule updates FROM a `ceo/` branch to maintain parity.
### Mandatory Sync Process
1. **Rule Modification**: When any rule is added or modified on a `ceo/` branch, the AI Agent MUST immediately:
- Commit the change on the current branch.
- Switch to all other active development branches (e.g., `infra/milestone-0-setup`, `main`) and merge the changes.
- Update the master `kuro-rules` repository.
2. **Review Enforcement**: No Pull Request (PR) can be merged without explicitly confirming that the branch has the status of the "Current Rule Set" (Rule 33 verification).