kratos-mcp 4.0.0 โ†’ 4.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 (109) hide show
  1. package/README.md +177 -329
  2. package/bin/kratos-mcp +11 -9
  3. package/dist/cli/capture-handler.d.ts +13 -0
  4. package/dist/cli/capture-handler.d.ts.map +1 -0
  5. package/dist/cli/capture-handler.js +112 -0
  6. package/dist/cli/capture-handler.js.map +1 -0
  7. package/dist/cli/commands/ask.d.ts +5 -0
  8. package/dist/cli/commands/ask.d.ts.map +1 -0
  9. package/dist/cli/commands/ask.js +64 -0
  10. package/dist/cli/commands/ask.js.map +1 -0
  11. package/dist/cli/commands/capture.d.ts +5 -0
  12. package/dist/cli/commands/capture.d.ts.map +1 -0
  13. package/dist/cli/commands/capture.js +31 -0
  14. package/dist/cli/commands/capture.js.map +1 -0
  15. package/dist/cli/commands/forget.d.ts +3 -0
  16. package/dist/cli/commands/forget.d.ts.map +1 -0
  17. package/dist/cli/commands/forget.js +12 -0
  18. package/dist/cli/commands/forget.js.map +1 -0
  19. package/dist/cli/commands/get.d.ts +3 -0
  20. package/dist/cli/commands/get.d.ts.map +1 -0
  21. package/dist/cli/commands/get.js +28 -0
  22. package/dist/cli/commands/get.js.map +1 -0
  23. package/dist/cli/commands/hooks.d.ts +2 -0
  24. package/dist/cli/commands/hooks.d.ts.map +1 -0
  25. package/dist/cli/commands/hooks.js +136 -0
  26. package/dist/cli/commands/hooks.js.map +1 -0
  27. package/dist/cli/commands/migrate.d.ts +5 -0
  28. package/dist/cli/commands/migrate.d.ts.map +1 -0
  29. package/dist/cli/commands/migrate.js +56 -0
  30. package/dist/cli/commands/migrate.js.map +1 -0
  31. package/dist/cli/commands/recent.d.ts +6 -0
  32. package/dist/cli/commands/recent.d.ts.map +1 -0
  33. package/dist/cli/commands/recent.js +21 -0
  34. package/dist/cli/commands/recent.js.map +1 -0
  35. package/dist/cli/commands/save.d.ts +8 -0
  36. package/dist/cli/commands/save.d.ts.map +1 -0
  37. package/dist/cli/commands/save.js +31 -0
  38. package/dist/cli/commands/save.js.map +1 -0
  39. package/dist/cli/commands/scan.d.ts +5 -0
  40. package/dist/cli/commands/scan.d.ts.map +1 -0
  41. package/dist/cli/commands/scan.js +28 -0
  42. package/dist/cli/commands/scan.js.map +1 -0
  43. package/dist/cli/commands/search.d.ts +8 -0
  44. package/dist/cli/commands/search.d.ts.map +1 -0
  45. package/dist/cli/commands/search.js +45 -0
  46. package/dist/cli/commands/search.js.map +1 -0
  47. package/dist/cli/commands/status.d.ts +3 -0
  48. package/dist/cli/commands/status.d.ts.map +1 -0
  49. package/dist/cli/commands/status.js +89 -0
  50. package/dist/cli/commands/status.js.map +1 -0
  51. package/dist/cli/commands/switch.d.ts +3 -0
  52. package/dist/cli/commands/switch.d.ts.map +1 -0
  53. package/dist/cli/commands/switch.js +18 -0
  54. package/dist/cli/commands/switch.js.map +1 -0
  55. package/dist/cli/core.d.ts +15 -0
  56. package/dist/cli/core.d.ts.map +1 -0
  57. package/dist/cli/core.js +18 -0
  58. package/dist/cli/core.js.map +1 -0
  59. package/dist/cli/index.d.ts +3 -0
  60. package/dist/cli/index.d.ts.map +1 -0
  61. package/dist/cli/index.js +176 -0
  62. package/dist/cli/index.js.map +1 -0
  63. package/dist/cli/output.d.ts +22 -0
  64. package/dist/cli/output.d.ts.map +1 -0
  65. package/dist/cli/output.js +74 -0
  66. package/dist/cli/output.js.map +1 -0
  67. package/dist/compression/api-compressor.d.ts +15 -0
  68. package/dist/compression/api-compressor.d.ts.map +1 -0
  69. package/dist/compression/api-compressor.js +84 -0
  70. package/dist/compression/api-compressor.js.map +1 -0
  71. package/dist/compression/factory.d.ts +6 -0
  72. package/dist/compression/factory.d.ts.map +1 -0
  73. package/dist/compression/factory.js +8 -0
  74. package/dist/compression/factory.js.map +1 -0
  75. package/dist/compression/index.d.ts +10 -0
  76. package/dist/compression/index.d.ts.map +1 -0
  77. package/dist/compression/index.js +2 -0
  78. package/dist/compression/index.js.map +1 -0
  79. package/dist/compression/ollama-compressor.d.ts +9 -0
  80. package/dist/compression/ollama-compressor.d.ts.map +1 -0
  81. package/dist/compression/ollama-compressor.js +51 -0
  82. package/dist/compression/ollama-compressor.js.map +1 -0
  83. package/dist/compression/rule-compressor.d.ts +9 -0
  84. package/dist/compression/rule-compressor.d.ts.map +1 -0
  85. package/dist/compression/rule-compressor.js +43 -0
  86. package/dist/compression/rule-compressor.js.map +1 -0
  87. package/dist/memory-server/database.d.ts.map +1 -1
  88. package/dist/memory-server/database.js.map +1 -1
  89. package/dist/memory-server/embeddings-api.d.ts +14 -0
  90. package/dist/memory-server/embeddings-api.d.ts.map +1 -0
  91. package/dist/memory-server/embeddings-api.js +37 -0
  92. package/dist/memory-server/embeddings-api.js.map +1 -0
  93. package/dist/memory-server/embeddings-ollama.d.ts +14 -0
  94. package/dist/memory-server/embeddings-ollama.d.ts.map +1 -0
  95. package/dist/memory-server/embeddings-ollama.js +46 -0
  96. package/dist/memory-server/embeddings-ollama.js.map +1 -0
  97. package/dist/memory-server/embeddings.d.ts +9 -0
  98. package/dist/memory-server/embeddings.d.ts.map +1 -0
  99. package/dist/memory-server/embeddings.js +2 -0
  100. package/dist/memory-server/embeddings.js.map +1 -0
  101. package/dist/memory-server/hybrid-search.d.ts +22 -0
  102. package/dist/memory-server/hybrid-search.d.ts.map +1 -0
  103. package/dist/memory-server/hybrid-search.js +33 -0
  104. package/dist/memory-server/hybrid-search.js.map +1 -0
  105. package/dist/memory-server/vector-store.d.ts +30 -0
  106. package/dist/memory-server/vector-store.d.ts.map +1 -0
  107. package/dist/memory-server/vector-store.js +99 -0
  108. package/dist/memory-server/vector-store.js.map +1 -0
  109. package/package.json +14 -9
package/README.md CHANGED
@@ -1,408 +1,256 @@
1
1
  <div align="center">
2
2
 
3
- # ๐Ÿ›๏ธ Kratos MCP
3
+ ```
4
+ โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—
5
+ โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ•šโ•โ•โ–ˆโ–ˆโ•”โ•โ•โ•โ–ˆโ–ˆโ•”โ•โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•
6
+ โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ• โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—
7
+ โ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ•šโ•โ•โ•โ•โ–ˆโ–ˆโ•‘
8
+ โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘ โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘
9
+ โ•šโ•โ• โ•šโ•โ•โ•šโ•โ• โ•šโ•โ•โ•šโ•โ• โ•šโ•โ• โ•šโ•โ• โ•šโ•โ•โ•โ•โ•โ• โ•šโ•โ•โ•โ•โ•โ•โ•
10
+ ```
4
11
 
5
- ### Ultra-Lean Memory System for AI Coding Tools
12
+ ### The God of War remembers everything.
6
13
 
7
14
  [![npm version](https://img.shields.io/npm/v/kratos-mcp.svg)](https://www.npmjs.com/package/kratos-mcp)
8
15
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
9
- [![MCP Compatible](https://img.shields.io/badge/MCP-Compatible-green.svg)](https://modelcontextprotocol.io)
10
16
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.0-blue.svg)](https://www.typescriptlang.org/)
11
17
 
12
- **Never explain your codebase again. Let AI remember everything.**
18
+ **Persistent memory for AI coding agents. CLI-first. Auto-capture. Encrypted. Zero network calls.**
13
19
 
14
- ๐ŸŒ **[kratos-mcp.com](https://kratos-mcp.com)** โ€ข [Installation](#-installation) โ€ข [Quick Start](#-quick-start) โ€ข [Features](#-features) โ€ข [Tools](#-available-tools)
20
+ [Installation](#installation) ยท [Quick Start](#quick-start) ยท [Commands](#commands) ยท [Plugin](#plugin-mode) ยท [Security](#security)
15
21
 
16
22
  </div>
17
23
 
18
24
  ---
19
25
 
20
- ## ๐ŸŽฏ Why Kratos?
21
-
22
- After building 30+ production apps with AI, we discovered a critical problem: **AI tools forget everything between sessions**. You explain your architecture, your patterns, your decisionsโ€”and tomorrow, you explain it all again.
23
-
24
- Kratos MCP solves this with an **ultra-lean memory system** that gives AI perfect recall of your projectโ€”with minimal context overhead.
25
-
26
- ## โœจ Features
26
+ ## What is Kratos?
27
27
 
28
- <table>
29
- <tr>
30
- <td width="50%">
28
+ AI coding tools forget everything between sessions. You explain your architecture, your patterns, your decisions โ€” and tomorrow, you explain it all again.
31
29
 
32
- ### ๐Ÿ”’ **100% Project Isolation**
33
- Each project gets its own SQLite database. No cross-contamination. Ever.
30
+ Kratos gives your AI agent **permanent memory**. It auto-captures what happens during coding sessions and recalls relevant context when you start a new one. No manual work. No setup. Just install and code.
34
31
 
35
- </td>
36
- <td width="50%">
32
+ ```
33
+ Session 1: You build auth with JWT โ†’ Kratos remembers
34
+ Session 2: "How does auth work?" โ†’ Kratos recalls instantly
35
+ ```
37
36
 
38
- ### โšก **Zero Configuration**
39
- Auto-detects projects via git, package.json, or directory structure. Just install and code.
37
+ ## Installation
40
38
 
41
- </td>
42
- </tr>
43
- <tr>
44
- <td width="50%">
39
+ ```bash
40
+ npm install -g kratos-mcp
41
+ ```
45
42
 
46
- ### ๐Ÿชถ **Ultra-Lean Architecture**
47
- Just 12 essential tools. 64% smaller context footprint than competitors.
43
+ That's it. Kratos auto-detects your project from `.git`, `package.json`, `Cargo.toml`, `go.mod`, or `pyproject.toml`.
48
44
 
49
- </td>
50
- <td width="50%">
45
+ ## Quick Start
51
46
 
52
- ### ๐ŸŒ **Universal Protocol**
53
- Works with Claude, Cursor, Windsurf, Continueโ€”any MCP-compatible tool.
47
+ ```bash
48
+ # Save a memory
49
+ kratos save "Auth uses JWT with RS256, refresh tokens in httpOnly cookies" --tags auth,jwt --importance 5
54
50
 
55
- </td>
56
- </tr>
57
- </table>
51
+ # Search memories
52
+ kratos search "authentication"
58
53
 
59
- ## ๐Ÿš€ Installation
54
+ # Ask in natural language
55
+ kratos ask "how does the auth system work?"
60
56
 
61
- ```bash
62
- # Install globally
63
- npm install -g kratos-mcp
57
+ # See what Kratos knows
58
+ kratos status
59
+ ```
64
60
 
65
- # Or run directly with npx (no installation required)
66
- npx kratos-mcp
61
+ **Output:**
67
62
 
68
- # Or install as a dependency
69
- npm install kratos-mcp
63
+ ```
64
+ KRATOS โ€” Memory System
65
+ โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
66
+
67
+ ACTIVE PROJECT
68
+ โ— my-app
69
+
70
+ MEMORY STATS
71
+ Total: 47
72
+ Last saved: 3/15/2026, 2:16:21 PM
73
+ Importance:
74
+ 5 โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ 12
75
+ 4 โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘ 8
76
+ 3 โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘ 5
77
+ 2 โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘ 4
78
+ 1 โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘ 0
79
+
80
+ TOP TAGS
81
+ #auth(5) #database(4) #api(3) #frontend(2)
82
+
83
+ FEATURES
84
+ โ— FTS5 Full-Text Search
85
+ โ— AES-256-GCM Encryption
86
+ โ— PII/Secret Detection
87
+ โ— Smart Compression
88
+ โ— Auto-Capture Hooks
70
89
  ```
71
90
 
72
- ## ๐ŸŽฌ Quick Start
91
+ ## Commands
73
92
 
74
- ### 1๏ธโƒฃ Configure Your AI Tool
93
+ | Command | Description |
94
+ |---------|-------------|
95
+ | `kratos save <text>` | Save a memory (`--tags`, `--importance 1-5`, `--paths`, `--compress`) |
96
+ | `kratos search <query>` | Full-text search (`--limit`, `--tags`, `--debug`) |
97
+ | `kratos ask <question>` | Natural language query |
98
+ | `kratos recent` | Recent memories (`--limit`) |
99
+ | `kratos get <id>` | Full memory details |
100
+ | `kratos forget <id>` | Delete a memory |
101
+ | `kratos status` | System dashboard |
102
+ | `kratos switch <path>` | Switch project |
103
+ | `kratos scan <text>` | Detect PII/secrets (`--redact`) |
104
+ | `kratos migrate` | Verify existing data for CLI use |
105
+ | `kratos hooks install` | Install auto-capture hooks for Claude Code |
106
+ | `kratos hooks uninstall` | Remove hooks |
75
107
 
76
- <details>
77
- <summary><b>Claude Desktop</b></summary>
108
+ ## Plugin Mode
78
109
 
79
- Add to your Claude Desktop config file:
80
- - **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
81
- - **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
82
- - **Linux**: `~/.config/claude/claude_desktop_config.json`
110
+ Kratos works as a **Claude Code plugin** for fully automatic memory capture. No manual commands needed โ€” everything happens in the background.
83
111
 
84
- ```json
85
- {
86
- "mcpServers": {
87
- "kratos": {
88
- "command": "npx",
89
- "args": ["--yes", "kratos-mcp@latest"]
90
- }
91
- }
92
- }
93
- ```
112
+ ### Install as Plugin
94
113
 
95
- Or if you have it installed globally:
96
- ```json
97
- {
98
- "mcpServers": {
99
- "kratos": {
100
- "command": "kratos-mcp",
101
- "args": []
102
- }
103
- }
104
- }
114
+ ```bash
115
+ claude --plugin-dir ./plugin
105
116
  ```
106
- </details>
107
117
 
108
- <details>
109
- <summary><b>Claude Code (Anthropic's VSCode Extension)</b></summary>
118
+ ### What Happens Automatically
110
119
 
111
- Run this command in your terminal:
120
+ | Event | Action |
121
+ |-------|--------|
122
+ | **Session starts** | Loads recent memories into Claude's context |
123
+ | **You edit a file** | Captures what changed, saves as memory |
124
+ | **You run a command** | Captures the command and result |
125
+ | **Session ends** | Claude summarizes the session (using the host LLM โ€” free, no API key) and saves it |
112
126
 
113
- ```bash
114
- claude mcp add kratos -- npx --yes kratos-mcp@latest
115
- ```
127
+ The plugin uses Claude Code's built-in `type: "prompt"` hook โ€” Claude itself compresses your session memories. No external AI, no Ollama, no API keys, no network calls.
116
128
 
117
- Or for global installation:
129
+ ### Plugin Structure
118
130
 
119
- ```bash
120
- # First install globally
121
- npm install -g kratos-mcp@latest
122
-
123
- # Then add to Claude Code
124
- claude mcp add kratos -- kratos-mcp
131
+ ```
132
+ plugin/
133
+ .claude-plugin/plugin.json # Manifest
134
+ hooks/hooks.json # Lifecycle hooks (PostToolUse, Stop, etc.)
135
+ skills/kratos-memory/SKILL.md # Teaches Claude how to use kratos
136
+ scripts/ # Hook handlers
137
+ .mcp.json # MCP server (backward compat)
125
138
  ```
126
139
 
127
- See [Claude Code MCP docs](https://docs.anthropic.com/claude-code/mcp) for more info.
128
- </details>
140
+ ## Security
129
141
 
130
- <details>
131
- <summary><b>Cursor</b></summary>
142
+ Kratos was built with security as a core feature, not an afterthought.
132
143
 
133
- Add to `.cursor/mcp_config.json` in your project root:
144
+ | Feature | Detail |
145
+ |---------|--------|
146
+ | **AES-256-GCM Encryption** | Memories encrypted at rest with per-project keys |
147
+ | **PII Detection** | Auto-detects SSN, credit cards, emails, phone numbers, IPs, DOB |
148
+ | **Secret Detection** | Catches API keys, AWS keys, GitHub tokens, JWTs, private keys, passwords |
149
+ | **Project Isolation** | Each project has its own SQLite database โ€” zero cross-contamination |
150
+ | **Zero Network Calls** | Nothing leaves your machine. Ever. No telemetry, no analytics, no cloud. |
151
+ | **Key Rotation** | Rotate encryption keys without data loss |
134
152
 
135
- ```json
136
- {
137
- "mcpServers": {
138
- "kratos": {
139
- "command": "npx",
140
- "args": ["--yes", "kratos-mcp@latest"]
141
- }
142
- }
143
- }
144
- ```
145
- </details>
153
+ ```bash
154
+ # Scan text before saving
155
+ kratos scan "My API key is sk-1234abcd..." --redact
146
156
 
147
- <details>
148
- <summary><b>Other MCP Tools</b></summary>
157
+ # Output:
158
+ # โœ— Secrets detected!
159
+ # โ— API Key (secret, confidence: 0.9)
160
+ # Redacted: My API key is sk-[REDACTED_SECRET]...
161
+ ```
149
162
 
150
- Kratos works with any tool supporting the Model Context Protocol. The general format is:
163
+ ## How It Works
151
164
 
152
- ```json
153
- {
154
- "command": "npx",
155
- "args": ["kratos-mcp"]
156
- }
165
+ ```
166
+ You code with Claude
167
+ โ†“
168
+ PostToolUse hook fires (auto)
169
+ โ†“
170
+ Observation captured + compressed
171
+ โ†“
172
+ Saved to per-project SQLite + FTS5
173
+ โ†“
174
+ Next session starts
175
+ โ†“
176
+ SessionStart hook loads recent context
177
+ โ†“
178
+ Claude knows what happened last time
157
179
  ```
158
180
 
159
- **Compatible with:** Windsurf, Cline, BoltAI, Augment Code, Roo Code, Zencoder, Amazon Q, Qodo Gen, JetBrains AI, Warp, Opencode, Continue.dev, Zed, and more!
160
-
161
- Check your tool's documentation for specific MCP server configuration location.
181
+ **Performance:**
162
182
 
163
- </details>
183
+ | Metric | Value |
184
+ |--------|-------|
185
+ | Memory retrieval | < 10ms |
186
+ | Project switch | < 100ms |
187
+ | Storage per project | ~2MB |
188
+ | Search engine | SQLite FTS5 (porter tokenizer) |
164
189
 
165
- ### 2๏ธโƒฃ Start Using Kratos
190
+ ## Data Storage
166
191
 
167
- ```typescript
168
- // Your AI now remembers:
169
- // โœ“ Your authentication patterns
170
- // โœ“ Your API structure
171
- // โœ“ Your component architecture
172
- // โœ“ Your coding standards
173
- // โœ“ Every decision you've made
174
192
  ```
175
-
176
- ## ๐Ÿ› ๏ธ Available Tools
177
-
178
- Kratos provides **12 ultra-lean tools** optimized for minimal context consumption:
179
-
180
- ### ๐Ÿ’พ Memory Management (7 tools)
181
-
182
- <table>
183
- <tr>
184
- <th>Tool</th>
185
- <th>Description</th>
186
- </tr>
187
- <tr>
188
- <td><code>memory_save</code></td>
189
- <td>Store important project knowledge with tags, paths, and importance levels</td>
190
- </tr>
191
- <tr>
192
- <td><code>memory_search</code></td>
193
- <td>Smart semantic search with debug mode and path matching</td>
194
- </tr>
195
- <tr>
196
- <td><code>memory_ask</code></td>
197
- <td>Natural language queries about your memories</td>
198
- </tr>
199
- <tr>
200
- <td><code>memory_get_recent</code></td>
201
- <td>Get recently created memories with filtering</td>
202
- </tr>
203
- <tr>
204
- <td><code>memory_get</code></td>
205
- <td>Retrieve a specific memory by ID</td>
206
- </tr>
207
- <tr>
208
- <td><code>memory_get_multiple</code></td>
209
- <td>Bulk retrieve multiple memories</td>
210
- </tr>
211
- <tr>
212
- <td><code>memory_forget</code></td>
213
- <td>Delete a memory by ID</td>
214
- </tr>
215
- </table>
216
-
217
- ### ๐Ÿ”’ Security (1 tool)
218
-
219
- <table>
220
- <tr>
221
- <th>Tool</th>
222
- <th>Description</th>
223
- </tr>
224
- <tr>
225
- <td><code>security_scan</code></td>
226
- <td>Scan text for PII and secrets before saving</td>
227
- </tr>
228
- </table>
229
-
230
- ### ๐Ÿ“ Project Management (3 tools)
231
-
232
- <table>
233
- <tr>
234
- <th>Tool</th>
235
- <th>Description</th>
236
- </tr>
237
- <tr>
238
- <td><code>project_switch</code></td>
239
- <td>Switch between different projects</td>
240
- </tr>
241
- <tr>
242
- <td><code>project_current</code></td>
243
- <td>Get current active project info</td>
244
- </tr>
245
- <tr>
246
- <td><code>change_storage_path</code></td>
247
- <td>Dynamically change storage location with automatic data migration</td>
248
- </tr>
249
- </table>
250
-
251
- ### โš™๏ธ System (1 tool)
252
-
253
- <table>
254
- <tr>
255
- <th>Tool</th>
256
- <th>Description</th>
257
- </tr>
258
- <tr>
259
- <td><code>system_status</code></td>
260
- <td>Get system status and memory statistics</td>
261
- </tr>
262
- </table>
263
-
264
- ## ๐Ÿ“Š How It Works
265
-
266
- ```mermaid
267
- graph LR
268
- A[Your Code] --> B[Kratos MCP]
269
- B --> C{Project Detection}
270
- C --> D[SQLite Database]
271
- D --> E[Memory Storage]
272
- E --> F[AI Tool]
273
- F --> G[Perfect Context]
193
+ ~/.kratos/
194
+ โ”œโ”€โ”€ projects/
195
+ โ”‚ โ”œโ”€โ”€ proj_abc123/
196
+ โ”‚ โ”‚ โ”œโ”€โ”€ databases/
197
+ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ memories.db # SQLite + FTS5
198
+ โ”‚ โ”‚ โ”œโ”€โ”€ sessions/
199
+ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ current.json # Active session buffer
200
+ โ”‚ โ”‚ โ””โ”€โ”€ project.json # Project metadata
201
+ โ”‚ โ””โ”€โ”€ proj_def456/
202
+ โ”‚ โ””โ”€โ”€ ...
203
+ โ”œโ”€โ”€ .keys/
204
+ โ”‚ โ””โ”€โ”€ proj_abc123.key # AES-256 encryption key
205
+ โ””โ”€โ”€ projects.json # Project registry
274
206
  ```
275
207
 
276
- ## ๐Ÿ”ฌ Under the Hood
277
-
278
- - **SQLite + FTS5**: Lightning-fast full-text search
279
- - **Smart Scoring**: Path matching + recency + importance
280
- - **Auto-detection**: Git, package.json, or directory-based
281
- - **Secure**: All data stays local, no external calls
282
- - **Lean**: Only 4 core components, minimal memory footprint
283
-
284
- ## ๐Ÿ“ˆ Performance
285
-
286
- <table>
287
- <tr>
288
- <th>Metric</th>
289
- <th>Value</th>
290
- </tr>
291
- <tr>
292
- <td>Context Overhead</td>
293
- <td>64% smaller than v3</td>
294
- </tr>
295
- <tr>
296
- <td>Memory Retrieval</td>
297
- <td>&lt; 10ms</td>
298
- </tr>
299
- <tr>
300
- <td>Project Switch</td>
301
- <td>&lt; 100ms</td>
302
- </tr>
303
- <tr>
304
- <td>Storage Overhead</td>
305
- <td>~2MB per project</td>
306
- </tr>
307
- </table>
308
-
309
- ## ๐Ÿ—‚๏ธ Memory Structure
208
+ Each project is completely isolated. Different database, different encryption key, different everything.
310
209
 
311
- ```
312
- ~/.kratos/ # Default storage location
313
- โ”œโ”€โ”€ projects/
314
- โ”‚ โ”œโ”€โ”€ project-id-1/
315
- โ”‚ โ”‚ โ””โ”€โ”€ memories.db # SQLite database with FTS5
316
- โ”‚ โ””โ”€โ”€ project-id-2/
317
- โ”‚ โ””โ”€โ”€ memories.db
318
- โ””โ”€โ”€ global/
319
- โ””โ”€โ”€ global.db # Shared knowledge (optional)
320
- ```
210
+ ## MCP Support (Deprecated)
211
+
212
+ > **Note:** MCP support is deprecated and will be removed in a future version. The CLI and plugin are the recommended interfaces going forward. MCP consumed too much context per tool call.
213
+
214
+ If you still need MCP mode:
321
215
 
322
- **New in v1.6.1:** Use `change_storage_path` to move data to custom locations like `/opt/kratos` or `.kratos` for per-project storage.
323
-
324
- ## ๐Ÿ’ก Example Usage
325
-
326
- ```typescript
327
- // Save a memory
328
- await memory_save({
329
- summary: "JWT auth implementation",
330
- text: "We use httpOnly cookies with refresh tokens...",
331
- tags: ["auth", "security"],
332
- paths: ["src/middleware/auth.ts"],
333
- importance: 5
334
- });
335
-
336
- // Search memories
337
- await memory_search({
338
- q: "authentication",
339
- k: 5,
340
- debug: true // Get search insights
341
- });
342
-
343
- // Ask natural language questions
344
- await memory_ask({
345
- question: "How does our auth system work?",
346
- limit: 10
347
- });
348
-
349
- // Change storage location
350
- await change_storage_path({
351
- newPath: "/opt/kratos",
352
- migrate: true,
353
- backup: true
354
- });
216
+ ```bash
217
+ kratos mcp
355
218
  ```
356
219
 
357
- ## ๐ŸŽฎ Live Demo
358
-
359
- ```typescript
360
- // User: "Explain the auth system"
361
- //
362
- // Kratos automatically retrieves:
363
- // โœ“ JWT implementation from 2 weeks ago
364
- // โœ“ Middleware configuration from last month
365
- // โœ“ User model structure from initial setup
366
- //
367
- // AI Response: "Your auth uses JWT with refresh tokens
368
- // stored in httpOnly cookies. The middleware validates
369
- // tokens on protected routes at /api/middleware/auth.ts:42..."
220
+ Or in your MCP client config:
221
+ ```json
222
+ {
223
+ "mcpServers": {
224
+ "kratos": {
225
+ "command": "npx",
226
+ "args": ["kratos-mcp"]
227
+ }
228
+ }
229
+ }
370
230
  ```
371
231
 
372
- ## ๐Ÿค Contributing
232
+ Existing MCP users: run `kratos migrate` to verify your data works with the CLI. No data copy needed โ€” same database format.
373
233
 
374
- We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
234
+ ## Contributing
375
235
 
376
236
  ```bash
377
- # Clone the repo
378
237
  git clone https://github.com/ceorkm/kratos-mcp.git
379
-
380
- # Install dependencies
238
+ cd kratos-mcp
381
239
  npm install
382
-
383
- # Build
384
240
  npm run build
385
-
386
- # Run in development
387
- npm run dev
241
+ npm run cli # Run CLI in dev mode
388
242
  ```
389
243
 
390
- ## ๐Ÿ“„ License
391
-
392
- MIT ยฉ 2025 Kratos MCP Contributors
393
-
394
- ## ๐Ÿ™ Acknowledgments
395
-
396
- Built on the [Model Context Protocol](https://modelcontextprotocol.io) by Anthropic.
244
+ ## License
397
245
 
398
- Inspired by real-world experience building production apps with AI.
246
+ MIT
399
247
 
400
248
  ---
401
249
 
402
250
  <div align="center">
403
251
 
404
- **Built for developers who value their time.**
252
+ **Built for developers who are tired of repeating themselves.**
405
253
 
406
- [Report Bug](https://github.com/ceorkm/kratos-mcp/issues) โ€ข [Request Feature](https://github.com/ceorkm/kratos-mcp/issues) โ€ข [Documentation](https://github.com/ceorkm/kratos-mcp#readme)
254
+ [Report Bug](https://github.com/ceorkm/kratos-mcp/issues) ยท [Request Feature](https://github.com/ceorkm/kratos-mcp/issues)
407
255
 
408
256
  </div>
package/bin/kratos-mcp CHANGED
@@ -1,7 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- // This is the executable wrapper for kratos-mcp
4
- // It ensures the MCP server runs correctly when installed globally or via npx
3
+ // Kratos Memory โ€” CLI + MCP Server
4
+ // Mode detection:
5
+ // - CLI mode: when called with subcommands (save, search, etc.)
6
+ // - MCP mode: when stdin is piped (no TTY) with no args, or via `kratos mcp`
7
+ // This preserves backward compatibility with existing MCP configurations.
5
8
 
6
9
  import { fileURLToPath } from 'url';
7
10
  import { dirname, join } from 'path';
@@ -10,20 +13,19 @@ import { spawn } from 'child_process';
10
13
  const __filename = fileURLToPath(import.meta.url);
11
14
  const __dirname = dirname(__filename);
12
15
 
13
- // Find the actual index.js file
14
- const indexPath = join(__dirname, '..', 'dist', 'index.js');
16
+ // Route to the CLI entry point (which handles both CLI and MCP mode detection)
17
+ const cliPath = join(__dirname, '..', 'dist', 'cli', 'index.js');
15
18
 
16
- // Spawn node with the actual server file
17
- const child = spawn(process.execPath, [indexPath], {
19
+ const child = spawn(process.execPath, [cliPath, ...process.argv.slice(2)], {
18
20
  stdio: 'inherit',
19
- env: { ...process.env, KRATOS_DEBUG: 'false' }
21
+ env: { ...process.env }
20
22
  });
21
23
 
22
24
  child.on('error', (err) => {
23
- console.error('Failed to start Kratos MCP:', err);
25
+ console.error('Failed to start Kratos:', err);
24
26
  process.exit(1);
25
27
  });
26
28
 
27
29
  child.on('exit', (code) => {
28
30
  process.exit(code || 0);
29
- });
31
+ });
@@ -0,0 +1,13 @@
1
+ import type { CLIContext } from './core.js';
2
+ export declare class CaptureHandler {
3
+ private ctx;
4
+ private bufferPath;
5
+ private compressor;
6
+ constructor(ctx: CLIContext);
7
+ handlePostToolUse(data: any): Promise<void>;
8
+ handleSessionEnd(_data: any): Promise<void>;
9
+ private appendToBuffer;
10
+ private loadBuffer;
11
+ private clearBuffer;
12
+ }
13
+ //# sourceMappingURL=capture-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capture-handler.d.ts","sourceRoot":"","sources":["../../src/cli/capture-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAqB5C,qBAAa,cAAc;IACzB,OAAO,CAAC,GAAG,CAAa;IACxB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,UAAU,CAAsB;gBAE5B,GAAG,EAAE,UAAU;IAMrB,iBAAiB,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAgD3C,gBAAgB,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;YA4BnC,cAAc;YAgBd,UAAU;YAWV,WAAW;CAO1B"}