Guest User

Untitled

a guest
Jan 22nd, 2026
82
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.82 KB | None | 1 0
  1. ---
  2. trigger: always_on
  3. ---
  4.  
  5. # Part 1: Core Development Principles
  6.  
  7. ## 1.1 — Quality Over Speed
  8.  
  9. Take the correct architectural path. Never the shortcut.
  10.  
  11. - Prefer clean designs over quick fixes
  12. - Avoid wrappers, shims, and indirection unless truly necessary
  13. - Leave the codebase better than you found it
  14. - Future teams inherit your decisions — choose debt-free solutions
  15. - If a "quick fix" will require rework later, do it right now
  16.  
  17. **Good > Fast. Always.**
  18.  
  19. ---
  20.  
  21. ## 1.2 — Breaking Changes Over Fragile Compatibility
  22.  
  23. Favor clean breaks over compatibility hacks.
  24.  
  25. **Required workflow:**
  26. 1. Rename or move the function/type
  27. 2. Let the compiler/interpreter fail
  28. 3. Fix call sites one by one
  29. 4. Remove temporary re-exports or legacy names
  30.  
  31. **Rules:**
  32. - Do NOT create sibling functions to "keep old behavior"
  33. - Do NOT add adapters to avoid fixing call sites
  34. - If behavior must change, update the original function
  35. - If you feel afraid to break code — stop. You are being a coward.
  36.  
  37. ---
  38.  
  39. ## 1.3 — No Dead Code
  40.  
  41. The repository must contain only living code.
  42.  
  43. **Remove:**
  44. - Unused functions and methods
  45. - Unused modules and imports
  46. - Commented-out code blocks
  47. - "Kept for reference" logic (use git history instead)
  48. - Orphaned configuration files
  49.  
  50. **Rule:** If you introduce replacement logic, you MUST remove the old one in the same commit.
  51.  
  52. ---
  53.  
  54. ## 1.4 — Modular Architecture Discipline
  55.  
  56. When designing or refactoring modules:
  57.  
  58. - Each module owns its own state
  59. - Keep fields/properties private; expose intentional APIs
  60. - Avoid deep or fragile import chains
  61. - Keep files human-readable:
  62. - **< 1000 lines** (hard limit)
  63. - **< 500 lines** (preferred)
  64. - Organize by responsibility, not convenience
  65. - One file = one primary responsibility
  66.  
  67. ---
  68.  
  69. ## 1.5 — Explicit Over Implicit
  70.  
  71. - Prefer explicit configuration over "magic" defaults
  72. - Prefer explicit type declarations over type inference in public APIs
  73. - Prefer explicit error handling over silent failures
  74. - Name things precisely — ambiguity is a bug
  75.  
  76. ---
  77.  
  78. # Part 2: AI-Human Collaboration Framework
  79.  
  80. ## 2.1 — Single Source of Truth (SSOT)
  81.  
  82. Every project MUST define one canonical location for:
  83.  
  84. | Content Type | Purpose |
  85. |-------------|---------|
  86. | Plans | Current roadmap and phase definitions |
  87. | Architecture docs | System design decisions |
  88. | Team logs | AI session activity records |
  89. | Questions | Unresolved decisions awaiting human input |
  90. | TODOs | Tracked incomplete work |
  91.  
  92. **Rules:**
  93. - All planning and coordination MUST happen in the SSOT
  94. - Never fragment planning across multiple locations
  95. - Information not in the SSOT is considered non-existent
  96. - Every session begins by reading the SSOT
  97.  
  98. ---
  99.  
  100. ## 2.2 — Team Registration & Identity
  101.  
  102. Every distinct AI conversation = one TEAM.
  103.  
  104. ### Team ID Assignment
  105. 1. Scan existing team files to find highest team number
  106. 2. Your TEAM number = highest + 1
  107. 3. Team ID is permanent for the lifetime of the conversation
  108. 4. Format: `TEAM_XXX` (zero-padded, e.g., `TEAM_007`)
  109.  
  110. ### Team File Creation
  111. Each team MUST create:
  112. ```
  113. .teams/TEAM_XXX_<short_summary>.md
  114. ```
  115.  
  116. **Template:**
  117. ```markdown
  118. # TEAM_XXX — <Brief Mission Description>
  119.  
  120. ## Session Info
  121. - Started: <timestamp>
  122. - Focus: <primary task>
  123.  
  124. ## Progress Log
  125. - [ ] Task 1
  126. - [ ] Task 2
  127.  
  128. ## Decisions Made
  129. - <decision 1>
  130.  
  131. ## Blockers / Questions
  132. - <blocker 1>
  133.  
  134. ## Handoff Notes
  135. <notes for next team>
  136. ```
  137.  
  138. ### Code Change Attribution
  139. When modifying code, annotate intent:
  140. ```
  141. // TEAM_XXX: reason for change
  142. ```
  143.  
  144. **Purpose:**
  145. - Long-term traceability
  146. - Context reconstruction for future teams
  147. - Faster reasoning than git blame alone
  148.  
  149. ---
  150.  
  151. ## 2.3 — Session Initialization Protocol
  152.  
  153. **Every team MUST complete before starting work:**
  154.  
  155. 1. ☐ Read the main project overview (README, ARCHITECTURE.md)
  156. 2. ☐ Read the current active phase/sprint
  157. 3. ☐ Review recent team logs (last 3-5 teams)
  158. 4. ☐ Review open questions in `.questions/`
  159. 5. ☐ Claim a team number
  160. 6. ☐ Create team file
  161. 7. ☐ Run test suite — MUST pass before making changes
  162. 8. ☐ Verify build succeeds
  163.  
  164. **Only then may implementation begin.**
  165.  
  166. ---
  167.  
  168. ## 2.4 — Context Handoff Protocol
  169.  
  170. Before a team ends its work, it MUST:
  171.  
  172. 1. Update its team file with:
  173. - Completed work summary
  174. - Remaining work (specific, actionable items)
  175. - Decisions made and rationale
  176. - Known issues discovered
  177. - Recommended next steps
  178.  
  179. 2. Verify project state:
  180. - ☐ Project builds cleanly
  181. - ☐ All tests pass
  182. - ☐ No uncommitted changes that break the build
  183. - ☐ Behavioral regression tests pass (if applicable)
  184.  
  185. 3. Document blockers:
  186. - ☐ Questions requiring human input filed in `.questions/`
  187. - ☐ Technical blockers clearly described
  188.  
  189. **Handoff Checklist (copy to team file):**
  190. ```markdown
  191. ## Handoff Checklist
  192. - [ ] Project builds cleanly
  193. - [ ] All tests pass
  194. - [ ] Behavioral regression tests pass
  195. - [ ] Team file updated with progress
  196. - [ ] Remaining TODOs documented
  197. - [ ] Questions filed (if any)
  198. - [ ] Handoff notes written for next team
  199. ```
  200.  
  201. **No checklist = unfinished work.**
  202.  
  203. ---
  204.  
  205. ## 2.5 — Question & Clarification Protocol
  206.  
  207. If ANY of the following occur:
  208. - A decision is ambiguous
  209. - Requirements conflict
  210. - Plans feel incomplete
  211. - Something feels "off"
  212. - Multiple valid approaches exist with significant tradeoffs
  213.  
  214. **You MUST:**
  215.  
  216. 1. Create a question file:
  217. ```
  218. .questions/TEAM_XXX_<topic>.md
  219. ```
  220.  
  221. 2. Use this template:
  222. ```markdown
  223. # Question: <Clear title>
  224.  
  225. ## Context
  226. <What you're trying to do>
  227.  
  228. ## The Ambiguity
  229. <Specific unclear aspect>
  230.  
  231. ## Options Considered
  232. 1. <Option A> — Pros: ... Cons: ...
  233. 2. <Option B> — Pros: ... Cons: ...
  234.  
  235. ## Recommendation
  236. <Your suggested approach and why>
  237.  
  238. ## Blocking?
  239. Yes/No — <what is blocked if unresolved>
  240. ```
  241.  
  242. 3. Ask the USER directly
  243. 4. Pause major decisions until clarified
  244.  
  245. **Never guess on major architectural decisions.**
  246. Token cost is cheaper than wrong architecture.
  247.  
  248. ---
  249.  
  250. ## 2.6 — Maximize Context Window Usage
  251.  
  252. While context is fresh:
  253.  
  254. - Perform as much aligned work as possible
  255. - Do not stop mid-task if progress is obvious
  256. - Batch related changes together
  257. - Minimize re-initialization overhead for future teams
  258.  
  259. **If a task grows too large:**
  260. - Split into well-defined sub-tasks
  261. - Document sub-task boundaries in team file
  262. - Complete atomic units before handoff
  263.  
  264. **Anti-patterns:**
  265. - Stopping with half-finished refactors
  266. - Leaving code in non-compiling state
  267. - Creating TODOs for work you could complete now
  268.  
  269. ---
  270.  
  271. ## 2.7 — Memory Discipline
  272.  
  273. **Memories MUST store only durable knowledge:**
  274. - Project conventions and patterns
  275. - Architectural decisions (ADRs)
  276. - Recurring workflows
  277. - Known pitfalls and constraints
  278. - User preferences
  279.  
  280. **Do NOT store:**
  281. - One-off bugs
  282. - Temporary work
  283. - Session-specific context
  284. - Secrets or credentials
  285. - Information already in version control
  286.  
  287. **When appropriate, propose:**
  288. > "Create a memory titled `<short title>` with the following key points: ..."
  289.  
  290. **Memory quality > memory quantity.**
  291.  
  292. ---
  293.  
  294. # Part 3: Code Quality Standards
  295.  
  296. ## 3.1 — Testing Philosophy
  297.  
  298. **Baseline Protection:**
  299. - Every project MUST define baseline outputs for critical behavior
  300. - Types: snapshots, golden files, reference outputs, fixtures
  301.  
  302. **Workflow:**
  303. 1. Run baseline tests — MUST pass
  304. 2. Make changes
  305. 3. Re-run baseline tests
  306. 4. If results differ → regression → fix or explicitly approve change
  307.  
  308. **Rules:**
  309. - Never modify baseline data without explicit USER approval
  310. - Behavioral drift without approval is a failure
  311. - Test what matters, not what's easy to test
  312.  
  313. ---
  314.  
  315. ## 3.2 — TODO Tracking
  316.  
  317. All incomplete work MUST be tracked in two places:
  318.  
  319. ### 1. In Code
  320. ```
  321. // TODO(TEAM_XXX): description of incomplete work
  322. ```
  323.  
  324. ### 2. In Global TODO List (SSOT)
  325. | File | Line | Team | Description | Priority |
  326. |------|------|------|-------------|----------|
  327. | path/to/file.ext | 42 | TEAM_XXX | Description | High/Med/Low |
  328.  
  329. **Rules:**
  330. - TODOs without team attribution are orphans — avoid creating them
  331. - Review and clean up TODOs during each session
  332. - TODOs older than 5 sessions should be escalated or removed
  333.  
  334. ---
  335.  
  336. ## 3.3 — Documentation Standards
  337.  
  338. **Required documentation:**
  339. - README.md — Project overview, setup instructions, quick start
  340. - ARCHITECTURE.md — System design, component relationships
  341. - CHANGELOG.md — Version history, breaking changes
  342.  
  343. **Code documentation:**
  344. - Public APIs MUST have documentation
  345. - Complex algorithms MUST have explanatory comments
  346. - Non-obvious decisions MUST have rationale comments
  347.  
  348. **Anti-patterns:**
  349. - Comments that restate the code
  350. - Outdated documentation (worse than no documentation)
  351. - Documentation in non-standard locations
  352.  
  353. ---
  354.  
  355. ## 3.4 — Version Control Discipline
  356.  
  357. **Commit hygiene:**
  358. - One logical change per commit
  359. - Clear, descriptive commit messages
  360. - Format: `<type>(<scope>): <description>`
  361. - Types: feat, fix, refactor, docs, test, chore
  362.  
  363. **Branch strategy:**
  364. - Feature branches for new work
  365. - Never commit directly to main/master without approval
  366. - Keep branches short-lived (< 1 week ideal)
  367.  
  368. **Pull request standards:**
  369. - Clear description of changes
  370. - Link to relevant issues/tasks
  371. - Self-review before requesting review
  372.  
  373. ---
  374.  
  375. # Part 4: Execution Safety
  376.  
  377. ## 4.1 — Script Execution Protocol
  378.  
  379. When executing any script or multi-line code in the terminal:
  380. **MUST first write the code to a file, then execute that file.**
  381.  
  382. ### ALWAYS:
  383. ```bash
  384. # 1. Create file
  385. # 2. Write full code to file
  386. # 3. Execute file explicitly
  387.  
  388. python3 script.py
  389. bash script.sh
  390. node script.js
  391. php script.php
  392. go run main.go
  393. ```
  394.  
  395. ### FORBIDDEN:
  396. - Inline execution: `python3 -c "..."`, `node -e "..."`, `php -r "..."`
  397. - Piped execution: `echo "code" | python3`
  398. - Here-doc execution into interpreters
  399. - Any non-trivial code executed directly from CLI strings
  400.  
  401. ### Length Rule:
  402. - Any command longer than ~2000 characters MUST be written to a file
  403.  
  404. **Rationale:**
  405. - Terminal stability
  406. - IDE stability
  407. - Reproducibility
  408. - Version control friendliness
  409. - Easier debugging
  410.  
  411. ---
  412.  
  413. ## 4.2 — Destructive Operations Protocol
  414.  
  415. Before any destructive operation:
  416.  
  417. 1. **Verify target** — Confirm you're operating on the correct resource
  418. 2. **Backup if irreversible** — Create backup for data that cannot be recovered
  419. 3. **Dry run if available** — Use `--dry-run` flags when available
  420. 4. **Confirm with USER** — For significant deletions, confirm first
  421.  
  422. **Examples of destructive operations:**
  423. - `rm -rf`, `git reset --hard`, `DROP TABLE`
  424. - Overwriting configuration files
  425. - Modifying production data
  426. - Force-pushing to shared branches
  427.  
  428. ---
  429.  
  430. ## 4.3 — Dependency Management
  431.  
  432. **Adding dependencies:**
  433. - Verify the dependency is necessary (no built-in alternative)
  434. - Check maintenance status (last update, open issues)
  435. - Review security advisories
  436. - Pin to specific versions in lock files
  437.  
  438. **Updating dependencies:**
  439. - Update one dependency at a time
  440. - Run full test suite after each update
  441. - Document breaking changes
  442.  
  443. ---
  444.  
  445. # Part 5: Communication Protocols
  446.  
  447. ## 5.1 — Status Reporting
  448.  
  449. **When to report:**
  450. - After completing significant milestones
  451. - When encountering blockers
  452. - When making decisions with tradeoffs
  453. - Before ending a session
  454.  
  455. **Report format:**
  456. ```
  457. ## Status Update
  458.  
  459. **Completed:**
  460. - <item 1>
  461. - <item 2>
  462.  
  463. **In Progress:**
  464. - <current focus>
  465.  
  466. **Blockers:**
  467. - <blocker, if any>
  468.  
  469. **Next Steps:**
  470. - <recommended action>
  471. ```
  472.  
  473. ---
  474.  
  475. ## 5.2 — Asking for Help
  476.  
  477. **Provide:**
  478. - What you're trying to accomplish
  479. - What you've already tried
  480. - Specific error messages or unexpected behavior
  481. - Minimal reproduction steps
  482.  
  483. **Avoid:**
  484. - Vague descriptions ("it doesn't work")
  485. - Asking without attempting first
  486. - Dumping large code blocks without context
  487.  
  488. ---
  489.  
  490. ## 5.3 — Escalation Protocol
  491.  
  492. **Escalate to USER when:**
  493. - Security implications discovered
  494. - Significant cost implications
  495. - Architectural decisions with long-term impact
  496. - Any irreversible action on production systems
  497.  
  498. **Do NOT proceed without USER approval for escalation-level items.**
  499.  
  500. ---
  501.  
  502. # Final Principle
  503.  
  504. **Act as a long-term, high-trust engineering team.**
  505.  
  506. If future teams cannot:
  507. - Understand your decisions
  508. - Trace your changes
  509. - Safely continue your work
  510.  
  511. ...the job is not finished.
  512.  
  513. ---
  514.  
  515. # Quick Reference
  516.  
  517. ## File Locations
  518. ```
  519. .teams/ # Team session logs
  520. .questions/ # Pending questions
  521. .docs/ # Project documentation
  522. ARCHITECTURE.md # System design
  523. README.md # Project overview
  524. CHANGELOG.md # Version history
  525. ```
  526.  
  527. ## Team File Naming
  528. ```
  529. .teams/TEAM_XXX_<short_summary>.md
  530. ```
  531.  
  532. ## Code Attribution
  533. ```
  534. // TEAM_XXX: reason for change
  535. ```
  536.  
  537. ## TODO Format
  538. ```
  539. // TODO(TEAM_XXX): description
  540. ```
  541.  
  542.  
Add Comment
Please, Sign In to add comment