@dollhousemcp/mcp-server 2.0.2 → 2.0.4
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/CHANGELOG.md +35 -0
- package/README.github.md +8 -33
- package/README.md +10 -8
- package/README.md.backup +10 -8
- package/README.npm.md +10 -8
- package/dist/constants/version.d.ts +3 -0
- package/dist/constants/version.d.ts.map +1 -0
- package/dist/constants/version.js +4 -0
- package/dist/generated/version.d.ts +2 -2
- package/dist/generated/version.js +3 -3
- package/dist/logging/sinks/SSELogSink.d.ts +35 -0
- package/dist/logging/sinks/SSELogSink.d.ts.map +1 -0
- package/dist/logging/sinks/SSELogSink.js +181 -0
- package/dist/logging/viewer/viewerHtml.d.ts +8 -0
- package/dist/logging/viewer/viewerHtml.d.ts.map +1 -0
- package/dist/logging/viewer/viewerHtml.js +204 -0
- package/dist/security/audit/config/suppressions.d.ts.map +1 -1
- package/dist/security/audit/config/suppressions.js +6 -1
- package/dist/seed-elements/memories/dollhousemcp-baseline-knowledge.yaml +149 -0
- package/dist/seed-elements/memories/how-to-create-custom-auto-load-memories.yaml +455 -0
- package/dist/seed-elements/memories/priority-best-practices-for-teams.yaml +542 -0
- package/dist/seed-elements/memories/token-estimation-guidelines.yaml +602 -0
- package/dist/web/public/app.js +29 -10
- package/dist/web/public/fonts/ibmplexmono--F63fjptAgt5VM-kVkqdyU8n1i8q131nj-o.woff2 +0 -0
- package/dist/web/public/fonts/ibmplexmono--F63fjptAgt5VM-kVkqdyU8n1iAq131nj-otFQ.woff2 +0 -0
- package/dist/web/public/fonts/ibmplexmono--F63fjptAgt5VM-kVkqdyU8n1iEq131nj-otFQ.woff2 +0 -0
- package/dist/web/public/fonts/ibmplexmono--F63fjptAgt5VM-kVkqdyU8n1iIq131nj-otFQ.woff2 +0 -0
- package/dist/web/public/fonts/ibmplexmono--F63fjptAgt5VM-kVkqdyU8n1isq131nj-otFQ.woff2 +0 -0
- package/dist/web/public/fonts/ibmplexmono--F6qfjptAgt5VM-kVkqdyU8n3twJwl1FgsAXHNlYzg.woff2 +0 -0
- package/dist/web/public/fonts/ibmplexmono--F6qfjptAgt5VM-kVkqdyU8n3twJwl5FgsAXHNlYzg.woff2 +0 -0
- package/dist/web/public/fonts/ibmplexmono--F6qfjptAgt5VM-kVkqdyU8n3twJwl9FgsAXHNlYzg.woff2 +0 -0
- package/dist/web/public/fonts/ibmplexmono--F6qfjptAgt5VM-kVkqdyU8n3twJwlBFgsAXHNk.woff2 +0 -0
- package/dist/web/public/fonts/ibmplexmono--F6qfjptAgt5VM-kVkqdyU8n3twJwlRFgsAXHNlYzg.woff2 +0 -0
- package/dist/web/public/fonts/manrope-xn7gYHE41ni1AdIRggOxSvfedN62Zw.woff2 +0 -0
- package/dist/web/public/fonts/manrope-xn7gYHE41ni1AdIRggSxSvfedN62Zw.woff2 +0 -0
- package/dist/web/public/fonts/manrope-xn7gYHE41ni1AdIRggexSvfedN4.woff2 +0 -0
- package/dist/web/public/fonts/manrope-xn7gYHE41ni1AdIRggixSvfedN62Zw.woff2 +0 -0
- package/dist/web/public/fonts/manrope-xn7gYHE41ni1AdIRggmxSvfedN62Zw.woff2 +0 -0
- package/dist/web/public/fonts/manrope-xn7gYHE41ni1AdIRggqxSvfedN62Zw.woff2 +0 -0
- package/dist/web/public/fonts/plusjakartasans-LDIoaomQNQcsA88c7O9yZ4KMCoOg4Ko20yygg_vb.woff2 +0 -0
- package/dist/web/public/fonts/plusjakartasans-LDIoaomQNQcsA88c7O9yZ4KMCoOg4Ko40yygg_vbd-E.woff2 +0 -0
- package/dist/web/public/fonts/plusjakartasans-LDIoaomQNQcsA88c7O9yZ4KMCoOg4Ko50yygg_vbd-E.woff2 +0 -0
- package/dist/web/public/fonts/plusjakartasans-LDIoaomQNQcsA88c7O9yZ4KMCoOg4Ko70yygg_vbd-E.woff2 +0 -0
- package/dist/web/public/fonts.css +270 -0
- package/dist/web/public/index.html +365 -0
- package/dist/web/public/logs.css +472 -0
- package/dist/web/public/metrics.css +238 -0
- package/dist/web/public/permissions.css +364 -0
- package/dist/web/public/sessions.css +235 -0
- package/dist/web/public/setup.css +648 -0
- package/dist/web/public/setup.js +752 -0
- package/dist/web/public/styles.css +1717 -0
- package/dist/web/routes/setupRoutes.d.ts +18 -0
- package/dist/web/routes/setupRoutes.d.ts.map +1 -0
- package/dist/web/routes/setupRoutes.js +360 -0
- package/dist/web/server.d.ts.map +1 -1
- package/dist/web/server.js +11 -1
- package/package.json +4 -1
- package/server.json +2 -2
|
@@ -0,0 +1,602 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: token-estimation-guidelines
|
|
3
|
+
type: memory
|
|
4
|
+
description: Guidelines for estimating and optimizing token usage in auto-load memories
|
|
5
|
+
version: 1.0.0
|
|
6
|
+
author: DollhouseMCP
|
|
7
|
+
category: documentation
|
|
8
|
+
tags:
|
|
9
|
+
- tokens
|
|
10
|
+
- optimization
|
|
11
|
+
- guidelines
|
|
12
|
+
- auto-load
|
|
13
|
+
- performance
|
|
14
|
+
triggers:
|
|
15
|
+
- token-estimation
|
|
16
|
+
- token-guidelines
|
|
17
|
+
- optimize-tokens
|
|
18
|
+
- token-budget
|
|
19
|
+
- token-usage
|
|
20
|
+
autoLoad: false
|
|
21
|
+
priority: 999
|
|
22
|
+
retention: permanent
|
|
23
|
+
privacyLevel: public
|
|
24
|
+
searchable: true
|
|
25
|
+
trustLevel: VALIDATED
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
# Token Estimation Guidelines for Auto-Load Memories
|
|
29
|
+
|
|
30
|
+
## Understanding Tokens
|
|
31
|
+
|
|
32
|
+
### What Are Tokens?
|
|
33
|
+
|
|
34
|
+
Tokens are the fundamental units that AI models process. Think of them as "word pieces":
|
|
35
|
+
|
|
36
|
+
- **1 token** ≈ 4 characters in English
|
|
37
|
+
- **1 token** ≈ 0.75 words (conservative estimate)
|
|
38
|
+
- **100 tokens** ≈ 75 words ≈ 1 paragraph
|
|
39
|
+
- **1,000 tokens** ≈ 750 words ≈ 1-2 pages
|
|
40
|
+
|
|
41
|
+
**Examples**:
|
|
42
|
+
```
|
|
43
|
+
"Hello, world!" = 4 tokens
|
|
44
|
+
"The quick brown fox jumps" = 5 tokens
|
|
45
|
+
"DollhouseMCP" = 3 tokens (Doll-house-MCP)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Why Tokens Matter for Auto-Load
|
|
49
|
+
|
|
50
|
+
Auto-load memories consume tokens at **every startup**:
|
|
51
|
+
|
|
52
|
+
- **Token Budget**: Default 5,000 tokens (~3,750 words)
|
|
53
|
+
- **Impact**: Larger memories = less room for other memories
|
|
54
|
+
- **Performance**: More tokens = longer startup time
|
|
55
|
+
- **Cost**: Some AI services charge per token
|
|
56
|
+
|
|
57
|
+
**Goal**: Maximize value per token.
|
|
58
|
+
|
|
59
|
+
## DollhouseMCP Estimation Method
|
|
60
|
+
|
|
61
|
+
### The Formula
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
estimatedTokens = Math.ceil(wordCount / 0.75)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**Conservative estimate**: 1 token per 0.75 words
|
|
68
|
+
|
|
69
|
+
### Example Calculation
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
Content: "The quick brown fox jumps over the lazy dog"
|
|
73
|
+
Word count: 9 words
|
|
74
|
+
Estimated tokens: 9 / 0.75 = 12 tokens
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Accuracy
|
|
78
|
+
|
|
79
|
+
- **Conservative**: Tends to overestimate slightly
|
|
80
|
+
- **English-optimized**: Best for English text
|
|
81
|
+
- **Code-aware**: May underestimate for code-heavy content
|
|
82
|
+
|
|
83
|
+
**Comparison to other estimators**:
|
|
84
|
+
- DollhouseMCP: 12 tokens (conservative)
|
|
85
|
+
- Actual (Claude): 10-11 tokens (varies by model)
|
|
86
|
+
- OpenAI tiktoken: 9-10 tokens
|
|
87
|
+
|
|
88
|
+
**Recommendation**: Use DollhouseMCP estimate for budgeting, actual usage will be slightly lower.
|
|
89
|
+
|
|
90
|
+
## Token Size Categories
|
|
91
|
+
|
|
92
|
+
### Micro (0-500 tokens)
|
|
93
|
+
|
|
94
|
+
**~0-375 words, ~0-0.5 pages**
|
|
95
|
+
|
|
96
|
+
**Best For**:
|
|
97
|
+
- Quick reference cards
|
|
98
|
+
- Cheat sheets
|
|
99
|
+
- Key definitions
|
|
100
|
+
- Contact lists
|
|
101
|
+
|
|
102
|
+
**Example**:
|
|
103
|
+
```yaml
|
|
104
|
+
name: team-contacts
|
|
105
|
+
tokens: 350
|
|
106
|
+
content: |
|
|
107
|
+
# Team Contacts
|
|
108
|
+
|
|
109
|
+
- PM: Jane (@jane)
|
|
110
|
+
- Tech Lead: Bob (@bob)
|
|
111
|
+
- DevOps: Alice (@alice)
|
|
112
|
+
|
|
113
|
+
## Escalation
|
|
114
|
+
1. Team Lead → Director → VP
|
|
115
|
+
2. After hours: On-call rotation (PagerDuty)
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Small (500-1,500 tokens)
|
|
119
|
+
|
|
120
|
+
**~375-1,125 words, ~0.5-1.5 pages**
|
|
121
|
+
|
|
122
|
+
**Best For**:
|
|
123
|
+
- Coding standards summaries
|
|
124
|
+
- API endpoint lists
|
|
125
|
+
- Configuration options
|
|
126
|
+
- Brief project overviews
|
|
127
|
+
|
|
128
|
+
**Example**:
|
|
129
|
+
```yaml
|
|
130
|
+
name: coding-standards
|
|
131
|
+
tokens: 1,200
|
|
132
|
+
content: |
|
|
133
|
+
# Coding Standards
|
|
134
|
+
|
|
135
|
+
## TypeScript
|
|
136
|
+
- Use strict mode
|
|
137
|
+
- No `any` types
|
|
138
|
+
- Prefer interfaces over types
|
|
139
|
+
|
|
140
|
+
## Testing
|
|
141
|
+
- Coverage >80%
|
|
142
|
+
- Jest for unit tests
|
|
143
|
+
- Playwright for E2E
|
|
144
|
+
|
|
145
|
+
## PR Process
|
|
146
|
+
1. Feature branch from main
|
|
147
|
+
2. Write tests first
|
|
148
|
+
3. Get 2 approvals
|
|
149
|
+
4. Squash merge
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Medium (1,500-5,000 tokens)
|
|
153
|
+
|
|
154
|
+
**~1,125-3,750 words, ~1.5-5 pages**
|
|
155
|
+
|
|
156
|
+
**Best For**:
|
|
157
|
+
- Project architecture overviews
|
|
158
|
+
- Domain knowledge primers
|
|
159
|
+
- Team onboarding guides
|
|
160
|
+
- Detailed API references
|
|
161
|
+
|
|
162
|
+
**Example**:
|
|
163
|
+
```yaml
|
|
164
|
+
name: project-architecture
|
|
165
|
+
tokens: 3,500
|
|
166
|
+
content: |
|
|
167
|
+
# Project Architecture
|
|
168
|
+
|
|
169
|
+
## System Overview
|
|
170
|
+
MyApp is a 3-tier web application...
|
|
171
|
+
|
|
172
|
+
## Components
|
|
173
|
+
### Frontend (React)
|
|
174
|
+
- User interface
|
|
175
|
+
- State management (Redux)
|
|
176
|
+
- API client
|
|
177
|
+
|
|
178
|
+
### Backend (Node.js)
|
|
179
|
+
- REST API (Express)
|
|
180
|
+
- Business logic
|
|
181
|
+
- Authentication (JWT)
|
|
182
|
+
|
|
183
|
+
### Database (PostgreSQL)
|
|
184
|
+
- User data
|
|
185
|
+
- Transaction logs
|
|
186
|
+
- Analytics
|
|
187
|
+
|
|
188
|
+
## Deployment
|
|
189
|
+
- Dev: AWS ECS (fargate)
|
|
190
|
+
- Staging: AWS ECS (fargate)
|
|
191
|
+
- Prod: AWS ECS (EC2 reserved)
|
|
192
|
+
|
|
193
|
+
[... detailed sections ...]
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Large (5,000-10,000 tokens)
|
|
197
|
+
|
|
198
|
+
**~3,750-7,500 words, ~5-10 pages**
|
|
199
|
+
|
|
200
|
+
**Best For**:
|
|
201
|
+
- Comprehensive documentation
|
|
202
|
+
- Extensive domain knowledge
|
|
203
|
+
- Multi-project context
|
|
204
|
+
|
|
205
|
+
**Warning**: May trigger warnings, consider splitting.
|
|
206
|
+
|
|
207
|
+
**Example**:
|
|
208
|
+
```yaml
|
|
209
|
+
name: healthcare-domain-knowledge
|
|
210
|
+
tokens: 7,800
|
|
211
|
+
content: |
|
|
212
|
+
# Healthcare Domain Knowledge
|
|
213
|
+
|
|
214
|
+
## Medical Terminology
|
|
215
|
+
[Extensive glossary...]
|
|
216
|
+
|
|
217
|
+
## Regulatory Compliance
|
|
218
|
+
[HIPAA, GDPR, etc...]
|
|
219
|
+
|
|
220
|
+
## Clinical Workflows
|
|
221
|
+
[Patient intake, treatment, discharge...]
|
|
222
|
+
|
|
223
|
+
## Coding Systems
|
|
224
|
+
[ICD-10, CPT, SNOMED...]
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Very Large (10,000+ tokens)
|
|
228
|
+
|
|
229
|
+
**~7,500+ words, ~10+ pages**
|
|
230
|
+
|
|
231
|
+
**Not Recommended for Auto-Load**
|
|
232
|
+
|
|
233
|
+
**Why**:
|
|
234
|
+
- Exceeds default budget alone
|
|
235
|
+
- Slows startup significantly
|
|
236
|
+
- Likely contains unnecessary detail
|
|
237
|
+
|
|
238
|
+
**Solution**: Split into focused memories or use on-demand loading.
|
|
239
|
+
|
|
240
|
+
## Optimization Strategies
|
|
241
|
+
|
|
242
|
+
### Strategy 1: Use Bullet Points
|
|
243
|
+
|
|
244
|
+
**Before** (verbose):
|
|
245
|
+
```
|
|
246
|
+
The application uses a three-tier architecture. The frontend is
|
|
247
|
+
implemented using React and handles all user interactions. The
|
|
248
|
+
backend is built with Node.js and Express and provides a REST API
|
|
249
|
+
for the frontend to consume. The database layer uses PostgreSQL
|
|
250
|
+
to store persistent data.
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
**Tokens**: ~60
|
|
254
|
+
|
|
255
|
+
**After** (bullet points):
|
|
256
|
+
```
|
|
257
|
+
Architecture:
|
|
258
|
+
- Frontend: React (user interface)
|
|
259
|
+
- Backend: Node.js + Express (REST API)
|
|
260
|
+
- Database: PostgreSQL (persistent storage)
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
**Tokens**: ~30 (50% reduction)
|
|
264
|
+
|
|
265
|
+
### Strategy 2: Remove Examples
|
|
266
|
+
|
|
267
|
+
**Before**:
|
|
268
|
+
```
|
|
269
|
+
Use TypeScript strict mode.
|
|
270
|
+
|
|
271
|
+
Bad:
|
|
272
|
+
function add(a, b) { return a + b; }
|
|
273
|
+
|
|
274
|
+
Good:
|
|
275
|
+
function add(a: number, b: number): number { return a + b; }
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
**Tokens**: ~40
|
|
279
|
+
|
|
280
|
+
**After**:
|
|
281
|
+
```
|
|
282
|
+
Use TypeScript strict mode (type all parameters and returns).
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
**Tokens**: ~12 (70% reduction)
|
|
286
|
+
|
|
287
|
+
### Strategy 3: Link Instead of Embed
|
|
288
|
+
|
|
289
|
+
**Before**:
|
|
290
|
+
```
|
|
291
|
+
[Paste entire API documentation - 5,000 tokens]
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
**After**:
|
|
295
|
+
```
|
|
296
|
+
API Docs: https://docs.company.com/api
|
|
297
|
+
|
|
298
|
+
Quick Reference:
|
|
299
|
+
- GET /users - List users
|
|
300
|
+
- POST /users - Create user
|
|
301
|
+
- PUT /users/:id - Update user
|
|
302
|
+
- DELETE /users/:id - Delete user
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
**Tokens**: ~50 (99% reduction)
|
|
306
|
+
|
|
307
|
+
### Strategy 4: Use Abbreviations
|
|
308
|
+
|
|
309
|
+
**Before**:
|
|
310
|
+
```
|
|
311
|
+
The application programming interface endpoint for creating
|
|
312
|
+
a new user account requires authentication via JSON Web Token
|
|
313
|
+
in the Authorization header following the Bearer authentication
|
|
314
|
+
scheme.
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
**Tokens**: ~40
|
|
318
|
+
|
|
319
|
+
**After**:
|
|
320
|
+
```
|
|
321
|
+
User creation API endpoint requires JWT Bearer auth in Authorization header.
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
**Tokens**: ~15 (62% reduction)
|
|
325
|
+
|
|
326
|
+
### Strategy 5: Remove Redundancy
|
|
327
|
+
|
|
328
|
+
**Before**:
|
|
329
|
+
```
|
|
330
|
+
The frontend uses React. React is a JavaScript library for
|
|
331
|
+
building user interfaces. We chose React because it's popular
|
|
332
|
+
and has a large ecosystem of libraries and tools.
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
**Tokens**: ~35
|
|
336
|
+
|
|
337
|
+
**After**:
|
|
338
|
+
```
|
|
339
|
+
Frontend: React (popular, large ecosystem)
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
**Tokens**: ~8 (77% reduction)
|
|
343
|
+
|
|
344
|
+
### Strategy 6: Structured Lists Instead of Prose
|
|
345
|
+
|
|
346
|
+
**Before**:
|
|
347
|
+
```
|
|
348
|
+
Our deployment process starts with creating a feature branch,
|
|
349
|
+
then you write your code and tests, after that you open a pull
|
|
350
|
+
request and get two approvals, and finally you merge to main
|
|
351
|
+
which triggers automatic deployment to staging and then after
|
|
352
|
+
QA approval it goes to production.
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
**Tokens**: ~60
|
|
356
|
+
|
|
357
|
+
**After**:
|
|
358
|
+
```
|
|
359
|
+
Deployment:
|
|
360
|
+
1. Create feature branch
|
|
361
|
+
2. Write code + tests
|
|
362
|
+
3. Open PR (2 approvals required)
|
|
363
|
+
4. Merge → staging (auto)
|
|
364
|
+
5. QA approval → production
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
**Tokens**: ~30 (50% reduction)
|
|
368
|
+
|
|
369
|
+
## Token Budgeting
|
|
370
|
+
|
|
371
|
+
### Default Budget (5,000 tokens)
|
|
372
|
+
|
|
373
|
+
**Recommended Distribution**:
|
|
374
|
+
|
|
375
|
+
```yaml
|
|
376
|
+
# System baseline (1,000 tokens)
|
|
377
|
+
dollhousemcp-baseline-knowledge: 1,000
|
|
378
|
+
|
|
379
|
+
# Organizational context (1,500 tokens)
|
|
380
|
+
company-coding-standards: 800
|
|
381
|
+
security-policies: 700
|
|
382
|
+
|
|
383
|
+
# Team context (1,500 tokens)
|
|
384
|
+
team-patterns: 1,000
|
|
385
|
+
domain-knowledge: 500
|
|
386
|
+
|
|
387
|
+
# Project context (1,000 tokens)
|
|
388
|
+
project-architecture: 600
|
|
389
|
+
current-sprint: 400
|
|
390
|
+
|
|
391
|
+
# Total: 5,000 tokens
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
### Expanded Budget (10,000 tokens)
|
|
395
|
+
|
|
396
|
+
For larger teams or complex projects:
|
|
397
|
+
|
|
398
|
+
```yaml
|
|
399
|
+
autoLoad:
|
|
400
|
+
maxTokenBudget: 10000
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
**Recommended Distribution**:
|
|
404
|
+
|
|
405
|
+
```yaml
|
|
406
|
+
# System (1,000)
|
|
407
|
+
dollhousemcp-baseline-knowledge: 1,000
|
|
408
|
+
|
|
409
|
+
# Organizational (2,500)
|
|
410
|
+
company-standards: 1,200
|
|
411
|
+
security-compliance: 800
|
|
412
|
+
architecture-principles: 500
|
|
413
|
+
|
|
414
|
+
# Team (3,500)
|
|
415
|
+
team-patterns: 1,500
|
|
416
|
+
domain-knowledge: 1,000
|
|
417
|
+
api-conventions: 1,000
|
|
418
|
+
|
|
419
|
+
# Project (2,500)
|
|
420
|
+
project-architecture: 1,500
|
|
421
|
+
current-sprint: 600
|
|
422
|
+
recent-decisions: 400
|
|
423
|
+
|
|
424
|
+
# Reference (500)
|
|
425
|
+
error-codes: 300
|
|
426
|
+
common-commands: 200
|
|
427
|
+
|
|
428
|
+
# Total: 10,000 tokens
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
### Aggressive Budget (15,000+ tokens)
|
|
432
|
+
|
|
433
|
+
**Warning**: May impact startup performance.
|
|
434
|
+
|
|
435
|
+
**Use Cases**:
|
|
436
|
+
- Highly specialized domains (medical, legal, financial)
|
|
437
|
+
- Large enterprise with complex context
|
|
438
|
+
- Documentation-heavy projects
|
|
439
|
+
|
|
440
|
+
**Recommendation**: Monitor startup time, consider splitting into multiple smaller memories instead.
|
|
441
|
+
|
|
442
|
+
## Measuring Token Usage
|
|
443
|
+
|
|
444
|
+
### Method 1: Validation Command
|
|
445
|
+
|
|
446
|
+
```bash
|
|
447
|
+
dollhouse validate memory my-memory
|
|
448
|
+
|
|
449
|
+
# Output includes:
|
|
450
|
+
# "Estimated tokens: 1,234"
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
### Method 2: Startup Logs
|
|
454
|
+
|
|
455
|
+
```bash
|
|
456
|
+
# Look for auto-load summary in logs:
|
|
457
|
+
# "[ServerStartup] Auto-load complete: 5 memories loaded (~3,200 tokens)"
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
### Method 3: Bulk Analysis
|
|
461
|
+
|
|
462
|
+
```bash
|
|
463
|
+
# Get token counts for all auto-load memories
|
|
464
|
+
for memory in $(dollhouse list memories --filter autoLoad=true --json | jq -r '.[].name'); do
|
|
465
|
+
echo "Memory: $memory"
|
|
466
|
+
dollhouse validate memory "$memory" | grep "Estimated tokens"
|
|
467
|
+
done
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
### Method 4: Configuration Review
|
|
471
|
+
|
|
472
|
+
```bash
|
|
473
|
+
# Check current budget
|
|
474
|
+
dollhouse config show autoLoad.maxTokenBudget
|
|
475
|
+
|
|
476
|
+
# Check budget utilization
|
|
477
|
+
dollhouse config show autoLoad | grep -E "(maxTokenBudget|totalLoaded)"
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
## Performance Impact
|
|
481
|
+
|
|
482
|
+
### Startup Time
|
|
483
|
+
|
|
484
|
+
Token count affects startup time:
|
|
485
|
+
|
|
486
|
+
- **1,000 tokens**: +5ms
|
|
487
|
+
- **5,000 tokens**: +25ms (default)
|
|
488
|
+
- **10,000 tokens**: +50ms
|
|
489
|
+
- **20,000 tokens**: +100ms (not recommended)
|
|
490
|
+
|
|
491
|
+
**Guideline**: Keep total under 10,000 tokens for fast startup.
|
|
492
|
+
|
|
493
|
+
### Memory Usage
|
|
494
|
+
|
|
495
|
+
Each token consumes ~4 bytes in memory:
|
|
496
|
+
|
|
497
|
+
- **5,000 tokens**: ~20 KB
|
|
498
|
+
- **10,000 tokens**: ~40 KB
|
|
499
|
+
- **50,000 tokens**: ~200 KB
|
|
500
|
+
|
|
501
|
+
**Guideline**: Memory usage is negligible for typical budgets.
|
|
502
|
+
|
|
503
|
+
### Cost Impact (for paid AI services)
|
|
504
|
+
|
|
505
|
+
Some AI services charge per token:
|
|
506
|
+
|
|
507
|
+
- **Claude**: $0.015 per 1K tokens (input)
|
|
508
|
+
- **GPT-4**: $0.03 per 1K tokens (input)
|
|
509
|
+
|
|
510
|
+
**Example**:
|
|
511
|
+
- 5,000 tokens per startup
|
|
512
|
+
- 100 startups per day
|
|
513
|
+
- 500,000 tokens per day
|
|
514
|
+
- Claude cost: $7.50/day = $225/month
|
|
515
|
+
|
|
516
|
+
**Guideline**: For high-frequency usage, optimize aggressively.
|
|
517
|
+
|
|
518
|
+
## Troubleshooting
|
|
519
|
+
|
|
520
|
+
### Issue 1: Budget Exceeded
|
|
521
|
+
|
|
522
|
+
**Symptom**: "Token budget reached, loaded X memories, skipping remaining Y"
|
|
523
|
+
|
|
524
|
+
**Diagnosis**:
|
|
525
|
+
```bash
|
|
526
|
+
# List auto-load memories with estimates
|
|
527
|
+
dollhouse list memories --filter autoLoad=true --format detailed
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
**Solutions**:
|
|
531
|
+
1. Increase budget: `autoLoad.maxTokenBudget: 10000`
|
|
532
|
+
2. Optimize large memories (see optimization strategies)
|
|
533
|
+
3. Reduce priority of less-important memories
|
|
534
|
+
4. Remove rarely-used memories from auto-load
|
|
535
|
+
|
|
536
|
+
### Issue 2: Memory Too Large Warning
|
|
537
|
+
|
|
538
|
+
**Symptom**: "Memory 'xyz' is very large (~12,000 tokens)"
|
|
539
|
+
|
|
540
|
+
**Diagnosis**:
|
|
541
|
+
```bash
|
|
542
|
+
# Validate specific memory
|
|
543
|
+
dollhouse validate memory xyz
|
|
544
|
+
|
|
545
|
+
# Check word count
|
|
546
|
+
wc -w ~/.dollhouse/portfolio/memories/xyz.yaml
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
**Solutions**:
|
|
550
|
+
1. Split into multiple focused memories
|
|
551
|
+
2. Remove verbose examples
|
|
552
|
+
3. Link to external docs instead of embedding
|
|
553
|
+
4. Use bullet points instead of paragraphs
|
|
554
|
+
5. Set `maxSingleMemoryTokens` limit
|
|
555
|
+
|
|
556
|
+
### Issue 3: Slow Startup
|
|
557
|
+
|
|
558
|
+
**Symptom**: Startup takes >500ms
|
|
559
|
+
|
|
560
|
+
**Diagnosis**:
|
|
561
|
+
```bash
|
|
562
|
+
# Check total tokens loaded
|
|
563
|
+
# Look in logs: "[ServerStartup] Auto-load complete: ... (~X tokens)"
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
**Solutions**:
|
|
567
|
+
1. Reduce total token budget
|
|
568
|
+
2. Optimize memories (target 60-80% budget utilization)
|
|
569
|
+
3. Remove auto-load flag from rarely-used memories
|
|
570
|
+
4. Consider caching (already implemented in v1.9.25+)
|
|
571
|
+
|
|
572
|
+
## Quick Reference
|
|
573
|
+
|
|
574
|
+
| Size | Tokens | Words | Pages | Best For |
|
|
575
|
+
|------|--------|-------|-------|----------|
|
|
576
|
+
| Micro | 0-500 | 0-375 | 0-0.5 | Quick reference, contact lists |
|
|
577
|
+
| Small | 500-1.5K | 375-1.1K | 0.5-1.5 | Standards summary, API lists |
|
|
578
|
+
| Medium | 1.5K-5K | 1.1K-3.8K | 1.5-5 | Architecture, domain knowledge |
|
|
579
|
+
| Large | 5K-10K | 3.8K-7.5K | 5-10 | Comprehensive docs (split recommended) |
|
|
580
|
+
| Very Large | 10K+ | 7.5K+ | 10+ | Not recommended for auto-load |
|
|
581
|
+
|
|
582
|
+
## Token Optimization Checklist
|
|
583
|
+
|
|
584
|
+
- [ ] Use bullet points instead of paragraphs
|
|
585
|
+
- [ ] Remove verbose examples (link to docs instead)
|
|
586
|
+
- [ ] Abbreviate common terms (API, JWT, DB, etc.)
|
|
587
|
+
- [ ] Use structured lists for processes
|
|
588
|
+
- [ ] Remove redundant explanations
|
|
589
|
+
- [ ] Link to external docs for details
|
|
590
|
+
- [ ] Use tables for comparisons
|
|
591
|
+
- [ ] Remove "filler" words (the, a, an, that, which)
|
|
592
|
+
- [ ] Target 60-80% budget utilization
|
|
593
|
+
- [ ] Review and optimize quarterly
|
|
594
|
+
|
|
595
|
+
## Related Documentation
|
|
596
|
+
|
|
597
|
+
- [How to Create Custom Auto-Load Memories](./how-to-create-custom-auto-load-memories.yaml)
|
|
598
|
+
- [Priority Best Practices for Teams](./priority-best-practices-for-teams.yaml)
|
|
599
|
+
|
|
600
|
+
---
|
|
601
|
+
|
|
602
|
+
**Last Updated**: v1.9.25 (October 2025)
|
package/dist/web/public/app.js
CHANGED
|
@@ -1922,6 +1922,33 @@ function safeParseYaml(content) {
|
|
|
1922
1922
|
const consoleTabs = document.getElementById('console-tabs');
|
|
1923
1923
|
const tabInits = { logs: false, metrics: false, permissions: false };
|
|
1924
1924
|
|
|
1925
|
+
const TAB_KEY = 'dollhousemcp-active-tab';
|
|
1926
|
+
const SETUP_SEEN_KEY = 'dollhousemcp-setup-seen';
|
|
1927
|
+
|
|
1928
|
+
// Determine which tab to show on load:
|
|
1929
|
+
// 1. Saved tab from last visit (localStorage)
|
|
1930
|
+
// 2. Setup tab on first-ever visit
|
|
1931
|
+
// 3. Portfolio (HTML default)
|
|
1932
|
+
const switchToTab = (tabName) => {
|
|
1933
|
+
if (!consoleTabs) return;
|
|
1934
|
+
const btn = consoleTabs.querySelector(`[data-tab="${tabName}"]`);
|
|
1935
|
+
if (!btn) return;
|
|
1936
|
+
consoleTabs.querySelectorAll('.console-tab').forEach(b => b.classList.remove('active'));
|
|
1937
|
+
btn.classList.add('active');
|
|
1938
|
+
document.querySelectorAll('.tab-panel').forEach(p => {
|
|
1939
|
+
p.hidden = p.id !== 'tab-' + tabName;
|
|
1940
|
+
p.classList.toggle('active', p.id === 'tab-' + tabName);
|
|
1941
|
+
});
|
|
1942
|
+
};
|
|
1943
|
+
|
|
1944
|
+
const savedTab = localStorage.getItem(TAB_KEY);
|
|
1945
|
+
if (savedTab) {
|
|
1946
|
+
switchToTab(savedTab);
|
|
1947
|
+
} else if (!localStorage.getItem(SETUP_SEEN_KEY)) {
|
|
1948
|
+
localStorage.setItem(SETUP_SEEN_KEY, '1');
|
|
1949
|
+
switchToTab('setup');
|
|
1950
|
+
}
|
|
1951
|
+
|
|
1925
1952
|
if (consoleTabs) {
|
|
1926
1953
|
consoleTabs.addEventListener('click', (e) => {
|
|
1927
1954
|
const btn = e.target.closest('.console-tab');
|
|
@@ -1929,16 +1956,8 @@ function safeParseYaml(content) {
|
|
|
1929
1956
|
const tab = btn.dataset.tab;
|
|
1930
1957
|
if (!tab) return;
|
|
1931
1958
|
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
btn.classList.add('active');
|
|
1935
|
-
|
|
1936
|
-
// Show/hide panels
|
|
1937
|
-
document.querySelectorAll('.tab-panel').forEach(p => {
|
|
1938
|
-
p.hidden = p.id !== 'tab-' + tab;
|
|
1939
|
-
if (p.id === 'tab-' + tab) p.classList.add('active');
|
|
1940
|
-
else p.classList.remove('active');
|
|
1941
|
-
});
|
|
1959
|
+
switchToTab(tab);
|
|
1960
|
+
localStorage.setItem(TAB_KEY, tab);
|
|
1942
1961
|
|
|
1943
1962
|
lazyInitTab(tab, tabInits);
|
|
1944
1963
|
});
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/web/public/fonts/plusjakartasans-LDIoaomQNQcsA88c7O9yZ4KMCoOg4Ko40yygg_vbd-E.woff2
ADDED
|
Binary file
|