kimi-code-memory-mcp-server 0.1.0

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.
Files changed (74) hide show
  1. package/AGENTS.md +144 -0
  2. package/CHANGELOG.md +26 -0
  3. package/LICENSE +21 -0
  4. package/README.md +227 -0
  5. package/README.zh-CN.md +227 -0
  6. package/dist/config.d.ts +36 -0
  7. package/dist/config.js +63 -0
  8. package/dist/config.js.map +1 -0
  9. package/dist/context/wire-context.d.ts +171 -0
  10. package/dist/context/wire-context.js +586 -0
  11. package/dist/context/wire-context.js.map +1 -0
  12. package/dist/dao/index.d.ts +76 -0
  13. package/dist/dao/index.js +490 -0
  14. package/dist/dao/index.js.map +1 -0
  15. package/dist/dao/memory-store.d.ts +24 -0
  16. package/dist/dao/memory-store.js +112 -0
  17. package/dist/dao/memory-store.js.map +1 -0
  18. package/dist/refined-manager.d.ts +70 -0
  19. package/dist/refined-manager.js +369 -0
  20. package/dist/refined-manager.js.map +1 -0
  21. package/dist/server.d.ts +8 -0
  22. package/dist/server.js +71 -0
  23. package/dist/server.js.map +1 -0
  24. package/dist/theme-manager.d.ts +40 -0
  25. package/dist/theme-manager.js +88 -0
  26. package/dist/theme-manager.js.map +1 -0
  27. package/dist/tools/context-tools.d.ts +56 -0
  28. package/dist/tools/context-tools.js +332 -0
  29. package/dist/tools/context-tools.js.map +1 -0
  30. package/dist/tools/index.d.ts +835 -0
  31. package/dist/tools/index.js +370 -0
  32. package/dist/tools/index.js.map +1 -0
  33. package/dist/tools/memory-tools.d.ts +62 -0
  34. package/dist/tools/memory-tools.js +292 -0
  35. package/dist/tools/memory-tools.js.map +1 -0
  36. package/dist/tools/system-tools.d.ts +37 -0
  37. package/dist/tools/system-tools.js +195 -0
  38. package/dist/tools/system-tools.js.map +1 -0
  39. package/dist/tools/theme-tools.d.ts +34 -0
  40. package/dist/tools/theme-tools.js +186 -0
  41. package/dist/tools/theme-tools.js.map +1 -0
  42. package/dist/types.d.ts +93 -0
  43. package/dist/types.js +5 -0
  44. package/dist/types.js.map +1 -0
  45. package/dist/utils/frontmatter.d.ts +10 -0
  46. package/dist/utils/frontmatter.js +61 -0
  47. package/dist/utils/frontmatter.js.map +1 -0
  48. package/dist/utils/mutex.d.ts +11 -0
  49. package/dist/utils/mutex.js +17 -0
  50. package/dist/utils/mutex.js.map +1 -0
  51. package/dist/utils/paths.d.ts +19 -0
  52. package/dist/utils/paths.js +54 -0
  53. package/dist/utils/paths.js.map +1 -0
  54. package/dist/utils/validation.d.ts +15 -0
  55. package/dist/utils/validation.js +40 -0
  56. package/dist/utils/validation.js.map +1 -0
  57. package/dist/version.d.ts +9 -0
  58. package/dist/version.js +10 -0
  59. package/dist/version.js.map +1 -0
  60. package/docs/ARCHITECTURE.md +144 -0
  61. package/docs/CONTRIBUTING.md +83 -0
  62. package/docs/CONTRIBUTING.zh-CN.md +83 -0
  63. package/docs/search-logic.md +157 -0
  64. package/docs/search-logic.zh-CN.md +157 -0
  65. package/examples/README.md +34 -0
  66. package/examples/sample-workspace/essence/essence.md +26 -0
  67. package/examples/sample-workspace/index.json +36 -0
  68. package/examples/sample-workspace/memory/decisions/sample-decision.md +30 -0
  69. package/examples/sample-workspace/memory/knowledge/sample-knowledge.md +24 -0
  70. package/examples/sample-workspace/memory/reference/sample-reference.md +20 -0
  71. package/examples/sample-workspace/memory/rules/sample-rule.md +31 -0
  72. package/examples/sample-workspace/themes/cache-design.json +15 -0
  73. package/package.json +72 -0
  74. package/skills/memory-manage/SKILL.md +43 -0
@@ -0,0 +1,36 @@
1
+ {
2
+ "version": "3-kv",
3
+ "meta": {
4
+ "lastSyncAt": "2026-06-20T10:20:00.000Z",
5
+ "structureHash": "00000000000000000000000000000000"
6
+ },
7
+ "index": {
8
+ "memory/": { "comment": "Memory index" },
9
+ "memory/decisions/": { "comment": "Architecture and product decisions" },
10
+ "memory/decisions/choose-sqlite-cache.md": {
11
+ "title": "Choose SQLite for Cache Layer",
12
+ "tags": ["decision", "database", "cache"]
13
+ },
14
+ "memory/knowledge/": { "comment": "Project knowledge" },
15
+ "memory/knowledge/project-tech-stack.md": {
16
+ "title": "Project Tech Stack",
17
+ "tags": ["knowledge", "stack", "architecture"]
18
+ },
19
+ "memory/rules/": { "comment": "Conventions and guardrails" },
20
+ "memory/rules/no-plaintext-secrets.md": {
21
+ "title": "No Plaintext Secrets in Memory",
22
+ "tags": ["rule", "security", "workflow"]
23
+ },
24
+ "memory/reference/": { "comment": "External references" },
25
+ "memory/reference/mcp-spec.md": {
26
+ "title": "MCP Specification Reference",
27
+ "tags": ["reference", "mcp", "external"]
28
+ },
29
+ "essence/": { "comment": "Workspace essence" },
30
+ "essence/essence.md": {
31
+ "title": "Workspace Essence",
32
+ "tags": ["essence", "workspace-memory"]
33
+ },
34
+ "themes/": { "comment": "Theme associations" }
35
+ }
36
+ }
@@ -0,0 +1,30 @@
1
+ ---
2
+ key: 'choose-sqlite-cache'
3
+ title: 'Choose SQLite for Cache Layer'
4
+ tags:
5
+ - decision
6
+ - database
7
+ - cache
8
+ createdAt: '2026-06-20T10:00:00.000Z'
9
+ updatedAt: '2026-06-20T10:00:00.000Z'
10
+ ---
11
+
12
+ # Choose SQLite for Cache Layer
13
+
14
+ ## Decision
15
+
16
+ Use SQLite as the local cache layer instead of Redis or an in-memory store.
17
+
18
+ ## Rationale
19
+
20
+ - **Single-file deployment**: no separate service to run.
21
+ - **Sufficient for read-heavy workloads**: cache hits are mostly reads.
22
+ - **Familiar tooling**: most developers already know SQL.
23
+ - **No network latency**: local file access is fast enough for this scale.
24
+
25
+ ## Consequences
26
+
27
+ - Write-heavy bursts may become a bottleneck; monitor cache invalidation patterns.
28
+ - Backup strategy must include the SQLite file.
29
+
30
+ > 来源:memory/decisions/choose-sqlite-cache
@@ -0,0 +1,24 @@
1
+ ---
2
+ key: 'project-tech-stack'
3
+ title: 'Project Tech Stack'
4
+ tags:
5
+ - knowledge
6
+ - stack
7
+ - architecture
8
+ createdAt: '2026-06-20T10:05:00.000Z'
9
+ updatedAt: '2026-06-20T10:05:00.000Z'
10
+ ---
11
+
12
+ # Project Tech Stack
13
+
14
+ - **Runtime**: Node.js >= 18
15
+ - **Protocol**: Model Context Protocol (MCP) over stdio
16
+ - **Storage**: Markdown files + rebuildable JSON index
17
+ - **Linting**: ESLint + Prettier
18
+ - **Testing**: Node.js built-in `assert` + `@modelcontextprotocol/sdk` client
19
+
20
+ ## Notes
21
+
22
+ The server intentionally avoids external databases by default. Optional embedding or vector plugins may be added later as extensions.
23
+
24
+ > 来源:memory/knowledge/project-tech-stack
@@ -0,0 +1,20 @@
1
+ ---
2
+ key: 'mcp-spec'
3
+ title: 'MCP Specification Reference'
4
+ tags:
5
+ - reference
6
+ - mcp
7
+ - external
8
+ createdAt: '2026-06-20T10:15:00.000Z'
9
+ updatedAt: '2026-06-20T10:15:00.000Z'
10
+ ---
11
+
12
+ # MCP Specification Reference
13
+
14
+ - **URL**: https://modelcontextprotocol.io/
15
+ - **Type**: External reference
16
+ - **Relevance**: Defines the stdio transport and tool schema used by this server.
17
+
18
+ Keep this reference up to date when bumping `@modelcontextprotocol/sdk` versions.
19
+
20
+ > 来源:memory/reference/mcp-spec
@@ -0,0 +1,31 @@
1
+ ---
2
+ key: 'no-plaintext-secrets'
3
+ title: 'No Plaintext Secrets in Memory'
4
+ tags:
5
+ - rule
6
+ - security
7
+ - workflow
8
+ createdAt: '2026-06-20T10:10:00.000Z'
9
+ updatedAt: '2026-06-20T10:10:00.000Z'
10
+ ---
11
+
12
+ # No Plaintext Secrets in Memory
13
+
14
+ ## Rule
15
+
16
+ Never store API keys, passwords, tokens, or other secrets in `memory/` or `notes/`.
17
+
18
+ ## Scope
19
+
20
+ Applies to all memories written by agents or edited by users.
21
+
22
+ ## Why
23
+
24
+ Memories are stored as plain Markdown files and may be committed to git or shared across workspaces.
25
+
26
+ ## Enforcement
27
+
28
+ - Agents should reject `remember` calls that contain secret-like strings.
29
+ - Users should review memories before committing them to version control.
30
+
31
+ > 来源:memory/rules/no-plaintext-secrets
@@ -0,0 +1,15 @@
1
+ {
2
+ "theme": "cache-design",
3
+ "displayName": "Cache Design",
4
+ "createdAt": "2026-06-20T10:20:00.000Z",
5
+ "updatedAt": "2026-06-20T10:20:00.000Z",
6
+ "turns": [],
7
+ "memories": [
8
+ {
9
+ "key": "choose-sqlite-cache",
10
+ "folder": "memory/decisions",
11
+ "title": "Choose SQLite for Cache Layer",
12
+ "timestamp": "2026-06-20T10:00:00.000Z"
13
+ }
14
+ ]
15
+ }
package/package.json ADDED
@@ -0,0 +1,72 @@
1
+ {
2
+ "name": "kimi-code-memory-mcp-server",
3
+ "version": "0.1.0",
4
+ "description": "Local stdio MCP server providing cross-session memory for Kimi Code CLI",
5
+ "main": "dist/server.js",
6
+ "types": "dist/server.d.ts",
7
+ "type": "module",
8
+ "bin": {
9
+ "kimi-code-memory-mcp-server": "dist/server.js"
10
+ },
11
+ "files": [
12
+ "dist/",
13
+ "docs/",
14
+ "examples/",
15
+ "skills/",
16
+ "AGENTS.md",
17
+ "README.md",
18
+ "README.zh-CN.md",
19
+ "LICENSE",
20
+ "CHANGELOG.md"
21
+ ],
22
+ "scripts": {
23
+ "sync-version": "node scripts/sync-version.mjs",
24
+ "build": "npm run sync-version && tsc",
25
+ "dev": "tsx src/server.ts",
26
+ "start": "node dist/server.js",
27
+ "test": "tsx tests/test.ts",
28
+ "lint": "eslint src tests",
29
+ "lint:fix": "eslint src tests --fix",
30
+ "format": "prettier --write src tests",
31
+ "typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.tests.json"
32
+ },
33
+ "keywords": [
34
+ "mcp",
35
+ "memory",
36
+ "kimi",
37
+ "kimi-code",
38
+ "cli",
39
+ "kimi-memory",
40
+ "cross-session",
41
+ "markdown"
42
+ ],
43
+ "author": "Zehee <zehee@vip.qq.com>",
44
+ "license": "MIT",
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "git+https://github.com/Zehee/kimi-code-memory-mcp-server.git"
48
+ },
49
+ "bugs": {
50
+ "url": "https://github.com/Zehee/kimi-code-memory-mcp-server/issues"
51
+ },
52
+ "homepage": "https://github.com/Zehee/kimi-code-memory-mcp-server#readme",
53
+ "dependencies": {
54
+ "@modelcontextprotocol/sdk": "^1.0.0",
55
+ "@types/better-sqlite3": "^7.6.13",
56
+ "better-sqlite3": "^12.11.1"
57
+ },
58
+ "devDependencies": {
59
+ "@types/node": "^26.0.0",
60
+ "@typescript-eslint/eslint-plugin": "^8.62.0",
61
+ "@typescript-eslint/parser": "^8.62.0",
62
+ "eslint": "^8.57.0",
63
+ "eslint-config-prettier": "^9.1.0",
64
+ "prettier": "^3.2.5",
65
+ "ts-migrate": "^0.1.35",
66
+ "tsx": "^4.22.4",
67
+ "typescript": "^6.0.3"
68
+ },
69
+ "engines": {
70
+ "node": ">=18.0.0"
71
+ }
72
+ }
@@ -0,0 +1,43 @@
1
+ ---
2
+ name: memory-manage
3
+ description: 提示 agent 在用户表达记忆相关意图时调用 kimi-memory MCP 工具
4
+ type: prompt
5
+ whenToUse: >
6
+ 当用户表达以下任一意图时:
7
+ 1. "记住"、"记下来"、"保存决策/规则/知识"
8
+ 2. "删除"、"移除"、"清理" 某条记忆
9
+ 3. "列出"、"看看"、"有哪些" 记忆
10
+ 4. "查找"、"搜索" 记忆或上下文
11
+ 5. "恢复"、"加载"、"读取" 上次上下文或某条记忆
12
+ 6. "归档"、"移动" 记忆到另一个 folder
13
+ 7. "整理"、"重新组织"、"合并重复" 记忆
14
+ 8. "有哪些标签"
15
+ 9. "速记"、"便签"、"个人笔记"
16
+ 10. "主题"、"这个话题怎么发展的"、"回顾一下 xx"、"把这条记录关联到 xx 主题"、"有哪些主题"
17
+ ---
18
+
19
+ # 记忆工具调度提示
20
+
21
+ 本 Skill 是轻量提醒。当用户意图匹配上述任一情况时,调用对应的 `mcp__kimi-memory__*` 工具。
22
+
23
+ ## 快速映射
24
+
25
+ | 用户意图 | 工具 |
26
+ |----------|------|
27
+ | "记住…" / "保存…" | `mcp__kimi-memory__remember` |
28
+ | "读取…" / "看看…" | `mcp__kimi-memory__recall` |
29
+ | "搜索记忆…" | `mcp__kimi-memory__search` |
30
+ | "列出记忆/标签" | `mcp__kimi-memory__list` / `mcp__kimi-memory__list_tags` |
31
+ | "移动/归档…" | `mcp__kimi-memory__move` |
32
+ | "删除…" | `mcp__kimi-memory__delete` |
33
+ | "整理记忆" | `mcp__kimi-memory__organize_memories` |
34
+ | "同步索引" | `mcp__kimi-memory__sync_workspace_index` |
35
+ | "搜索历史对话" | `mcp__kimi-memory__search_context` |
36
+ | "加载第 N 轮" | `mcp__kimi-memory__load_turn_context` |
37
+ | "查看搜索视图" | `mcp__kimi-memory__list_search_views` |
38
+ | "关联到主题" | `mcp__kimi-memory__tag_theme` |
39
+ | "追溯主题" | `mcp__kimi-memory__trace_theme` |
40
+ | "列出主题" | `mcp__kimi-memory__list_themes` |
41
+ | "手动精炼轮次" | `mcp__kimi-memory__refine_session_turns` |
42
+
43
+ 行为规范(何时 remember、决策守卫、主题追溯协议)见 `AGENTS.md`。