gnosys-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 +21 -0
- package/README.md +297 -0
- package/dist/cli.d.ts +7 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +927 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1092 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/bootstrap.d.ts +56 -0
- package/dist/lib/bootstrap.d.ts.map +1 -0
- package/dist/lib/bootstrap.js +163 -0
- package/dist/lib/bootstrap.js.map +1 -0
- package/dist/lib/history.d.ts +39 -0
- package/dist/lib/history.d.ts.map +1 -0
- package/dist/lib/history.js +86 -0
- package/dist/lib/history.js.map +1 -0
- package/dist/lib/ingest.d.ts +47 -0
- package/dist/lib/ingest.d.ts.map +1 -0
- package/dist/lib/ingest.js +134 -0
- package/dist/lib/ingest.js.map +1 -0
- package/dist/lib/lensing.d.ts +35 -0
- package/dist/lib/lensing.d.ts.map +1 -0
- package/dist/lib/lensing.js +85 -0
- package/dist/lib/lensing.js.map +1 -0
- package/dist/lib/resolver.d.ts +84 -0
- package/dist/lib/resolver.d.ts.map +1 -0
- package/dist/lib/resolver.js +269 -0
- package/dist/lib/resolver.js.map +1 -0
- package/dist/lib/search.d.ts +50 -0
- package/dist/lib/search.d.ts.map +1 -0
- package/dist/lib/search.js +166 -0
- package/dist/lib/search.js.map +1 -0
- package/dist/lib/store.d.ts +67 -0
- package/dist/lib/store.d.ts.map +1 -0
- package/dist/lib/store.js +168 -0
- package/dist/lib/store.js.map +1 -0
- package/dist/lib/tags.d.ts +26 -0
- package/dist/lib/tags.d.ts.map +1 -0
- package/dist/lib/tags.js +109 -0
- package/dist/lib/tags.js.map +1 -0
- package/dist/lib/timeline.d.ts +34 -0
- package/dist/lib/timeline.d.ts.map +1 -0
- package/dist/lib/timeline.js +116 -0
- package/dist/lib/timeline.js.map +1 -0
- package/dist/lib/wikilinks.d.ts +63 -0
- package/dist/lib/wikilinks.d.ts.map +1 -0
- package/dist/lib/wikilinks.js +146 -0
- package/dist/lib/wikilinks.js.map +1 -0
- package/dist/test/bootstrap.test.d.ts +2 -0
- package/dist/test/bootstrap.test.d.ts.map +1 -0
- package/dist/test/bootstrap.test.js +208 -0
- package/dist/test/bootstrap.test.js.map +1 -0
- package/dist/test/history.test.d.ts +2 -0
- package/dist/test/history.test.d.ts.map +1 -0
- package/dist/test/history.test.js +141 -0
- package/dist/test/history.test.js.map +1 -0
- package/dist/test/ingest.test.d.ts +2 -0
- package/dist/test/ingest.test.d.ts.map +1 -0
- package/dist/test/ingest.test.js +132 -0
- package/dist/test/ingest.test.js.map +1 -0
- package/dist/test/lensing.test.d.ts +2 -0
- package/dist/test/lensing.test.d.ts.map +1 -0
- package/dist/test/lensing.test.js +154 -0
- package/dist/test/lensing.test.js.map +1 -0
- package/dist/test/search.test.d.ts +2 -0
- package/dist/test/search.test.d.ts.map +1 -0
- package/dist/test/search.test.js +129 -0
- package/dist/test/search.test.js.map +1 -0
- package/dist/test/store.test.d.ts +2 -0
- package/dist/test/store.test.d.ts.map +1 -0
- package/dist/test/store.test.js +152 -0
- package/dist/test/store.test.js.map +1 -0
- package/dist/test/tags.test.d.ts +2 -0
- package/dist/test/tags.test.d.ts.map +1 -0
- package/dist/test/tags.test.js +81 -0
- package/dist/test/tags.test.js.map +1 -0
- package/dist/test/timeline.test.d.ts +2 -0
- package/dist/test/timeline.test.d.ts.map +1 -0
- package/dist/test/timeline.test.js +127 -0
- package/dist/test/timeline.test.js.map +1 -0
- package/dist/test/wikilinks.test.d.ts +2 -0
- package/dist/test/wikilinks.test.d.ts.map +1 -0
- package/dist/test/wikilinks.test.js +178 -0
- package/dist/test/wikilinks.test.js.map +1 -0
- package/package.json +56 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Proticom - IT Intelligence
|
|
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,297 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="docs/logo.svg" alt="Gnosys" width="200">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center"><strong>LLM-native persistent memory for AI agents.</strong></p>
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
Gnosys gives AI agents long-term memory that survives across sessions. Memories are atomic markdown files with structured frontmatter, stored in plain directories, versioned by git, and searchable via FTS5. No database, no vector store, no external services — just files.
|
|
10
|
+
|
|
11
|
+
Gnosys works as an MCP server (for Cursor, Claude Desktop, or any MCP-compatible agent) and as a standalone CLI.
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# Install globally from npm
|
|
17
|
+
npm install -g gnosys-mcp
|
|
18
|
+
|
|
19
|
+
# Initialize a store in your project
|
|
20
|
+
cd /path/to/your/project
|
|
21
|
+
gnosys init
|
|
22
|
+
|
|
23
|
+
# Add your first memory
|
|
24
|
+
gnosys add "We decided to use PostgreSQL for the main database because of its JSON support and mature ecosystem"
|
|
25
|
+
|
|
26
|
+
# Find memories later
|
|
27
|
+
gnosys discover "database selection"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## How It Works
|
|
31
|
+
|
|
32
|
+
A Gnosys store is a `.gnosys/` directory inside your project. It contains markdown files organized by category:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
your-project/
|
|
36
|
+
.gnosys/
|
|
37
|
+
decisions/
|
|
38
|
+
use-postgresql.md
|
|
39
|
+
jwt-over-sessions.md
|
|
40
|
+
architecture/
|
|
41
|
+
three-layer-design.md
|
|
42
|
+
concepts/
|
|
43
|
+
memory-decay.md
|
|
44
|
+
.gnosys/ # internal config
|
|
45
|
+
tags.json # tag registry
|
|
46
|
+
reinforcement.log
|
|
47
|
+
CHANGELOG.md
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Each memory is a markdown file with YAML frontmatter:
|
|
51
|
+
|
|
52
|
+
```yaml
|
|
53
|
+
---
|
|
54
|
+
id: deci-001
|
|
55
|
+
title: "Use PostgreSQL for Main Database"
|
|
56
|
+
category: decisions
|
|
57
|
+
tags:
|
|
58
|
+
domain: [database, backend]
|
|
59
|
+
type: [decision]
|
|
60
|
+
relevance: "database selection postgres sql json storage persistence"
|
|
61
|
+
author: human+ai
|
|
62
|
+
authority: declared
|
|
63
|
+
confidence: 0.9
|
|
64
|
+
created: 2026-03-01
|
|
65
|
+
modified: 2026-03-01
|
|
66
|
+
status: active
|
|
67
|
+
supersedes: null
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
# Use PostgreSQL for Main Database
|
|
71
|
+
|
|
72
|
+
We chose PostgreSQL over MySQL and SQLite because...
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Key fields:
|
|
76
|
+
|
|
77
|
+
- **relevance**: A keyword cloud that powers `discover`. Describe the contexts where this memory would be useful.
|
|
78
|
+
- **confidence**: 0–1 score. How certain is this knowledge? Observations might be 0.6; declared decisions are 0.9.
|
|
79
|
+
- **authority**: Who established this? `declared` (human decided), `observed` (AI noticed), `imported` (from external source), `inferred` (AI deduced).
|
|
80
|
+
- **status**: `active`, `archived`, or `superseded`. Superseded memories link to their replacement via `superseded_by`.
|
|
81
|
+
|
|
82
|
+
## Using with Obsidian
|
|
83
|
+
|
|
84
|
+
A Gnosys store is a valid Obsidian vault. Open your `.gnosys/` directory in Obsidian and you get full browsing, graph view, tag filtering, and search — with zero configuration. This is the recommended way for humans to browse and explore the knowledge base.
|
|
85
|
+
|
|
86
|
+
1. Open Obsidian
|
|
87
|
+
2. Click "Open folder as vault"
|
|
88
|
+
3. Select your project's `.gnosys/` directory
|
|
89
|
+
4. Browse, search, and explore your memories visually
|
|
90
|
+
|
|
91
|
+
Edits made in Obsidian are picked up automatically by Gnosys (the filesystem is the source of truth).
|
|
92
|
+
|
|
93
|
+
## CLI Reference
|
|
94
|
+
|
|
95
|
+
Install globally or run via `npx`:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# Global install
|
|
99
|
+
npm install -g gnosys-mcp
|
|
100
|
+
|
|
101
|
+
# Or run from the project
|
|
102
|
+
npm run build
|
|
103
|
+
node dist/cli.js <command>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Core Commands
|
|
107
|
+
|
|
108
|
+
**`gnosys init [--directory <dir>]`**
|
|
109
|
+
Initialize a new `.gnosys` store. Creates the directory structure, default tag registry, and a git repository.
|
|
110
|
+
|
|
111
|
+
**`gnosys add <input> [--author human|ai|human+ai] [--authority declared|observed] [--store project|personal|global]`**
|
|
112
|
+
Add a memory using natural language. An LLM structures your input into an atomic memory with proper frontmatter, category, and tags. Requires `ANTHROPIC_API_KEY`.
|
|
113
|
+
|
|
114
|
+
**`gnosys add-structured --title <title> --category <category> --content <content> [--tags <json>] [--relevance <keywords>] [--confidence <n>]`**
|
|
115
|
+
Add a memory with explicit fields. No LLM needed — you provide the structure directly.
|
|
116
|
+
|
|
117
|
+
**`gnosys discover <query> [--limit <n>]`**
|
|
118
|
+
Find relevant memories by keyword. Searches relevance clouds, titles, and tags. Returns metadata only (no file contents). This is the primary entry point for agents starting a task.
|
|
119
|
+
|
|
120
|
+
**`gnosys search <query> [--limit <n>]`**
|
|
121
|
+
Full-text search across all memories. Returns matching paths with context snippets.
|
|
122
|
+
|
|
123
|
+
**`gnosys read <path>`**
|
|
124
|
+
Read a specific memory. Supports layer-prefixed paths: `project:decisions/auth.md`.
|
|
125
|
+
|
|
126
|
+
**`gnosys list [--category <cat>] [--tag <tag>] [--store <store>]`**
|
|
127
|
+
List all memories, optionally filtered.
|
|
128
|
+
|
|
129
|
+
**`gnosys update <path> [--title <t>] [--status active|archived|superseded] [--confidence <n>] [--relevance <kw>] [--supersedes <id>] [--superseded-by <id>] [--content <md>]`**
|
|
130
|
+
Update a memory's frontmatter or content. Handles supersession cross-linking automatically.
|
|
131
|
+
|
|
132
|
+
**`gnosys reinforce <memoryId> --signal useful|not_relevant|outdated [--context <why>]`**
|
|
133
|
+
Signal whether a memory was helpful. `useful` resets decay; `not_relevant` logs routing feedback; `outdated` flags for review.
|
|
134
|
+
|
|
135
|
+
**`gnosys stale [--days <n>] [--limit <n>]`**
|
|
136
|
+
Find memories not modified within N days (default: 90). Useful for periodic review.
|
|
137
|
+
|
|
138
|
+
**`gnosys commit-context <context> [--dry-run] [--store <store>]`**
|
|
139
|
+
Extract atomic memories from a conversation context. Checks existing memories for duplicates — only adds what's genuinely new. Use `--dry-run` to preview without writing. Requires `ANTHROPIC_API_KEY`.
|
|
140
|
+
|
|
141
|
+
**`gnosys tags`**
|
|
142
|
+
List all tags in the registry, grouped by category.
|
|
143
|
+
|
|
144
|
+
**`gnosys tags-add --category <cat> --tag <tag>`**
|
|
145
|
+
Add a new tag to the registry.
|
|
146
|
+
|
|
147
|
+
**`gnosys stores`**
|
|
148
|
+
Show all active stores with their layers, paths, and write permissions.
|
|
149
|
+
|
|
150
|
+
**`gnosys serve`**
|
|
151
|
+
Start the MCP server in stdio mode (used by editors and agent runtimes).
|
|
152
|
+
|
|
153
|
+
### Getting Help
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
gnosys --help # List all commands
|
|
157
|
+
gnosys help <command> # Detailed help for a command
|
|
158
|
+
gnosys <command> --help # Same as above
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## MCP Server Setup
|
|
162
|
+
|
|
163
|
+
### Cursor
|
|
164
|
+
|
|
165
|
+
Add to your Cursor MCP settings (`.cursor/mcp.json` in your project or global config):
|
|
166
|
+
|
|
167
|
+
```json
|
|
168
|
+
{
|
|
169
|
+
"mcpServers": {
|
|
170
|
+
"gnosys": {
|
|
171
|
+
"command": "node",
|
|
172
|
+
"args": ["/path/to/gnosys-mcp/dist/index.js"],
|
|
173
|
+
"env": {
|
|
174
|
+
"ANTHROPIC_API_KEY": "your-key-here"
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Claude Desktop
|
|
182
|
+
|
|
183
|
+
Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or the equivalent config on your platform:
|
|
184
|
+
|
|
185
|
+
```json
|
|
186
|
+
{
|
|
187
|
+
"mcpServers": {
|
|
188
|
+
"gnosys": {
|
|
189
|
+
"command": "node",
|
|
190
|
+
"args": ["/path/to/gnosys-mcp/dist/index.js"],
|
|
191
|
+
"env": {
|
|
192
|
+
"ANTHROPIC_API_KEY": "your-key-here"
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### MCP Tools
|
|
200
|
+
|
|
201
|
+
The MCP server exposes the same operations as the CLI:
|
|
202
|
+
|
|
203
|
+
| Tool | Description |
|
|
204
|
+
|------|-------------|
|
|
205
|
+
| `gnosys_discover` | Find relevant memories by keyword |
|
|
206
|
+
| `gnosys_read` | Read a specific memory |
|
|
207
|
+
| `gnosys_search` | Full-text search across stores |
|
|
208
|
+
| `gnosys_list` | List memories with optional filters |
|
|
209
|
+
| `gnosys_add` | Add a memory (LLM-structured) |
|
|
210
|
+
| `gnosys_add_structured` | Add a memory (explicit fields) |
|
|
211
|
+
| `gnosys_update` | Update frontmatter or content |
|
|
212
|
+
| `gnosys_reinforce` | Signal usefulness of a memory |
|
|
213
|
+
| `gnosys_stale` | Find stale memories |
|
|
214
|
+
| `gnosys_commit_context` | Extract and commit memories from context |
|
|
215
|
+
| `gnosys_tags` | List tag registry |
|
|
216
|
+
| `gnosys_tags_add` | Add a tag to the registry |
|
|
217
|
+
| `gnosys_init` | Initialize a new store |
|
|
218
|
+
| `gnosys_stores` | Show active stores |
|
|
219
|
+
|
|
220
|
+
## Layered Stores
|
|
221
|
+
|
|
222
|
+
Gnosys supports multiple stores stacked in precedence order, so project-specific knowledge can override personal defaults, which can override shared organizational knowledge.
|
|
223
|
+
|
|
224
|
+
| Layer | Source | Writable | Use Case |
|
|
225
|
+
|-------|--------|----------|----------|
|
|
226
|
+
| **Project** | `.gnosys/` in project root | Yes (default) | Project-specific decisions and architecture |
|
|
227
|
+
| **Optional** | `GNOSYS_STORES` env var | Read-only | Shared reference knowledge |
|
|
228
|
+
| **Personal** | `GNOSYS_PERSONAL` env var | Yes (fallback) | Cross-project personal knowledge |
|
|
229
|
+
| **Global** | `GNOSYS_GLOBAL` env var | Explicit only | Organization-wide shared knowledge |
|
|
230
|
+
|
|
231
|
+
Writes go to the project store by default. Global writes require `--store global` to prevent accidental changes to shared knowledge.
|
|
232
|
+
|
|
233
|
+
### Environment Variables
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
# Optional: API key for LLM-powered features (add, commit-context)
|
|
237
|
+
export ANTHROPIC_API_KEY="sk-ant-..."
|
|
238
|
+
|
|
239
|
+
# Optional: Personal knowledge store (cross-project)
|
|
240
|
+
export GNOSYS_PERSONAL="$HOME/.gnosys-personal"
|
|
241
|
+
|
|
242
|
+
# Optional: Organization-wide shared knowledge
|
|
243
|
+
export GNOSYS_GLOBAL="/shared/team/.gnosys"
|
|
244
|
+
|
|
245
|
+
# Optional: Additional read-only stores (colon-separated)
|
|
246
|
+
export GNOSYS_STORES="/path/to/store1:/path/to/store2"
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
You can also place your API key in `~/.config/gnosys/.env`:
|
|
250
|
+
|
|
251
|
+
```
|
|
252
|
+
ANTHROPIC_API_KEY=sk-ant-...
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## Agent Integration Guide
|
|
256
|
+
|
|
257
|
+
### Recommended Agent Workflow
|
|
258
|
+
|
|
259
|
+
1. **Start of session**: Call `gnosys_discover` with keywords about the current task to load relevant context.
|
|
260
|
+
2. **During work**: When making decisions or learning something new, call `gnosys_add` to persist it.
|
|
261
|
+
3. **When things change**: Use `gnosys_update` with `supersedes` to create clean revision chains.
|
|
262
|
+
4. **End of session**: Call `gnosys_commit_context` with a summary of the conversation to extract and persist novel knowledge before context is lost.
|
|
263
|
+
|
|
264
|
+
### Memory Quality Tips
|
|
265
|
+
|
|
266
|
+
- Write **atomic memories** — one decision, fact, or insight per file.
|
|
267
|
+
- Use **specific relevance keywords** — think about what someone would search for to find this memory.
|
|
268
|
+
- Set **confidence scores honestly** — a hunch is 0.5, a firm decision is 0.9.
|
|
269
|
+
- Use **supersession** instead of editing — when a decision changes, create a new memory that `supersedes` the old one. This preserves the history of why things changed.
|
|
270
|
+
|
|
271
|
+
## Development
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
npm install # Install dependencies
|
|
275
|
+
npm run build # Compile TypeScript
|
|
276
|
+
npm test # Run test suite (32 tests)
|
|
277
|
+
npm run test:watch # Run tests in watch mode
|
|
278
|
+
npm run dev # Run MCP server in dev mode (tsx)
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
### Architecture
|
|
282
|
+
|
|
283
|
+
```
|
|
284
|
+
src/
|
|
285
|
+
index.ts # MCP server — exposes all tools
|
|
286
|
+
cli.ts # CLI — thin wrapper around core modules
|
|
287
|
+
lib/
|
|
288
|
+
store.ts # Core: read/write/update memory files
|
|
289
|
+
search.ts # FTS5 search and discovery
|
|
290
|
+
tags.ts # Tag registry management
|
|
291
|
+
ingest.ts # LLM-powered structuring of raw input
|
|
292
|
+
resolver.ts # Layered multi-store resolution
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
## License
|
|
296
|
+
|
|
297
|
+
MIT
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;GAGG"}
|