threadnote 0.2.2 → 0.3.1

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.
@@ -1,13 +1,18 @@
1
1
  # Agent Instructions
2
2
 
3
- Threadnote installs this as user-level agent guidance for Codex and Claude.
3
+ Threadnote installs this as user-level agent guidance for Codex, Claude, and Cursor.
4
4
 
5
5
  ## Shared Context
6
6
 
7
7
  Use OpenViking through Threadnote as a shared local context and memory layer. Repo files remain authoritative: always
8
8
  follow the nearest `AGENTS.md`, `CLAUDE.md`, or other checked-in instruction file first.
9
9
 
10
- When OpenViking MCP tools are available, use them directly. If MCP is unavailable, use the `threadnote` CLI fallback.
10
+ When OpenViking MCP tools are available, use them directly. Prefer Threadnote-named MCP tools when present:
11
+ `recall_context`, `read_context`, `list_context`, and `remember_context`. Always pass JSON arguments to MCP tools, for
12
+ example `recall_context({"query":"current repo latest handoff"})`. Older Threadnote MCP adapters may expose
13
+ `search`, `read`, `list`, and `store` instead.
14
+
15
+ If MCP is unavailable, use the `threadnote` CLI fallback.
11
16
 
12
17
  ## Recall
13
18
 
package/docs/migration.md CHANGED
@@ -46,9 +46,9 @@ Create a handoff for the next agent before you stop.
46
46
  ```
47
47
 
48
48
  For better continuity, run `threadnote install` so it can add the agent-side guidance from `docs/agent-instructions.md`
49
- to the user-level `~/.codex/AGENTS.md` and `~/.claude/CLAUDE.md` files. That guidance tells agents to recall context at
50
- task start, store durable memories when explicitly asked or when a reusable workflow fact is learned, and create
51
- handoffs automatically before stopping meaningful work.
49
+ to user-level Codex, Claude, and Cursor instruction files. That guidance tells agents to recall context at task start,
50
+ store durable memories when explicitly asked or when a reusable workflow fact is learned, and create handoffs
51
+ automatically before stopping meaningful work.
52
52
 
53
53
  ## Migration Steps
54
54
 
@@ -133,6 +133,15 @@ paths.
133
133
  Claude installs at user scope by default so it works from every repo/worktree. Use `--scope local` only when a
134
134
  repo-specific Claude MCP entry is intentional.
135
135
 
136
+ For Cursor:
137
+
138
+ ```bash
139
+ threadnote mcp-install cursor
140
+ threadnote mcp-install cursor --apply
141
+ ```
142
+
143
+ Cursor installs by updating the global `~/.cursor/mcp.json` file.
144
+
136
145
  Later, if the checkout that installed the MCP adapter is deleted or moved, repair it from any fresh checkout:
137
146
 
138
147
  ```bash
@@ -158,8 +167,7 @@ Remember this workflow note for future agents: ...
158
167
  Create a handoff now.
159
168
  ```
160
169
 
161
- Preferred agent behavior is automatic after `threadnote install` has updated the user-level Codex and Claude instruction
162
- files:
170
+ Preferred agent behavior is automatic after `threadnote install` has updated the user-level instruction files:
163
171
 
164
172
  - On non-trivial task start, search OpenViking for recent handoffs and relevant repo guidance.
165
173
  - When the user says "remember", store the memory after checking that it contains no secret or customer data.
package/docs/rollout.md CHANGED
@@ -18,7 +18,7 @@ Start with a local-only pilot.
18
18
 
19
19
  - Install completes in under 10 minutes after prerequisites.
20
20
  - `doctor` reports clear actionable checks.
21
- - Codex and Claude can both store and recall a shared handoff.
21
+ - Codex, Claude, or Cursor can store and recall a shared handoff after MCP setup.
22
22
  - Seeding curated guidance does not import known secret patterns.
23
23
  - Fresh agents can recall repo testing guidance and discover relevant skills.
24
24
  - `uninstall --dry-run` previews removal, and `uninstall` leaves memories intact unless `--erase-memories` is explicit.
package/docs/security.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  - Credentials, access tokens, API keys, certificates, private keys, or shell history.
8
8
  - Customer data, production data, HIPAA data, or production logs without explicit approval and scrubbing.
9
- - Local auth files such as `~/.codex/auth.json` or `~/.claude/.credentials.json`.
9
+ - Local auth files such as `~/.codex/auth.json`, `~/.claude/.credentials.json`, or Cursor account/session files.
10
10
  - Local settings files that may contain secrets unless they go through redaction.
11
11
 
12
12
  ## Built-In Controls
@@ -14,9 +14,9 @@
14
14
  - `.threadnoteignore` excludes common secret and build-output paths.
15
15
  - `.mcp.json`, `config.toml`, and settings JSON are redacted before import.
16
16
  - Files are skipped if common secret patterns remain after redaction.
17
- - `mcp-install` requires `--apply` before it changes Codex or Claude config.
18
- - `install` updates user-level Codex and Claude instruction files through a managed Markdown block. Existing personal
19
- instructions outside that block are preserved.
17
+ - `mcp-install` requires `--apply` before it changes Codex, Claude, or Cursor config.
18
+ - `install` updates user-level Codex, Claude, and Cursor instruction files through a managed Markdown block. Existing
19
+ personal instructions outside that block are preserved.
20
20
  - `uninstall` preserves local memories by default. `--erase-memories` is required before deleting `THREADNOTE_HOME`.
21
21
  - Config files created under `THREADNOTE_HOME` are written with user-only permissions.
22
22
 
@@ -147,7 +147,7 @@ threadnote repair
147
147
  ```
148
148
 
149
149
  `repair` reinstalls the `threadnote` shim, repairs generated config files, starts OpenViking if needed, and rewrites
150
- Codex/Claude MCP configs to point at the current checkout.
150
+ Codex/Claude/Cursor MCP configs to point at the current checkout.
151
151
 
152
152
  ## MCP Install Is Only Printing Commands
153
153
 
@@ -157,6 +157,27 @@ This is expected. Run with `--apply` after reviewing the command:
157
157
  threadnote mcp-install codex --apply
158
158
  ```
159
159
 
160
+ For Cursor:
161
+
162
+ ```bash
163
+ threadnote mcp-install cursor --apply
164
+ ```
165
+
166
+ This updates the global `~/.cursor/mcp.json` file. Restart Cursor or open a fresh agent session after changing MCP
167
+ config.
168
+
169
+ ## Cursor MCP Tool Says Query Is Missing
170
+
171
+ If Cursor shows an error like `expected string, received undefined` for Threadnote `search`, the MCP server started but
172
+ Cursor called the tool without JSON arguments. Prefer the Threadnote-named tool and pass a query explicitly:
173
+
174
+ ```json
175
+ {"query": "current repo latest handoff"}
176
+ ```
177
+
178
+ Current Threadnote adapters expose `recall_context` for this flow. Older adapters expose `search`; both require the same
179
+ `query` argument. Run `threadnote repair` after upgrading if Cursor still lists only stale tools.
180
+
160
181
  ## Uninstall Without Losing Memories
161
182
 
162
183
  Run:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "threadnote",
3
- "version": "0.2.2",
3
+ "version": "0.3.1",
4
4
  "type": "commonjs",
5
5
  "main": "dist/threadnote.cjs",
6
6
  "description": "Shared local context and handoffs for development agents",
@@ -39,11 +39,17 @@
39
39
  "scripts/"
40
40
  ],
41
41
  "scripts": {
42
- "build": "npm run clean --silent && esbuild threadnote.ts --bundle --platform=node --format=cjs --target=node20 --outfile=dist/threadnote.cjs && esbuild mcp_server.ts --bundle --platform=node --format=cjs --target=node20 --outfile=dist/mcp_server.cjs",
42
+ "build": "npm run clean --silent && esbuild src/threadnote.ts --bundle --platform=node --format=cjs --target=node20 --outfile=dist/threadnote.cjs && esbuild src/mcp_server.ts --bundle --platform=node --format=cjs --target=node20 --outfile=dist/mcp_server.cjs",
43
43
  "clean": "rm -rf dist",
44
- "dev": "tsx threadnote.ts",
45
- "dev:mcp-server": "tsx mcp_server.ts",
44
+ "dev": "tsx src/threadnote.ts",
45
+ "dev:mcp-server": "tsx src/mcp_server.ts",
46
+ "lint": "eslint \"src/**/*.ts\"",
47
+ "lint:fix": "eslint \"src/**/*.ts\" --fix",
48
+ "prepare": "husky",
49
+ "precommit": "npm run lint && npm run prettier:check",
46
50
  "prepack": "npm run build",
51
+ "prettier:check": "prettier --check \"**/*.{ts,js,cjs,json,md,yaml,yml}\"",
52
+ "prettier:write": "prettier --write \"**/*.{ts,js,cjs,json,md,yaml,yml}\"",
47
53
  "threadnote": "npm run build --silent && node ./bin/threadnote.cjs",
48
54
  "doctor": "npm run build --silent && node ./bin/threadnote.cjs doctor",
49
55
  "mcp-server": "npm run build --silent && node ./bin/threadnote-mcp-server.cjs",
@@ -54,14 +60,20 @@
54
60
  "node": ">=20"
55
61
  },
56
62
  "devDependencies": {
63
+ "@eslint/js": "^10.0.1",
57
64
  "@modelcontextprotocol/sdk": "^1.29.0",
58
65
  "@types/js-yaml": "^4.0.9",
59
66
  "@types/node": "^25.6.0",
60
67
  "commander": "^14.0.3",
61
68
  "esbuild": "^0.27.7",
69
+ "eslint": "^10.3.0",
70
+ "globals": "^17.6.0",
71
+ "husky": "^9.1.7",
62
72
  "js-yaml": "^4.1.1",
73
+ "prettier": "^3.8.3",
63
74
  "tsx": "^4.21.0",
64
75
  "typescript": "^6.0.3",
76
+ "typescript-eslint": "^8.59.2",
65
77
  "zod": "^4.4.3"
66
78
  }
67
79
  }
@@ -130,3 +130,4 @@ say " threadnote start"
130
130
  say " threadnote doctor --dry-run"
131
131
  say " threadnote mcp-install codex --apply # if you use Codex"
132
132
  say " threadnote mcp-install claude --apply # if you use Claude"
133
+ say " threadnote mcp-install cursor --apply # if you use Cursor"
package/docs/demo.md DELETED
@@ -1,279 +0,0 @@
1
- # Demo: Cross-Agent Development Context
2
-
3
- This demo shows `threadnote` as a shared local memory layer for engineering work. The story is intentionally simple:
4
- one agent starts a task in a worktree, stores a handoff, and another agent or worktree recalls it without the
5
- developer copy-pasting chat history, PR notes, or terminal output.
6
-
7
- ## Demo Goal
8
-
9
- Show engineers that:
10
-
11
- - repo instructions still live in `AGENTS.md`, `CLAUDE.md`, and checked-in docs;
12
- - OpenViking adds durable, searchable context across agent sessions, worktrees, and repos;
13
- - agents should use MCP directly, while `threadnote` is the human-readable fallback and diagnostic path;
14
- - memories survive branch merges and worktree deletion because they live under the developer's OpenViking home, not in
15
- the git worktree;
16
- - `repair` fixes the common stale-worktree and MCP launcher problems that show up during real local development.
17
-
18
- ## Use Case
19
-
20
- Use "continue a PR after switching agents" as the live scenario.
21
-
22
- The engineer has a PR that updates a local tool. Codex has already done some work and creates a handoff. The engineer
23
- opens Claude, or a fresh Codex session from another repo/worktree, and asks it to continue. The new agent
24
- recalls the handoff, reads the relevant `viking://` memory, discovers repo guidance, and stores an updated handoff when
25
- it finishes.
26
-
27
- This is the highest-signal demo because it exercises the behavior engineers actually feel every day: context transfer,
28
- stale local setup, and "what did the previous agent already learn?"
29
-
30
- ## Prep Checklist
31
-
32
- Run these before the meeting from this checkout:
33
-
34
- ```bash
35
- npm install
36
- npm run doctor -- --dry-run
37
- npm run threadnote -- install
38
- threadnote start
39
- threadnote doctor --dry-run
40
- threadnote init-manifest --repo "$(pwd)"
41
- threadnote seed --dry-run
42
- threadnote seed
43
- threadnote seed-skills --dry-run
44
- threadnote seed-skills
45
- threadnote mcp-install codex --apply
46
- threadnote mcp-install claude --apply
47
- ```
48
-
49
- Open a fresh Codex or Claude session after installing MCP. Existing sessions may not pick up newly registered MCP
50
- servers.
51
-
52
- Optional: create a deterministic demo handoff so the search result is easy to find.
53
-
54
- ```bash
55
- threadnote handoff \
56
- --task "Demo PR: continue the threadnote rollout after adding repair and docs" \
57
- --tests "doctor --dry-run, mcp-install dry runs, local TypeScript checks" \
58
- --next-step "Recall this handoff, read the most relevant viking URI, then summarize what changed and what to do next"
59
- ```
60
-
61
- ## Live Script
62
-
63
- ### 1. Open With The Problem
64
-
65
- Say:
66
-
67
- ```text
68
- When we switch from one agent session to another, we usually lose the useful middle: what was tried, what failed, what
69
- the branch is about, and what the next agent should avoid re-discovering. This tool gives agents a shared local context
70
- layer without replacing repo instructions or indexing entire repos.
71
- ```
72
-
73
- Show that the repo still has normal instructions:
74
-
75
- ```bash
76
- ls AGENTS.md CLAUDE.md
77
- ```
78
-
79
- ### 2. Show Local Health
80
-
81
- Run:
82
-
83
- ```bash
84
- threadnote doctor --dry-run
85
- threadnote start
86
- ```
87
-
88
- Say:
89
-
90
- ```text
91
- The server is local. The default is 127.0.0.1:1933, so it does not conflict with apps running on localhost:80 or
92
- localhost:443. If the exact port is taken, we can set THREADNOTE_PORT.
93
- ```
94
-
95
- ### 3. Show MCP Is Installed
96
-
97
- Run the client-specific check you want to demo:
98
-
99
- ```bash
100
- codex mcp list
101
- claude mcp list
102
- ```
103
-
104
- Say:
105
-
106
- ```text
107
- MCP is the expected agent path. The CLI exists so humans can inspect, repair, and reproduce what the agent is doing.
108
- Claude installs at user scope by default, so it works from other repos and worktrees.
109
- ```
110
-
111
- If the MCP server does not appear in an already-open agent session, restart that session after `mcp-install --apply`.
112
-
113
- ### 4. Recall The Previous Handoff
114
-
115
- In the agent UI, ask:
116
-
117
- ```text
118
- Before touching code, recall recent OpenViking context for this branch and read the most relevant handoff.
119
- ```
120
-
121
- For a terminal fallback, run:
122
-
123
- ```bash
124
- threadnote recall --query "last handoff for threadnote rollout"
125
- ```
126
-
127
- Point out that recall returns candidate `viking://` URIs and abstracts. Then read the best match:
128
-
129
- ```bash
130
- threadnote read "<paste the most relevant viking:// URI>"
131
- ```
132
-
133
- Say:
134
-
135
- ```text
136
- Search is intentionally a pointer step. The agent should read or list the selected URI before treating it as context.
137
- That keeps recall cheap and makes the result auditable.
138
- ```
139
-
140
- ### 5. Discover Repo Guidance
141
-
142
- Ask the agent:
143
-
144
- ```text
145
- Find any repo guidance or skills that matter for this task before you continue.
146
- ```
147
-
148
- Terminal fallback:
149
-
150
- ```bash
151
- threadnote recall --query "repo agent instructions testing guidance"
152
- threadnote recall --query "skills for this repo"
153
- ```
154
-
155
- Say:
156
-
157
- ```text
158
- This is not source navigation. It is a curated catalog of instructions, skills, and durable notes that helps the agent
159
- start in the right neighborhood.
160
- ```
161
-
162
- ### 6. Show Cross-Repo Or Cross-Worktree Continuity
163
-
164
- Switch to another repo or worktree and run the same recall:
165
-
166
- ```bash
167
- cd ~/work/another-repo
168
- threadnote recall --query "last handoff for threadnote rollout"
169
- ```
170
-
171
- Or ask a fresh Claude session from another repo:
172
-
173
- ```text
174
- Use OpenViking to recall the latest handoff for the threadnote rollout and summarize the next step.
175
- ```
176
-
177
- Say:
178
-
179
- ```text
180
- The repo list is developer-local and manifest-driven. Nothing assumes a fixed source path. Memories are stored in the
181
- local OpenViking home, so deleting a worktree removes launcher paths, not the remembered handoff.
182
- ```
183
-
184
- ### 7. Remember A Durable Fact
185
-
186
- Ask the agent:
187
-
188
- ```text
189
- Remember this workflow fact: threadnote MCP for Claude should be installed at user scope so it works from any repo or
190
- worktree.
191
- ```
192
-
193
- Terminal fallback:
194
-
195
- ```bash
196
- threadnote remember \
197
- --text "Workflow fact: install Claude OpenViking MCP at user scope so it works from any repo or worktree."
198
- ```
199
-
200
- Say:
201
-
202
- ```text
203
- The rule is: remember durable workflow facts, not secrets, customer data, raw logs, or long diffs. Canonical repo rules
204
- should still be checked in.
205
- ```
206
-
207
- ### 8. Create The Next Handoff
208
-
209
- Ask the agent:
210
-
211
- ```text
212
- Create a handoff for the next agent with the current status, tests run, blockers, and next step.
213
- ```
214
-
215
- Terminal fallback:
216
-
217
- ```bash
218
- threadnote handoff \
219
- --task "Demo: verified cross-agent recall for the threadnote rollout" \
220
- --tests "doctor --dry-run, recall, read, remember, handoff" \
221
- --next-step "Open a fresh agent session and ask it to recall this handoff before continuing"
222
- ```
223
-
224
- Say:
225
-
226
- ```text
227
- This is the part we want agents to do automatically before pausing or finishing meaningful code changes.
228
- ```
229
-
230
- ### 9. Show Repair
231
-
232
- Run:
233
-
234
- ```bash
235
- threadnote repair --dry-run
236
- ```
237
-
238
- Say:
239
-
240
- ```text
241
- This catches the ugly local cases: stale command shims, MCP launchers pointing at deleted worktrees, missing manifests,
242
- and a stopped local server. Repair rewrites paths from the current checkout.
243
- ```
244
-
245
- ### 10. Close
246
-
247
- Say:
248
-
249
- ```text
250
- The important design choice is that this does not replace the repo. It makes the useful working memory around the repo
251
- available to whichever agent session picks up the task next.
252
- ```
253
-
254
- ## Expected Signals
255
-
256
- - `doctor --dry-run` reports no failures or prints concrete repair steps.
257
- - `recall` returns `memory`, `resource`, or `skill` rows with `viking://` URIs.
258
- - `read` turns a selected URI into actual handoff or memory content.
259
- - A fresh agent session can use the OpenViking MCP tools after MCP install.
260
- - `repair --dry-run` explains what it would fix without mutating anything.
261
-
262
- ## Recovery Branches
263
-
264
- - MCP is installed but the current agent says no OpenViking tools are registered: open a fresh agent session.
265
- - `claude mcp list` does not show OpenViking: run `threadnote mcp-install claude --apply`; the default scope is
266
- `user`.
267
- - `/health` is OK but `/mcp` fails: this is expected for OpenViking `0.3.12`; use the default stdio adapter instead of
268
- `--native-http`.
269
- - The old checkout or worktree was deleted: run
270
- `npm run threadnote -- repair` from any fresh checkout.
271
- - Recall returns only overview nodes: read the URI, or list the directory with
272
- `threadnote list <uri> --all --recursive`.
273
-
274
- ## What Not To Demo
275
-
276
- - Do not seed an entire repo.
277
- - Do not store secrets, tokens, customer data, raw production logs, or long diffs.
278
- - Do not present CLI commands as the ideal daily workflow. For normal work, the developer should ask the agent in
279
- natural language and the agent should use MCP directly.