@codemieai/code 0.0.37 → 0.0.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/core/BaseAgentAdapter.d.ts.map +1 -1
- package/dist/agents/core/BaseAgentAdapter.js +23 -9
- package/dist/agents/core/BaseAgentAdapter.js.map +1 -1
- package/dist/agents/plugins/claude/claude.plugin.d.ts +11 -0
- package/dist/agents/plugins/claude/claude.plugin.d.ts.map +1 -1
- package/dist/agents/plugins/claude/claude.plugin.js +55 -2
- package/dist/agents/plugins/claude/claude.plugin.js.map +1 -1
- package/dist/agents/plugins/claude/plugin/.claude-plugin/plugin.json +1 -1
- package/dist/agents/plugins/claude/plugin/commands/README.md +103 -22
- package/dist/agents/plugins/claude/plugin/commands/memory-refresh.md +329 -18
- package/dist/cli/commands/hook.d.ts +72 -0
- package/dist/cli/commands/hook.d.ts.map +1 -1
- package/dist/cli/commands/hook.js +290 -110
- package/dist/cli/commands/hook.js.map +1 -1
- package/dist/cli/commands/log/cleaner.d.ts +4 -0
- package/dist/cli/commands/log/cleaner.d.ts.map +1 -1
- package/dist/cli/commands/log/cleaner.js +4 -0
- package/dist/cli/commands/log/cleaner.js.map +1 -1
- package/dist/cli/commands/log/index.js +2 -0
- package/dist/cli/commands/log/index.js.map +1 -1
- package/dist/cli/commands/log/reader.d.ts +5 -0
- package/dist/cli/commands/log/reader.d.ts.map +1 -1
- package/dist/cli/commands/log/reader.js +47 -10
- package/dist/cli/commands/log/reader.js.map +1 -1
- package/dist/cli/commands/profile/display.d.ts +1 -0
- package/dist/cli/commands/profile/display.d.ts.map +1 -1
- package/dist/cli/commands/profile/display.js +10 -2
- package/dist/cli/commands/profile/display.js.map +1 -1
- package/dist/cli/commands/profile/index.js +58 -22
- package/dist/cli/commands/profile/index.js.map +1 -1
- package/dist/cli/commands/setup.js +141 -24
- package/dist/cli/commands/setup.js.map +1 -1
- package/dist/env/types.d.ts +9 -1
- package/dist/env/types.d.ts.map +1 -1
- package/dist/env/types.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/config.d.ts +35 -8
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +243 -33
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/logger.d.ts +8 -0
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +42 -0
- package/dist/utils/logger.js.map +1 -1
- package/package.json +1 -1
- package/dist/agents/plugins/claude/plugin/commands/memory-add.md +0 -325
- package/dist/agents/plugins/claude/plugin/commands/memory-init.md +0 -18
package/dist/utils/logger.js
CHANGED
|
@@ -17,6 +17,8 @@ class Logger {
|
|
|
17
17
|
logFilePath = null;
|
|
18
18
|
logFileInitialized = false;
|
|
19
19
|
writeStream = null;
|
|
20
|
+
currentLogDate = null;
|
|
21
|
+
isRotating = false;
|
|
20
22
|
constructor() { }
|
|
21
23
|
/**
|
|
22
24
|
* Set agent name for log formatting
|
|
@@ -60,6 +62,7 @@ class Logger {
|
|
|
60
62
|
this.cleanupOldLogs(logsDir);
|
|
61
63
|
const today = new Date().toISOString().split('T')[0]; // YYYY-MM-DD
|
|
62
64
|
this.logFilePath = path.join(logsDir, `debug-${today}.log`);
|
|
65
|
+
this.currentLogDate = today;
|
|
63
66
|
// Create write stream with append mode
|
|
64
67
|
this.writeStream = fs.createWriteStream(this.logFilePath, { flags: 'a' });
|
|
65
68
|
this.logFileInitialized = true;
|
|
@@ -97,6 +100,37 @@ class Logger {
|
|
|
97
100
|
// Silently fail - cleanup is not critical
|
|
98
101
|
}
|
|
99
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Rotate log file if date has changed
|
|
105
|
+
* Handles long-running sessions that span midnight
|
|
106
|
+
* Non-blocking, fire-and-forget - failures fall back to continuing with old file
|
|
107
|
+
*/
|
|
108
|
+
async rotateLogFileIfNeeded() {
|
|
109
|
+
const today = new Date().toISOString().split('T')[0];
|
|
110
|
+
if (this.currentLogDate === today || this.isRotating) {
|
|
111
|
+
return; // No rotation needed or already rotating
|
|
112
|
+
}
|
|
113
|
+
this.isRotating = true;
|
|
114
|
+
try {
|
|
115
|
+
// Close old stream
|
|
116
|
+
if (this.writeStream) {
|
|
117
|
+
await new Promise((resolve) => {
|
|
118
|
+
this.writeStream.end(() => resolve());
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
// Reset and reinitialize
|
|
122
|
+
this.logFileInitialized = false;
|
|
123
|
+
this.writeStream = null;
|
|
124
|
+
this.currentLogDate = null;
|
|
125
|
+
this.initializeLogFile();
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
// Silently fail - continue using old file
|
|
129
|
+
}
|
|
130
|
+
finally {
|
|
131
|
+
this.isRotating = false;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
100
134
|
/**
|
|
101
135
|
* Write a log entry to the debug log file (synchronous)
|
|
102
136
|
* Format: [YYYY-MM-DD HH:MM:SS.mmm] [LEVEL] [AGENT] [SESSION_ID] [PROFILE] message
|
|
@@ -109,6 +143,14 @@ class Logger {
|
|
|
109
143
|
}
|
|
110
144
|
if (!this.writeStream)
|
|
111
145
|
return;
|
|
146
|
+
// Check if date changed (async rotation, non-blocking)
|
|
147
|
+
// Fire-and-forget - worst case we write a few entries to old file
|
|
148
|
+
const today = new Date().toISOString().split('T')[0];
|
|
149
|
+
if (this.currentLogDate && this.currentLogDate !== today && !this.isRotating) {
|
|
150
|
+
this.rotateLogFileIfNeeded().catch(() => {
|
|
151
|
+
// Silently fail - continue using old file
|
|
152
|
+
});
|
|
153
|
+
}
|
|
112
154
|
try {
|
|
113
155
|
const timestamp = new Date().toISOString();
|
|
114
156
|
// Build log prefix using agent/session/profile set at startup
|
package/dist/utils/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings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AAE,CAAC;gBACR,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;oBACzB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;oBACxC,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;wBACd,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;oBAC5C,CAAC;gBACL,CAAC;qBAAM,CAAC;oBACJ,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBAC5C,CAAC;YACL,CAAC;QACL,CAAC;IACH,CAAC;CACF;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codemieai/code",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.38",
|
|
4
4
|
"description": "Unified AI coding assistant CLI - Manage Claude Code, Gemini & custom agents. Multi-provider support (OpenAI, Azure, LiteLLM, SSO). Built-in LangGraph agent with file operations & git integration.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -1,325 +0,0 @@
|
|
|
1
|
-
# Add New Knowledge to Project Documentation
|
|
2
|
-
|
|
3
|
-
**Purpose**: Capture important learnings from the current session that should persist for future work.
|
|
4
|
-
|
|
5
|
-
**Context**: You manage persistent memory using documentation systems. Common approaches:
|
|
6
|
-
- **CLAUDE.md files** - Project-specific context loaded recursively from working directory
|
|
7
|
-
- **Structured guides** - Organized documentation by topic/category (if present)
|
|
8
|
-
- **README/docs** - Traditional documentation files
|
|
9
|
-
|
|
10
|
-
Projects may use any combination of these systems or none at all.
|
|
11
|
-
|
|
12
|
-
---
|
|
13
|
-
## Additional user's input
|
|
14
|
-
Additional context/input from user: $ARGUMENTS. Might be empty by default.
|
|
15
|
-
|
|
16
|
-
## When to Add Documentation
|
|
17
|
-
|
|
18
|
-
**✅ DO add documentation when**:
|
|
19
|
-
- You learned something **non-obvious** about the project
|
|
20
|
-
- User corrected a **pattern or approach** you used
|
|
21
|
-
- You struggled to find critical information that should be documented
|
|
22
|
-
- You discovered an important **architectural decision** or **gotcha**
|
|
23
|
-
- User provided context about "**why**" something is done a certain way
|
|
24
|
-
- You had to infer important details that aren't clear from code alone
|
|
25
|
-
- A pattern contradicts common conventions for this language/framework
|
|
26
|
-
|
|
27
|
-
**❌ DON'T add documentation when**:
|
|
28
|
-
- Information is **obvious from well-written code**
|
|
29
|
-
- It's a **one-time fix** or edge case
|
|
30
|
-
- It's **implementation details** that may change frequently
|
|
31
|
-
- User just made a **typo correction** or minor fix
|
|
32
|
-
- Information already exists in documentation
|
|
33
|
-
- It's **standard practice** (not project-specific)
|
|
34
|
-
|
|
35
|
-
**Rule of Thumb**: If you would struggle with this again in a future session without documentation, add it. If it's obvious or self-evident, skip it.
|
|
36
|
-
|
|
37
|
-
---
|
|
38
|
-
|
|
39
|
-
## Step 1: Identify What You Learned
|
|
40
|
-
|
|
41
|
-
Reflect on the session:
|
|
42
|
-
|
|
43
|
-
**Documentation Triggers**:
|
|
44
|
-
- [ ] I was corrected on an implementation pattern
|
|
45
|
-
- [ ] I learned about a project-specific convention
|
|
46
|
-
- [ ] I discovered non-obvious behavior or gotcha
|
|
47
|
-
- [ ] I struggled to locate important information
|
|
48
|
-
- [ ] I learned architectural decisions or "why" behind choices
|
|
49
|
-
- [ ] I found out about critical integration points
|
|
50
|
-
- [ ] I discovered error handling or security patterns
|
|
51
|
-
- [ ] I learned testing or tooling conventions
|
|
52
|
-
- [ ] I discovered how components interact
|
|
53
|
-
|
|
54
|
-
**What specifically did I learn?**
|
|
55
|
-
- Specific pattern: _____
|
|
56
|
-
- Why it matters: _____
|
|
57
|
-
- Where it applies: _____
|
|
58
|
-
|
|
59
|
-
---
|
|
60
|
-
|
|
61
|
-
## Step 2: Determine Scope
|
|
62
|
-
|
|
63
|
-
**Broad Knowledge** (affects multiple components or entire project):
|
|
64
|
-
- Architectural patterns
|
|
65
|
-
- Error handling conventions
|
|
66
|
-
- Logging patterns
|
|
67
|
-
- Security practices
|
|
68
|
-
- Testing strategies
|
|
69
|
-
- Code quality standards
|
|
70
|
-
- Build/deployment processes
|
|
71
|
-
|
|
72
|
-
→ Add to **project-wide documentation** (root CLAUDE.md, main docs, or broad guides)
|
|
73
|
-
|
|
74
|
-
**Specific Knowledge** (affects one component/module):
|
|
75
|
-
- Module-specific patterns
|
|
76
|
-
- Component integration details
|
|
77
|
-
- Directory-specific conventions
|
|
78
|
-
- Local gotchas or behaviors
|
|
79
|
-
|
|
80
|
-
→ Add to **component documentation** (component CLAUDE.md or specific doc section)
|
|
81
|
-
|
|
82
|
-
---
|
|
83
|
-
|
|
84
|
-
## Step 3: Find Documentation Location
|
|
85
|
-
|
|
86
|
-
**Discover existing documentation**:
|
|
87
|
-
```bash
|
|
88
|
-
# Find CLAUDE.md files
|
|
89
|
-
find . -name "CLAUDE.md" -not -path "*/node_modules/*" -not -path "*/.git/*"
|
|
90
|
-
|
|
91
|
-
# Check for documentation directories
|
|
92
|
-
ls -la docs/ documentation/ .claude/guides/ 2>/dev/null
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
**Decision Tree**:
|
|
96
|
-
|
|
97
|
-
```
|
|
98
|
-
Is knowledge broad/project-wide?
|
|
99
|
-
├─ YES → Add to root documentation
|
|
100
|
-
│ ├─ Root CLAUDE.md (if exists)
|
|
101
|
-
│ ├─ README.md or ARCHITECTURE.md
|
|
102
|
-
│ ├─ docs/ or documentation/ directory
|
|
103
|
-
│ └─ Create root CLAUDE.md if none exists
|
|
104
|
-
│
|
|
105
|
-
└─ NO (component-specific) → Add to component documentation
|
|
106
|
-
├─ Component CLAUDE.md (if exists)
|
|
107
|
-
├─ Component README.md
|
|
108
|
-
└─ Create component CLAUDE.md if appropriate
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
**Common Patterns**:
|
|
112
|
-
- **Root CLAUDE.md**: Project overview, architecture, main patterns
|
|
113
|
-
- **Component CLAUDE.md**: `src/[module]/CLAUDE.md`, `lib/[feature]/CLAUDE.md`
|
|
114
|
-
- **Structured docs**: `docs/architecture.md`, `docs/development.md`, etc.
|
|
115
|
-
- **README files**: High-level overview, setup, common patterns
|
|
116
|
-
|
|
117
|
-
---
|
|
118
|
-
|
|
119
|
-
## Step 4: Format the Knowledge
|
|
120
|
-
|
|
121
|
-
**For CLAUDE.md Files**:
|
|
122
|
-
|
|
123
|
-
```markdown
|
|
124
|
-
## [Topic Area or Module Name]
|
|
125
|
-
|
|
126
|
-
**[Specific Pattern/Knowledge]**:
|
|
127
|
-
- **What**: Brief description of the pattern/approach
|
|
128
|
-
- **Why**: Reason or context for this decision
|
|
129
|
-
- **Where**: Applicable locations or when to use it
|
|
130
|
-
- **Gotcha**: Non-obvious behavior (if any)
|
|
131
|
-
|
|
132
|
-
**Example** (if helpful):
|
|
133
|
-
```[language]
|
|
134
|
-
// Concise code example demonstrating pattern
|
|
135
|
-
```
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
**For Structured Documentation**:
|
|
139
|
-
|
|
140
|
-
```markdown
|
|
141
|
-
## [Pattern/Topic Name]
|
|
142
|
-
|
|
143
|
-
**Context**: When/why this pattern is used
|
|
144
|
-
|
|
145
|
-
**Pattern**:
|
|
146
|
-
[Description of the approach]
|
|
147
|
-
|
|
148
|
-
**Example**:
|
|
149
|
-
```[language]
|
|
150
|
-
// Code example demonstrating pattern
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
**Rationale**: Why we do it this way
|
|
154
|
-
|
|
155
|
-
**Common Pitfalls**: What to avoid
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
---
|
|
159
|
-
|
|
160
|
-
## Step 5: Add the Documentation
|
|
161
|
-
|
|
162
|
-
**For CLAUDE.md Files**:
|
|
163
|
-
1. Open or create the appropriate CLAUDE.md file
|
|
164
|
-
2. Find relevant section or create new heading
|
|
165
|
-
3. Add knowledge in structured format
|
|
166
|
-
4. Keep it concise and scannable
|
|
167
|
-
5. Include example only if pattern isn't obvious
|
|
168
|
-
|
|
169
|
-
**For Other Documentation**:
|
|
170
|
-
1. Locate the appropriate file (README, ARCHITECTURE, etc.)
|
|
171
|
-
2. Find relevant section or create one
|
|
172
|
-
3. Add information following existing format/style
|
|
173
|
-
4. Keep consistent with rest of document
|
|
174
|
-
5. Update table of contents if applicable
|
|
175
|
-
|
|
176
|
-
**Quality Checklist**:
|
|
177
|
-
- [ ] Clearly states what the pattern/knowledge is
|
|
178
|
-
- [ ] Explains why it matters (not just what)
|
|
179
|
-
- [ ] Specific enough to be actionable
|
|
180
|
-
- [ ] Concise (no unnecessary words)
|
|
181
|
-
- [ ] Example included if pattern is non-obvious
|
|
182
|
-
- [ ] Placed in most logical location
|
|
183
|
-
- [ ] Doesn't duplicate existing documentation
|
|
184
|
-
|
|
185
|
-
---
|
|
186
|
-
|
|
187
|
-
## Step 6: Cross-Reference (if applicable)
|
|
188
|
-
|
|
189
|
-
If knowledge spans multiple areas or files:
|
|
190
|
-
|
|
191
|
-
**In CLAUDE.md**:
|
|
192
|
-
```markdown
|
|
193
|
-
**Related Documentation**:
|
|
194
|
-
- See [ARCHITECTURE.md](./ARCHITECTURE.md) for system design
|
|
195
|
-
- See [src/auth/CLAUDE.md](./src/auth/CLAUDE.md) for auth patterns
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
**In structured docs**:
|
|
199
|
-
```markdown
|
|
200
|
-
**See also**:
|
|
201
|
-
- [Component Documentation](../component/CLAUDE.md)
|
|
202
|
-
- [Related Guide](./related-guide.md)
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
---
|
|
206
|
-
|
|
207
|
-
## Common Documentation Patterns
|
|
208
|
-
|
|
209
|
-
**Architectural Decisions**:
|
|
210
|
-
```markdown
|
|
211
|
-
## Architecture
|
|
212
|
-
|
|
213
|
-
**[Decision Name]**: We use [pattern/approach]
|
|
214
|
-
- **Rationale**: [Why this choice was made]
|
|
215
|
-
- **Trade-offs**: [What we gained/lost]
|
|
216
|
-
- **Alternative considered**: [What we didn't choose and why]
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
**Error Handling**:
|
|
220
|
-
```markdown
|
|
221
|
-
## Error Handling
|
|
222
|
-
|
|
223
|
-
- Use [specific error types/classes] for [scenario]
|
|
224
|
-
- Always [pattern] when [condition]
|
|
225
|
-
- Never [anti-pattern] because [reason]
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
**Testing Conventions**:
|
|
229
|
-
```markdown
|
|
230
|
-
## Testing
|
|
231
|
-
|
|
232
|
-
- Test files: [location pattern]
|
|
233
|
-
- Mocking: [approach and tools]
|
|
234
|
-
- Coverage: [requirements]
|
|
235
|
-
- Gotcha: [non-obvious testing behavior]
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
**Integration Points**:
|
|
239
|
-
```markdown
|
|
240
|
-
## [External Service/Component]
|
|
241
|
-
|
|
242
|
-
- **Authentication**: [method]
|
|
243
|
-
- **Configuration**: [where/how]
|
|
244
|
-
- **Error handling**: [approach]
|
|
245
|
-
- **Gotcha**: [non-obvious behavior]
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
---
|
|
249
|
-
|
|
250
|
-
## Examples (Generic, adapt to your project)
|
|
251
|
-
|
|
252
|
-
**Broad Pattern → Project Documentation**:
|
|
253
|
-
```
|
|
254
|
-
Learning: "Project uses custom error classes for each failure category"
|
|
255
|
-
Location: Root CLAUDE.md or docs/development.md
|
|
256
|
-
Section: Error Handling
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
**Component-Specific → Component Documentation**:
|
|
260
|
-
```
|
|
261
|
-
Learning: "Auth module requires initialization before any API calls"
|
|
262
|
-
Location: src/auth/CLAUDE.md
|
|
263
|
-
Section: Setup and Initialization
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
**Architectural → Architecture Documentation**:
|
|
267
|
-
```
|
|
268
|
-
Learning: "System uses event-driven architecture with message queue"
|
|
269
|
-
Location: ARCHITECTURE.md or root CLAUDE.md
|
|
270
|
-
Section: System Architecture
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
**Gotcha → Relevant Documentation**:
|
|
274
|
-
```
|
|
275
|
-
Learning: "Database connections must be manually closed in serverless"
|
|
276
|
-
Location: src/database/CLAUDE.md or docs/database.md
|
|
277
|
-
Section: Connection Management
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
---
|
|
281
|
-
|
|
282
|
-
## Common Pitfalls to Avoid
|
|
283
|
-
|
|
284
|
-
**❌ Don't**:
|
|
285
|
-
- Document what's obvious from code
|
|
286
|
-
- Add every minor detail or edge case
|
|
287
|
-
- Duplicate information across multiple files
|
|
288
|
-
- Include temporary workarounds or TODOs
|
|
289
|
-
- Write exhaustive implementation details
|
|
290
|
-
- Add information that changes frequently
|
|
291
|
-
- Over-document standard language features
|
|
292
|
-
|
|
293
|
-
**✅ Do**:
|
|
294
|
-
- Focus on "why" and "gotchas"
|
|
295
|
-
- Keep it concise and actionable
|
|
296
|
-
- Place in most specific applicable location
|
|
297
|
-
- Cross-reference related documentation
|
|
298
|
-
- Update existing docs rather than creating new files
|
|
299
|
-
- Validate information is still accurate before adding
|
|
300
|
-
- Document decisions and trade-offs
|
|
301
|
-
|
|
302
|
-
---
|
|
303
|
-
|
|
304
|
-
## Quick Decision Guide
|
|
305
|
-
|
|
306
|
-
**Question Flow**:
|
|
307
|
-
1. Is this **non-obvious** and **worth remembering**?
|
|
308
|
-
→ NO: Skip
|
|
309
|
-
2. Is it **broad/reusable** across components?
|
|
310
|
-
→ YES: Add to project-wide docs
|
|
311
|
-
3. Is it **component-specific**?
|
|
312
|
-
→ YES: Add to component docs
|
|
313
|
-
4. Does it **already exist** in documentation?
|
|
314
|
-
→ YES: Update if outdated, skip if accurate
|
|
315
|
-
5. Will I **struggle without** this in future sessions?
|
|
316
|
-
→ YES: Add it / NO: Skip
|
|
317
|
-
|
|
318
|
-
**File Selection**:
|
|
319
|
-
- **Project pattern** → Root CLAUDE.md, README, or main docs
|
|
320
|
-
- **Component behavior** → Component CLAUDE.md or README
|
|
321
|
-
- **Architecture** → ARCHITECTURE.md or root CLAUDE.md
|
|
322
|
-
- **Setup/workflow** → README.md or CONTRIBUTING.md
|
|
323
|
-
- **API patterns** → Relevant component or API docs
|
|
324
|
-
|
|
325
|
-
**Remember**: Less documentation that's accurate and maintained is better than comprehensive documentation that becomes stale. Focus on capturing **critical, non-obvious knowledge** that helps future work.
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# Initialize Memory Documentation for Directory
|
|
2
|
-
|
|
3
|
-
**Instructions:**
|
|
4
|
-
|
|
5
|
-
Focus on the specified directory $ARGUMENTS or the current working directory:
|
|
6
|
-
|
|
7
|
-
1. **Investigate Architecture**: Analyze the implementation principles and architecture of the code in this directory and its subdirectories. Look for:
|
|
8
|
-
- Design patterns being used
|
|
9
|
-
- Dependencies and their purposes
|
|
10
|
-
- Key abstractions and interfaces
|
|
11
|
-
- Naming conventions and code organization
|
|
12
|
-
|
|
13
|
-
2. **Create or Update Documentation**: Create a CLAUDE.md file capturing this knowledge. If one already exists, update it with newly discovered information. Include:
|
|
14
|
-
- Purpose and responsibility of this module
|
|
15
|
-
- Key architectural decisions
|
|
16
|
-
- Important implementation details
|
|
17
|
-
- Common patterns used throughout the code
|
|
18
|
-
- Any gotchas or non-obvious behaviors
|