supermemory-init.md (5520B)
1 --- 2 description: Initialize Supermemory with comprehensive codebase knowledge 3 --- 4 5 # Initializing Supermemory 6 7 You are initializing persistent memory for this codebase. This is not just data collection - you're building context that will make you significantly more effective across all future sessions. 8 9 ## Understanding Context 10 11 You are a **stateful** coding agent. Users expect to work with you over extended periods - potentially the entire lifecycle of a project. Your memory is how you get better over time and maintain continuity. 12 13 ## What to Remember 14 15 ### 1. Procedures (Rules & Workflows) 16 Explicit rules that should always be followed: 17 - "Never commit directly to main - always use feature branches" 18 - "Always run lint before tests" 19 - "Use conventional commits format" 20 21 ### 2. Preferences (Style & Conventions) 22 Project and user coding style: 23 - "Prefer functional components over class components" 24 - "Use early returns instead of nested conditionals" 25 - "Always add JSDoc to exported functions" 26 27 ### 3. Architecture & Context 28 How the codebase works and why: 29 - "Auth system was refactored in v2.0 - old patterns deprecated" 30 - "The monorepo used to have 3 modules before consolidation" 31 - "This pagination bug was fixed before - similar to PR #234" 32 33 ## Memory Scopes 34 35 **Project-scoped** (`scope: "project"`): 36 - Build/test/lint commands 37 - Architecture and key directories 38 - Team conventions specific to this codebase 39 - Technology stack and framework choices 40 - Known issues and their solutions 41 42 **User-scoped** (`scope: "user"`): 43 - Personal coding preferences across all projects 44 - Communication style preferences 45 - General workflow habits 46 47 ## Research Approach 48 49 This is a **deep research** initialization. Take your time and be thorough (~50+ tool calls). The goal is to genuinely understand the project, not just collect surface-level facts. 50 51 **What to uncover:** 52 - Tech stack and dependencies (explicit and implicit) 53 - Project structure and architecture 54 - Build/test/deploy commands and workflows 55 - Contributors & team dynamics (who works on what?) 56 - Commit conventions and branching strategy 57 - Code evolution (major refactors, architecture changes) 58 - Pain points (areas with lots of bug fixes) 59 - Implicit conventions not documented anywhere 60 61 ## Research Techniques 62 63 ### File-based 64 - README.md, CONTRIBUTING.md, AGENTS.md, CLAUDE.md 65 - Package manifests (package.json, Cargo.toml, pyproject.toml, go.mod) 66 - Config files (.eslintrc, tsconfig.json, .prettierrc) 67 - CI/CD configs (.github/workflows/) 68 69 ### Git-based 70 - `git log --oneline -20` - Recent history 71 - `git branch -a` - Branching strategy 72 - `git log --format="%s" -50` - Commit conventions 73 - `git shortlog -sn --all | head -10` - Main contributors 74 75 ### Explore Agent 76 Fire parallel explore queries for broad understanding: 77 ``` 78 Task(explore, "What is the tech stack and key dependencies?") 79 Task(explore, "What is the project structure? Key directories?") 80 Task(explore, "How do you build, test, and run this project?") 81 Task(explore, "What are the main architectural patterns?") 82 Task(explore, "What conventions or patterns are used?") 83 ``` 84 85 ## How to Do Thorough Research 86 87 **Don't just collect data - analyze and cross-reference.** 88 89 Bad (shallow): 90 - Run commands, copy output 91 - List facts without understanding 92 93 Good (thorough): 94 - Cross-reference findings (if inconsistent, dig deeper) 95 - Resolve ambiguities (don't leave questions unanswered) 96 - Read actual file content, not just names 97 - Look for patterns (what do commits tell you about workflow?) 98 - Think like a new team member - what would you want to know? 99 100 ## Saving Memories 101 102 Use the `supermemory` tool for each distinct insight: 103 104 ``` 105 supermemory(mode: "add", content: "...", type: "...", scope: "project") 106 ``` 107 108 **Types:** 109 - `project-config` - tech stack, commands, tooling 110 - `architecture` - codebase structure, key components, data flow 111 - `learned-pattern` - conventions specific to this codebase 112 - `error-solution` - known issues and their fixes 113 - `preference` - coding style preferences (use with user scope) 114 115 **Guidelines:** 116 - Save each distinct insight as a separate memory 117 - Be concise but include enough context to be useful 118 - Include the "why" not just the "what" when relevant 119 - Update memories incrementally as you research (don't wait until the end) 120 121 **Good memories:** 122 - "Uses Bun runtime and package manager. Commands: bun install, bun run dev, bun test" 123 - "API routes in src/routes/, handlers in src/handlers/. Hono framework." 124 - "Auth uses Redis sessions, not JWT. Implementation in src/lib/auth.ts" 125 - "Never use `any` type - strict TypeScript. Use `unknown` and narrow." 126 - "Database migrations must be backward compatible - we do rolling deploys" 127 128 ## Upfront Questions 129 130 Before diving in, ask: 131 1. "Any specific rules I should always follow?" 132 2. "Preferences for how I communicate? (terse/detailed)" 133 134 ## Reflection Phase 135 136 Before finishing, reflect: 137 1. **Completeness**: Did you cover commands, architecture, conventions, gotchas? 138 2. **Quality**: Are memories concise and searchable? 139 3. **Scope**: Did you correctly separate project vs user knowledge? 140 141 Then ask: "I've initialized memory with X insights. Want me to continue refining, or is this good?" 142 143 ## Your Task 144 145 1. Ask upfront questions (research depth, rules, preferences) 146 2. Check existing memories: `supermemory(mode: "list", scope: "project")` 147 3. Research based on chosen depth 148 4. Save memories incrementally as you discover insights 149 5. Reflect and verify completeness 150 6. Summarize what was learned and ask if user wants refinement