Project Files
memory.md
Quick reference for future development sessions.
// OLD - verbose placeholders const PU = '\uE001'; generatePlaceholder() => `${PU}P${++counter}${PU}`; // "\uE001P1\uE001" = 7+ chars // NEW - compact single-char placeholders String.fromCodePoint(0xE000 + (counter++ % 0xFFF)); // "\uE000" = 2 chars
Why PUA?
\uE000ā\uEFFF reserved for private useMust come BEFORE synonym replacement phase! Otherwise "source" ā "src" corrupts paths.
Why CAPITAL? Only adds space before capital letters = new sentence starts. Preserves Node.js intact.
When appending to phrases.ts or synonyms.ts, verify file ends with:
Search before adding:
Clean rebuild when changes not reflected:
Cannot test builds directly ā user must manually run:
And post console output for verification.
Problem: Cannot find name 'console' after upgrading to TypeScript 6.x.
Root Cause: TypeScript 6.x has stricter type resolution. Node.js globals (console, process, etc.) are no longer implicitly available.
Fix: Add "types": ["node"] to tsconfig.json:
Dependencies:
typescript@^6.0.3@types/node@^22.19.19INSTALL THE PLUGIN INSTEAD OF RUNNING DEV
Install the plugin into LM Studio instead of running the dev server.
Source: https://lmstudio.ai/docs/cli/develop-and-publish/dev
'and': '&&' breaks natural language| Metric | Value |
|---|---|
| English Compression (Balanced) | ~30-50% reduction ā |
| German Compression (Balanced) | ~28-45% reduction ā |
| Placeholder Overhead Reduction | 71% less (7+ ā 2 chars) ā |
| Path Protection Accuracy | 100% ā |
Last Updated: May 17, 2026
// Protects Windows paths like C:\Source Code\...
text = text.replace(/([A-Za-z]:[\/\\][^<>"|?*\r\n]{10,})/g, (match) => {
return protectIfWorthwhile(match, 15);
});
// Sort phrases by length (longest first) to avoid partial matches
const sortedPhrases = Object.entries(this.phrasesAndLogic)
.filter(([phrase]) => phrase && phrase.length >= 2)
.sort((a, b) => b[0].length - a[0].length);
text = result
.replace(/\s+/g, ' ') // 1. Collapse spaces
.replace(/\s+([.,?!;:])/g, '$1') // 2. Remove space BEFORE punct
.replace/([.?!;:])(?=[A-ZĆĆĆĆ])/g, '$1 ') // 3. Add space AFTER (before CAPITAL)
.trim();
'last entry': 'value',
};
grep -n "partial_phrase" src/dictionaries/phrases.ts
'l'', 'un', 'une' // ā INVALID!
"l'", "un", "une" // ā
Valid
Remove-Item -Recurse -Force dist, node_modules\.cache
npm run build
npm run build && npm run dev
{
"compilerOptions": {
"types": ["node"]
}
}
lms dev --install
# Install plugin permanently
lms dev --install
# Clean rebuild (when caching issues occur)
Remove-Item -Recurse -Force dist, node_modules\.cache
npm run build
npm run dev
# Search for existing dictionary entries
grep -n "phrase" src/dictionaries/phrases.ts