refactor: Phase 3 architecture optimization#13
Merged
kevintseng merged 26 commits intomainfrom Apr 17, 2026
Merged
Conversation
Add localized README files for zh-TW, zh-CN, ja, ko, pt, fr, de, vi, es, and th. Update main README.md with language selector at the top of each file linking all versions together.
Adds a locale system (en, zh-TW, zh-CN, ja, ko, pt, fr, de, vi, es, th) to the Preact dashboard. Browser language is auto-detected on first load; selection persists to localStorage. A language selector is added to the Settings tab. All UI strings across Header, TabNav, SearchTab, BrowseTab, AnalyticsTab, and SettingsTab are replaced with t() calls.
…ution framing, user personas
Rewrote all translated READMEs to match the new English README structure: - Added "The Problem" emotional opening section - Added "Get Started in 60 Seconds" 3-step flow - Added "Who Is This For?" table - Added "Works With Everything" 3-column layout - Replaced old comparison table with focused Mem0/Zep comparison - Added "What Happens Automatically" hooks table - Added "Smart Features" section with emoji bullets - Added "Unlock Smart Mode" tiered table - Updated "All 6 Memory Tools" table format - Updated Contributing section to match English - Updated license footer to match English
- CI: add dashboard build step (cd dashboard && npm ci && npx vite build) - Smoke test: verify 27 required files (was 10) — core, transports, hooks, skills, dashboard - Installation test: verify plugin version match, skills exist, bin entries, dashboard build - Installation test: use execFileSync instead of execSync (security) - Publish workflow: add dashboard build before npm publish - 294 tests (was 289)
Introduces analyzeFailure() which deduplicates session errors (max 5), calls the configured LLM provider, and returns a StructuredLesson with error/rootCause/fix/prevention/errorPattern/fixPattern/severity. Exports parseLesson() for direct unit testing; always returns null on any failure path rather than throwing.
Creates createLesson/createExplicitLesson/findProjectLessons with
lesson-{project}-{errorPattern} naming for upsert dedup. Uses pre-call
recall check for reliable isNew detection (RememberResult.observations
is always the input count, not total stored). 12 tests, all passing.
Query lesson_learned entities tagged to the current project and append prevention hints to the session context, so Claude sees known pitfalls at session start before making the same mistakes.
Adds learn() to core operations (wraps createExplicitLesson from lesson-engine), LearnInput/LearnResult types, and learn tool across all 3 transports (MCP, HTTP, CLI). Includes 17 new tests covering core, MCP handler, and HTTP transport layers.
When LLM is configured (Level 1), the Stop hook now analyzes session errors via failure-analyzer and creates structured lesson_learned entities via lesson-engine. Falls back gracefully to rule-based extraction when no LLM is available. Adds 8 tests for session-summary hook covering: entity creation, bugfix tagging, skip guards, dedup, heavy sessions, and Level 0 fallback.
…ive warnings - Add failure-analyzer.ts and lesson-engine.ts to ARCHITECTURE.md - Add learn tool (7th MCP tool) to API_REFERENCE.md - Bump version to 3.1.0 in package.json and plugin.json - Add failure-analyzer.js and lesson-engine.js to smoke test required files
schema-export.ts was missing the learn tool definition, causing memesh export-schema to omit it from the output.
…LM config - GET /v1/config: detectCapabilities() returned raw API key in capabilities.llm.apiKey — now masked before response - POST /v1/config: updateConfig() shallow-merged top-level only, causing partial LLM updates to drop saved apiKey — now deep-merges the llm object to preserve existing fields Found by Codex (gpt-5.4) code review.
…rden HTTP server - Extract 8 Zod validation schemas from handlers.ts + server.ts into shared src/transports/schemas.ts (single source of truth) - Add maxLength/maxArraySize to all inputs: name(255), type(100), observations(10000 per, 100 max), tags(255 per, 50 max), etc. - Set explicit Express body limit (1MB) - Fix unhandled promise in dashboard fallback (.catch added) - Add LIMIT 50 to typeDistribution query in /v1/stats
…kg, and http Add EntityRow, CountRow, PragmaColumnRow, FtsRow and other typed interfaces to core/types.ts and use them in db.ts, knowledge-graph.ts, and transports/http/server.ts — eliminating 10 of 20 as-any casts on SQLite query results with zero behavior change.
Move consolidate() and compressObservations() into dedicated consolidator.ts module. Re-export consolidate from operations.ts to maintain backward compatibility with all transports.
Move exportMemories() and importMemories() into dedicated serializer.ts module. Re-export from operations.ts to maintain backward compatibility with all transports.
Add AnthropicResponse, OpenAIResponse, OllamaResponse interfaces to types.ts and use them in consolidator.ts, failure-analyzer.ts, and query-expander.ts instead of as any casts on response.json().
Comment on lines
+11
to
+14
| import { | ||
| RememberSchema, RecallSchema, ForgetSchema, ConsolidateSchema, | ||
| ExportSchema, ExportResultSchema, ImportSchema, LearnSchema, | ||
| } from '../schemas.js'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
operations.ts(501→236 lines) intoconsolidator.ts+serializer.tswith re-exports for backward compatgetEntitiesByIds) reduces search queries from 400+ to ~8 for limit=100as anycasts with typed interfaces (EntityRow,CountRow,AnthropicResponse, etc.)maxLength/maxArraySizelimits, 1MB body limitTest plan
tsc --noEmitcleannpm run buildcleanas anycount: 20 → 1