granite-mem 0.1.9 → 0.1.11

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 (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +116 -55
  3. package/dist/index.js +1267 -295
  4. package/package.json +18 -6
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 The Vibe Company
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 CHANGED
@@ -1,14 +1,22 @@
1
1
  # Granite
2
2
 
3
+ <p align="center">
4
+ <a href="https://www.npmjs.com/package/granite-mem"><img src="https://img.shields.io/npm/v/granite-mem?color=111111" alt="npm version"></a>
5
+ <a href="https://www.npmjs.com/package/granite-mem"><img src="https://img.shields.io/npm/dm/granite-mem?color=111111" alt="npm downloads"></a>
6
+ <a href="https://github.com/The-Vibe-Company/Granite/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/The-Vibe-Company/Granite/ci.yml?branch=main&label=tests&color=111111" alt="CI status"></a>
7
+ <a href="LICENSE"><img src="https://img.shields.io/github/license/The-Vibe-Company/Granite?color=111111" alt="MIT license"></a>
8
+ <a href="https://github.com/The-Vibe-Company/Granite/stargazers"><img src="https://img.shields.io/github/stars/The-Vibe-Company/Granite?style=social" alt="GitHub stars"></a>
9
+ </p>
10
+
3
11
  > **The personal OS your agent runs on.**
4
- > Markdown files. One SQLite index. A contract your agent already knows how to operate.
12
+ > Markdown files. One SQLite index. A typed contract your agent already knows how to operate.
5
13
 
6
14
  <p align="center">
7
- <img src="docs/screenshots/granite-note.png" alt="Granite note view" width="720">
15
+ <img src="docs/screenshots/granite-graph.png" alt="Granite constellation graph" width="720">
8
16
  </p>
9
17
 
10
18
  <p align="center">
11
- <b>Install in one prompt.</b> Your agent does the rest.
19
+ <b>Install it with your agent.</b> Or run it standalone as a local markdown knowledge graph.
12
20
  </p>
13
21
 
14
22
  ---
@@ -33,69 +41,69 @@ Sixty seconds later you have a live vault, a connected agent that **knows how to
33
41
 
34
42
  That's the thesis of this project.
35
43
 
36
- ## What is Granite?
37
-
38
- Granite is a **local-first operating substrate** for the human + agent duo:
39
-
40
- - **Files you own.** Plain markdown with YAML frontmatter in `~/.granite`. No database, no lock-in, `git` works.
41
- - **Typed contracts, not folders.** Note types declare fields, hooks, indexed queries, and lifecycles. Create a `meeting` and the org stub, date default, and backlinks all fall into place automatically — deterministically, no LLM involved.
42
- - **Agent-native MCP.** The server *teaches* methodology: tools organized along `orient → research → inspect → plan → mutate`. Drop any MCP-capable LLM onto the vault and it can operate it without a system prompt.
43
- - **Hard boundary.** **No LLM, no embeddings, no scheduler inside Granite.** All intelligence lives in your agent. Granite is the disk, the schema, and the rules — never the brain.
44
-
45
- One loop: **capture → compile → query → output → lint**.
46
-
47
- ## Install prompts (copy-paste)
48
-
49
- ### Claude Code / Claude Desktop
50
-
51
- ```
52
- Install Granite for me:
53
- npm install -g granite-mem
54
- granite init --template founder-os
55
- claude mcp add granite -- granite mcp --vault ~/.granite
56
- After restart, call granite_wakeup and tell me what the vault looks like.
57
- ```
44
+ ## See it
45
+
46
+ <table>
47
+ <tr>
48
+ <td width="50%">
49
+ <img src="docs/screenshots/granite-graph.png" alt="Granite constellation graph">
50
+ <br>
51
+ <sub><b>Constellation graph.</b> Browse the vault as communities, hubs, and links.</sub>
52
+ </td>
53
+ <td width="50%">
54
+ <img src="docs/screenshots/granite-search.png" alt="Granite command palette search">
55
+ <br>
56
+ <sub><b>Command palette.</b> Search the vault and jump straight into the graph context.</sub>
57
+ </td>
58
+ </tr>
59
+ <tr>
60
+ <td width="50%">
61
+ <img src="docs/screenshots/granite-preview.png" alt="Granite note preview">
62
+ <br>
63
+ <sub><b>Graph-aware reading.</b> Preview notes without losing the surrounding context.</sub>
64
+ </td>
65
+ <td width="50%">
66
+ <img src="docs/screenshots/granite-note.png" alt="Granite reader view">
67
+ <br>
68
+ <sub><b>Floating reader.</b> Open a note without leaving the constellation.</sub>
69
+ </td>
70
+ </tr>
71
+ </table>
58
72
 
59
- ### Cursor
73
+ ## What is Granite?
60
74
 
61
- ```
62
- Run these commands, then add Granite to .cursor/mcp.json:
63
- npm install -g granite-mem
64
- granite init --template founder-os
75
+ A local-first markdown store with an opinionated flow. **No AI inside** — just plain files on disk, indexed by SQLite, queried deterministically.
65
76
 
66
- Append to .cursor/mcp.json:
67
- { "mcpServers": { "granite": { "command": "granite", "args": ["mcp", "--vault", "~/.granite"] } } }
77
+ - **Imposed flow.** Capture, compile, query, output, lint. The shape is fixed; the content is yours.
78
+ - **Four default note types** `note`, `source`, `synthesis`, `output`. Add your own in `granite.yml` when your life grows a new shape.
79
+ - **A specialized MCP** that teaches your agent how to use the vault. Drop any MCP-capable agent on it and it knows how to operate, no system prompt required.
68
80
 
69
- Reload Cursor. Then call granite_wakeup.
70
- ```
81
+ Your agent brings the intelligence. Granite holds the ground truth.
71
82
 
72
- ### ChatGPT / any HTTP-MCP client
83
+ ## Try it standalone
73
84
 
85
+ ```bash
86
+ npm install -g granite-mem
87
+ granite init
88
+ granite serve
74
89
  ```
75
- Start the Granite MCP over HTTP:
76
- granite mcp --transport http --host 127.0.0.1 --port 3321
77
- Then register http://127.0.0.1:3321 as an MCP server in your client.
78
- ```
79
-
80
- Every one of these leaves you with the same outcome: your agent owns the loop.
81
90
 
82
- ## What your agent can do with it
91
+ That starts with the default knowledge model: `note`, `source`, `synthesis`, and `output`. Add `--template founder-os` when you want people, organizations, meetings, and learnings wired in from the start.
83
92
 
84
- Once connected, these are real prompts that work **out of the box**:
93
+ ## Agent-native MCP
85
94
 
86
- > **"Process my inbox."**
87
- > The agent calls `granite_wakeup`, lists inbox notes, classifies each, rewrites them as durable `note`s, links them to existing people/orgs, and promotes `review_state: draft → reviewed`.
95
+ > "A thin MCP server exposes capabilities. A strong MCP server shapes behavior."
88
96
 
89
- > **"Summarize everything I know about [[acme-corp]] before the meeting at 3pm."**
90
- > `granite_compile_context` returns a typed brief: identity, recent meetings, people, open threads, links into related syntheses. One tool call. No fuzzy matching.
97
+ Granite's MCP surface is intention-first:
91
98
 
92
- > **"I just talked to Alice from Acme about local-first sync."**
93
- > `granite_capture_knowledge` creates a `meeting`, fills `date: today` via a hook, resolves `organization: Acme` to a slug (creates a stub if missing), links `attendees: [[alice]]`, and suggests three follow-up notes.
99
+ - `granite_wakeup` to orient
100
+ - `granite_research_topic` to inspect existing knowledge before writing
101
+ - `granite_query` for structured filters over typed notes
102
+ - `granite_compile_context` to assemble a graph-aware brief
103
+ - `granite_plan_garden` to decide what to improve next
104
+ - `granite_capture_knowledge` to write with protocol fields and type contracts
94
105
 
95
- > **"Garden the vault."**
96
- > `granite_plan_garden` returns the highest-leverage clusters to revisit. The agent opens the top three, revises them, and flags lifecycle transitions (`stale_days`) for your review.
97
-
98
- Every one of those is a single MCP round-trip, deterministic, auditable in `git log`.
106
+ The point is not to give an agent a file browser. The point is to give it a workflow it can follow.
99
107
 
100
108
  ## Types as active contracts
101
109
 
@@ -125,7 +133,7 @@ note_types:
125
133
  - `indexed_fields` — makes `granite_query { type: meeting, where: { date: { gte: "2026-01-01" } } }` O(1) and deterministic
126
134
  - `lifecycle` — `granite doctor` surfaces stale notes so gardening never drifts
127
135
 
128
- Add a type when your life has a new shape. The core stays small.
136
+ Add a type when your life has a new shape. The core stays small. For the formal protocol, see [docs/GRANITE_OBJECT_STANDARD.md](docs/GRANITE_OBJECT_STANDARD.md).
129
137
 
130
138
  ## Templates
131
139
 
@@ -134,7 +142,7 @@ granite init # minimal: note / source / synthesis / out
134
142
  granite init --template founder-os # + person / organization / meeting / learning
135
143
  ```
136
144
 
137
- `founder-os` is the full personal-OS starter: people you talk to, orgs you work with, meetings you had, things you learned. Nine types, already wired with hooks, indexed fields, and lifecycles. Open `templates/founder-os.yml` — it's 150 lines of pure YAML.
145
+ `founder-os` is the full personal-OS starter: people you talk to, orgs you work with, meetings you had, things you learned. Eight types, already wired with hooks, indexed fields, and lifecycles. Open `templates/founder-os.yml` — it's 150 lines of pure YAML.
138
146
 
139
147
  ## The hard boundary
140
148
 
@@ -167,9 +175,62 @@ Your agent reads these before writing and sets them as it works. You inherit a f
167
175
  - no cloud, no telemetry, no account
168
176
  - `git init` your vault and you have versioning for free
169
177
  - `granite serve` gives you a local web UI — browse, search, explore the graph
178
+ - `granite daemon start` runs MCP + web UI in one background process
179
+
180
+ ## Direct sync
181
+
182
+ Granite sync is direct machine-to-machine. Run it over LAN, Tailscale, or a private DNS name; there is no relay, hosted worker, billing tier, or cloud authority.
183
+
184
+ ```bash
185
+ # Machine A
186
+ granite sync access grant ipad --role read
187
+ granite sync access grant desktop --role write
188
+ granite sync serve --host 0.0.0.0 --port 8765
189
+
190
+ # Read-only Machine B
191
+ granite sync remote add macbook http://100.x.y.z:8765 --token <read-token>
192
+ granite sync pull macbook
193
+ granite sync watch macbook --direction pull --interval 30
194
+
195
+ # Write-capable Machine C
196
+ granite sync remote add macbook http://100.x.y.z:8765 --token <write-token>
197
+ granite sync run macbook
198
+ granite sync watch macbook --interval 30
199
+ ```
200
+
201
+ Conflicts default to manual preservation with `.conflict.<device>.<timestamp>.md` files. For a personal multi-device setup, pick the device that wins conflicts:
202
+
203
+ ```bash
204
+ granite sync config --policy primary-wins --primary-this-device
205
+ ```
206
+
207
+ MCP is scoped to one vault per server. Launch a read-only MCP server when an agent should inspect a synced vault without mutating it:
208
+
209
+ ```bash
210
+ granite mcp --vault ~/.granite --role read
211
+ granite mcp --vault ~/.granite --role write
212
+ ```
170
213
 
171
214
  For the full CLI, run `granite --help`. For development, see [CLAUDE.md](CLAUDE.md).
172
215
 
216
+ ## Roadmap & status
217
+
218
+ Granite is pre-1.0. The current release is **v0.1.9**, with the major agent-native loop pieces now in place: typed contracts, wakeup snapshots, deterministic garden planning, document import, daemon mode, and the constellation graph.
219
+
220
+ Read [CHANGELOG.md](CHANGELOG.md) for release history. The product boundary stays fixed: Granite stores and indexes local knowledge; agents bring the intelligence.
221
+
222
+ ## Contributing
223
+
224
+ Issues and focused PRs are welcome.
225
+
226
+ For local development, read [CLAUDE.md](CLAUDE.md). The key product rule is simple: no embedded LLM, no vector store, no autonomous scheduler inside Granite.
227
+
228
+ > Karpathy wrote that there was room for "an incredible new product instead of a hacky collection of scripts" around LLM knowledge bases.
229
+ >
230
+ > Granite is the product that answers that call.
231
+ >
232
+ > — [@karpathy on LLM knowledge bases](https://x.com/karpathy/status/2039805659525644595)
233
+
173
234
  ## Philosophy
174
235
 
175
236
  - local-first beats cloud dependence for personal memory