suture-mcp 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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 suture-mcp contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,246 @@
1
+ # suture-mcp (Beta)
2
+
3
+ Persistent structured memory for AI agents. Suture is an MCP-native, zero-infra memory substrate that stores curated local context in SQLite, then exposes it through model-agnostic tools and CLI hooks.
4
+
5
+ > [!IMPORTANT]
6
+ > **Beta Status:** Suture is currently in local-first beta. Expect breaking changes to the database schema and tool definitions. **Do not use for highly sensitive production credentials.**
7
+
8
+ ## Quickstart
9
+
10
+ The beta onboarding path is terminal-first:
11
+
12
+ ```bash
13
+ npx suture-mcp@beta setup
14
+ ```
15
+
16
+ The setup flow checks the local runtime, previews the state directory and MCP config, shows the safe project index plan, lets you toggle durable project facts with the keyboard, runs indexing, then ends on a value dashboard with estimated token savings and curation activity.
17
+
18
+ For agents, CI, and scripted installs:
19
+
20
+ ```bash
21
+ npx suture-mcp@beta setup --yes --project /path/to/project --dir /path/to/suture-data
22
+ suture-mcp index /path/to/project --apply-safe --json
23
+ suture-mcp stats --json
24
+ ```
25
+
26
+ Until the npm beta tag is published, use the GitHub fallback with an explicit package command:
27
+
28
+ ```bash
29
+ npm exec --yes --package github:AlejandroZmtZ/suture-mcp -- suture-mcp setup
30
+ ```
31
+
32
+ If npm reports `spawn sh ENOENT` on native dependency install, set the lifecycle script shell explicitly and retry:
33
+
34
+ ```bash
35
+ npm config set script-shell /bin/sh
36
+ npm exec --yes --package github:AlejandroZmtZ/suture-mcp -- suture-mcp doctor
37
+ ```
38
+
39
+ The printed MCP config is ready to paste into your agent:
40
+
41
+ ```json
42
+ {
43
+ "mcpServers": {
44
+ "suture": {
45
+ "command": "suture-mcp",
46
+ "args": ["serve", "--dir", "/path/to/suture-data"]
47
+ }
48
+ }
49
+ }
50
+ ```
51
+
52
+ Once connected:
53
+
54
+ - **Remember:** Ask your agent to "remember this decision: we are using SQLite for persistence."
55
+ - **Search:** Ask "what did we decide about persistence?"
56
+ - **Stats:** Run `suture-mcp stats` to see estimated cached tokens, avoided rereads, indexed files, curation actions, and cost savings.
57
+
58
+ ## Beta Install Validation
59
+
60
+ Use this sequence to validate a beta install exactly like a new user would:
61
+
62
+ ```bash
63
+ npx suture-mcp@beta setup --yes --project /path/to/project --dir /path/to/shared-suture-state
64
+ npx suture-mcp@beta setup --yes --project /path/to/project --dir /path/to/shared-suture-state --json
65
+ npx suture-mcp@beta doctor --dir /path/to/shared-suture-state
66
+ npx suture-mcp@beta stats --dir /path/to/shared-suture-state
67
+ ```
68
+
69
+ The second setup should report an existing substrate, apply zero duplicate facts, skip unchanged files, and show avoided reread tokens in the stats dashboard. That is the expected second-agent path for Claude, Codex, Cursor, or any other MCP-capable client using the same state directory.
70
+
71
+ ## Beta Safety & Limitations
72
+
73
+ Suture is in **local-first beta**. It is designed with a defense-in-depth security posture, but please note these limitations:
74
+
75
+ - **Secret Detection:** Suture uses a regex-based scanner to block obvious API keys (OpenAI, AWS, etc.) and `.env` secrets. This is **best-effort** and not a replacement for a dedicated DLP solution.
76
+ - **Privacy:** Data stays on your machine in a local SQLite database. There is no cloud sync or telemetry in the beta.
77
+ - **Disabled Tools:** The `import` tool is explicitly disabled in beta to prevent unsafe database restores.
78
+ - **Native Dependencies:** Uses `better-sqlite3` and `tree-sitter`. Installation may require a working Node.js build environment (GXX/Xcode) on some systems.
79
+ - **Breaking Changes:** Schema migrations are supported, but we recommend regular `transfer` exports of critical memory during beta.
80
+
81
+ ## Current Capabilities
82
+
83
+ - **Structured Memory:** `remember`, `recall`, `search`, `curate`, `transfer`, `forget`, and `discovery`.
84
+ - **Project Discovery:** Secure local scanning to build "project maps" of languages, entrypoints, and conventions.
85
+ - **Hybrid Search:** Search across a semantic memory graph, code symbol graph, and SQLite FTS5 index.
86
+ - **RIR Curation:** Automatic memory tiering (Core, Recall, Archive) based on Recency, Importance, and Relevance.
87
+ - **Value Metrics:** Local-only estimates for cached substrate tokens, avoided rereads, indexed/skipped files, code symbols, substrate search hits, duplicate recall skips, and configurable token cost savings.
88
+ - **CLI Hooks:** Integration points for agent `session-start` and `pre-compact` workflows.
89
+ - **Terminal UI:** Boxed ASCII setup, keyboard-selectable finding curation, index previews, progress/result panels, and a stats dashboard designed for `npx suture-mcp@beta setup`.
90
+
91
+ ## Install
92
+
93
+ ```bash
94
+ npm install -g suture-mcp
95
+ suture-mcp setup --project /path/to/project --dir /path/to/state
96
+ ```
97
+
98
+ For local development:
99
+
100
+ ```bash
101
+ npm install
102
+ npm run build
103
+ npm test
104
+ ```
105
+
106
+ ## MCP Server
107
+
108
+ Start the server over stdio:
109
+
110
+ ```bash
111
+ suture-mcp serve --dir /path/to/state
112
+ ```
113
+
114
+ Example MCP client configuration (Note: Use absolute paths; many clients do not expand `~`):
115
+
116
+ ```json
117
+ {
118
+ "mcpServers": {
119
+ "suture": {
120
+ "command": "suture-mcp",
121
+ "args": ["serve", "--dir", "/home/user/.suture"]
122
+ }
123
+ }
124
+ }
125
+ ```
126
+
127
+ ## CLI
128
+
129
+ ```bash
130
+ suture-mcp setup [--project <path>] [--dir <state>] [--yes] [--json]
131
+ suture-mcp init [--dir <path>]
132
+ suture-mcp serve [--dir <path>]
133
+ suture-mcp doctor [--dir <state>] [--json]
134
+ suture-mcp index <project> [--dir <state>] [--apply-safe] [--json]
135
+ suture-mcp hook session-start --project <path> --session <id> [--client <name>] [--format text|json|claude-json]
136
+ suture-mcp hook pre-compact --project <path> --session <id> [--client <name>] [--json]
137
+ suture-mcp hook post-compact --project <path> --session <id> [--client <name>] [--summary <text>|--summary-file <path>] [--json]
138
+ suture-mcp hook status --project <path> --session <id> [--client <name>] [--json]
139
+ suture-mcp stats [--dir <state>] [--json] [--model-profile conservative|standard|premium]
140
+ suture-mcp recall [--dir <state>]
141
+ ```
142
+
143
+ `index` previews by default. Persistence requires `--apply-safe`.
144
+
145
+ `hook` commands expose the same session-start and compaction orchestration used by agent integrations, so shell-based clients can request setup/context blocks, force reinjection after compaction, and store compact summaries without using provider-specific glue.
146
+
147
+ Beta indexing is deliberately conservative: manifest/config/script/test/code-symbol indexing is enabled, raw markdown memory generation is disabled, and secrets, `.env`, dependencies, build output, generated files, and local tool state directories are ignored.
148
+
149
+ ## Multi-Agent Sharing
150
+
151
+ Suture memory is shared by state directory, not by model provider. Configure every agent that should share memory with the same `--dir` value:
152
+
153
+ ```json
154
+ {
155
+ "mcpServers": {
156
+ "suture": {
157
+ "command": "suture-mcp",
158
+ "args": ["serve", "--dir", "/path/to/shared-suture-state"]
159
+ }
160
+ }
161
+ }
162
+ ```
163
+
164
+ When a second agent indexes the same project in the same state directory, Suture reuses the existing project substrate instead of creating a duplicate index. Project identity is derived from a stable fingerprint using, in priority order, git remote, package name, and real project path fallback. Setup shows whether it found an existing substrate, and unchanged files are skipped by content hash.
165
+
166
+ This means a Claude, Codex, Cursor, or other MCP-capable client can share the same structured memory as long as they point at the same state directory.
167
+
168
+ ## Harness And Model Agnostic Design
169
+
170
+ Suture treats models as interchangeable callers. The durable contract is structured memory plus MCP/CLI transport, not a provider-specific prompt format.
171
+
172
+ - MCP tools return plain JSON payloads.
173
+ - Hook outputs support text and JSON in addition to Claude-compatible JSON.
174
+ - Curator logic is provider-injectable through `CuratorProvider`.
175
+ - Persistence is local SQLite with WAL and a busy timeout, so harnesses can share memory without sharing a vendor account.
176
+
177
+ Recommended integration pattern for a new harness:
178
+
179
+ 1. Call `recall` or `hook session-start` at session start.
180
+ 2. Call `remember` for user-approved summaries, decisions, and durable facts.
181
+ 3. Call `search` for targeted context retrieval.
182
+ 4. Call `curate` periodically or after compaction. Suture also runs event-based curation after `remember`, accepted discovery/indexing changes, and discovery apply.
183
+ 5. Keep raw transcripts out of durable memory.
184
+
185
+ ## Security Boundaries
186
+
187
+ Suture is local-first by default. It is designed to avoid storing raw prompt transcripts and to reject obvious secrets before persistence.
188
+
189
+ Current boundaries:
190
+
191
+ - Obvious API keys, private keys, and environment secrets are blocked and redacted.
192
+ - Exports are limited to the Suture state directory or `/tmp`.
193
+ - Discovery ignores common dependency/build/cache directories.
194
+ - The `import` MCP tool is intentionally disabled until migration-safe restore validation is implemented.
195
+
196
+ These protections are defense-in-depth, not a replacement for a dedicated secret scanner. Treat team sync and remote storage as product features that require explicit review before enabling.
197
+
198
+ ## Product Direction
199
+
200
+ The open-core path is straightforward:
201
+
202
+ - Free local package: single-user memory, discovery, CLI hooks, and visualization.
203
+ - Paid team layer: encrypted sync, shared project maps, audit logs, policy controls, hosted backups, and admin review.
204
+ - Enterprise layer: SSO, retention controls, compliance exports, private deployment, and model/harness fleet observability.
205
+
206
+ The product moat is not a single model integration. It is trusted, portable, policy-aware memory that follows the work across tools.
207
+
208
+ ## Publishing Beta
209
+
210
+ Publish beta builds with an npm dist tag instead of asking users to install from Git:
211
+
212
+ ```bash
213
+ npm --cache /tmp/suture-npm-cache pack --dry-run
214
+ npm whoami
215
+ npm publish --tag beta
216
+ ```
217
+
218
+ Keep the beta promise narrow and excellent: frictionless terminal setup, local-only privacy, safe project indexing, honest estimated savings, and structured evidence-backed substrate over generated markdown summaries.
219
+
220
+ Before publishing, run:
221
+
222
+ ```bash
223
+ npm run typecheck
224
+ npm test
225
+ npm run build
226
+ node scripts/smoke-test.js
227
+ ```
228
+
229
+ After publishing, validate from a clean directory:
230
+
231
+ ```bash
232
+ npx suture-mcp@beta setup --yes --project "$PWD" --dir /tmp/suture-beta-verify
233
+ npx suture-mcp@beta doctor --dir /tmp/suture-beta-verify
234
+ npx suture-mcp@beta stats --dir /tmp/suture-beta-verify
235
+ ```
236
+
237
+ ## Development
238
+
239
+ ```bash
240
+ npm run typecheck
241
+ npm test
242
+ npm run build
243
+ npm pack --dry-run
244
+ ```
245
+
246
+ The package publish surface is intentionally limited to `dist`, `README.md`, and `LICENSE`.