threadnote 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/README.md ADDED
@@ -0,0 +1,205 @@
1
+ # Threadnote
2
+
3
+ `threadnote` is a safe local workflow for using OpenViking as shared, agent-neutral context for development work.
4
+ It is intentionally scoped to curated docs, memories, skills, and handoffs. It is not a source-navigation replacement,
5
+ and it does not index whole repositories by default.
6
+
7
+ ## Safety Model
8
+
9
+ - Curated manifests only: seed commands import only paths listed in `config/seed-manifest.example.yaml` or an explicit
10
+ per-developer manifest.
11
+ - Ignore rules: `.threadnoteignore` excludes build output, binary artifacts, local auth files, env files, and logs.
12
+ - Redaction: known config files such as `.mcp.json`, `config.toml`, and settings JSON are copied through a redactor
13
+ before import.
14
+ - Secret scanning: candidate files are skipped if common token or private-key patterns remain after redaction.
15
+ - User instructions: `install` upserts a managed Threadnote block in `~/.codex/AGENTS.md` and `~/.claude/CLAUDE.md`
16
+ without replacing existing personal instructions.
17
+ - Agent config changes are explicit: `mcp-install` prints commands and snippets by default; use `--apply` to run them.
18
+ - Machine writes stay under `THREADNOTE_HOME`, which defaults to `~/.openviking`.
19
+
20
+ ## Install
21
+
22
+ Install with one command:
23
+
24
+ ```bash
25
+ curl -fsSL https://raw.githubusercontent.com/Kashkovsky/threadnote/main/scripts/install.sh | sh
26
+ ```
27
+
28
+ This installs the published package from npmjs and runs `threadnote install`. It does not use npm `postinstall`,
29
+ because setup writes local machine config and should be an explicit action.
30
+
31
+ To force a runtime:
32
+
33
+ ```bash
34
+ curl -fsSL https://raw.githubusercontent.com/Kashkovsky/threadnote/main/scripts/install.sh | THREADNOTE_RUNTIME=bun sh
35
+ curl -fsSL https://raw.githubusercontent.com/Kashkovsky/threadnote/main/scripts/install.sh | THREADNOTE_RUNTIME=deno sh
36
+ ```
37
+
38
+ Or install manually:
39
+
40
+ ```bash
41
+ npm install --global threadnote
42
+ threadnote install
43
+ ```
44
+
45
+ For a one-off check before installing globally:
46
+
47
+ ```bash
48
+ npm exec --yes threadnote@latest -- doctor --dry-run
49
+ bunx threadnote@latest doctor --dry-run
50
+ deno run --allow-read --allow-env --allow-run --allow-net npm:threadnote@latest doctor --dry-run
51
+ ```
52
+
53
+ Avoid using `npm exec` for `threadnote install`; durable shims and MCP launchers should point at a stable global installation, not npm's temporary package cache.
54
+
55
+ ## Source Checkout
56
+
57
+ For local development from this repo:
58
+
59
+ ```bash
60
+ npm install
61
+ npm run build
62
+ npm run doctor -- --dry-run
63
+ npm run threadnote -- install
64
+ ```
65
+
66
+ `install` writes a small command shim to `~/.local/bin/threadnote` by default and upserts user-level agent guidance in
67
+ `~/.codex/AGENTS.md` and `~/.claude/CLAUDE.md`. After that, use the short command from any repo or working directory:
68
+
69
+ ```bash
70
+ threadnote doctor --dry-run
71
+ threadnote init-manifest --repo ~/src/my-service --repo ~/work/mobile-app
72
+ threadnote start
73
+ threadnote seed --dry-run
74
+ threadnote seed-skills --dry-run
75
+ ```
76
+
77
+ If `~/.local/bin` is not on your `PATH`, either add it or set `THREADNOTE_BIN_DIR` before running `install`.
78
+ After reviewing dry-run output, remove `--dry-run` for the operation you want to perform.
79
+
80
+ The bundled `config/seed-manifest.example.yaml` is only an example. Each developer should create a local manifest at
81
+ `~/.openviking/seed-manifest.yaml` with `threadnote init-manifest`; repo paths can be anywhere.
82
+
83
+ ## Commands
84
+
85
+ - `doctor`: checks prerequisites, the generated command shim, manifest shape, templates, and local OpenViking health.
86
+ - `install`: installs `openviking[local-embed]==0.3.12` if missing, creates `~/.openviking` config files if absent,
87
+ writes the command shim, and upserts user-level agent instructions.
88
+ - `repair`: fixes install/config/shim/manifest/server health issues and rewrites Codex/Claude MCP configs from the
89
+ current checkout.
90
+ - `start`: starts `openviking-server` on `127.0.0.1:1933`.
91
+ - `stop`: stops the detached server pid or macOS LaunchAgent.
92
+ - `init-manifest`: creates or updates `~/.openviking/seed-manifest.yaml` from one or more developer repo roots.
93
+ - `seed`: imports curated repo guidance and docs from the manifest.
94
+ - `seed-skills`: imports global and repo-local `SKILL.md` files as a searchable resource catalog. Use
95
+ `seed-skills --native` only after configuring a working VLM provider.
96
+ - `mcp-install codex|claude`: installs or prints OpenViking MCP configuration for Codex or Claude.
97
+ - `remember`: stores a durable memory.
98
+ - `recall`: searches shared OpenViking context. It infers repo or skill scope from queries like
99
+ `skills for api service`; use `--uri` or `--no-infer-scope` to override.
100
+ - `read`: reads a `viking://` URI returned by `recall` or `list`.
101
+ - `list` / `ls`: lists a `viking://` directory.
102
+ - `handoff`: stores current git state and next-step notes as a durable handoff.
103
+ - `forget`: removes a `viking://` URI.
104
+ - `export-pack` / `import-pack`: moves local context through `.ovpack` files.
105
+
106
+ ## Configuration
107
+
108
+ Environment variables:
109
+
110
+ - `THREADNOTE_HOME`: local state directory, default `~/.openviking`.
111
+ - `THREADNOTE_MANIFEST`: seed manifest path. Defaults to `~/.openviking/seed-manifest.yaml` if present, otherwise
112
+ the bundled example manifest.
113
+ - `THREADNOTE_ACCOUNT`: OpenViking account header/config value, default `local`.
114
+ - `THREADNOTE_USER`: OpenViking user value, default local username.
115
+ - `THREADNOTE_AGENT_ID`: shared agent identity, default `threadnote`.
116
+ - `THREADNOTE_OPENVIKING_VERSION`: package version to install, default `0.3.12`.
117
+ - `THREADNOTE_BIN_DIR`: directory for the `threadnote` shim, default `~/.local/bin`.
118
+ - `THREADNOTE_HOST`: local bind host, default `127.0.0.1`.
119
+ - `THREADNOTE_PORT`: local bind port, default `1933`.
120
+
121
+ Local projects using `localhost:80` or `localhost:443` do not conflict with OpenViking on `127.0.0.1:1933`. A conflict
122
+ only occurs when another process already owns the same host and port. If that happens, choose a different
123
+ `THREADNOTE_PORT`.
124
+
125
+ ## MCP
126
+
127
+ Dry-run examples:
128
+
129
+ ```bash
130
+ threadnote mcp-install codex
131
+ threadnote mcp-install claude
132
+ ```
133
+
134
+ Apply after review:
135
+
136
+ ```bash
137
+ threadnote mcp-install codex --apply
138
+ threadnote mcp-install claude --apply
139
+ ```
140
+
141
+ Claude installs at `user` scope by default so the same OpenViking MCP server is available from any repo or worktree.
142
+ Use `--scope local` or `--scope project` only when you intentionally want repo-scoped Claude MCP config.
143
+
144
+ If the package or checkout that originally installed `threadnote` has moved, run repair:
145
+
146
+ ```bash
147
+ threadnote repair
148
+ ```
149
+
150
+ This rewrites the `threadnote` shim and reinstalls the stdio MCP adapter for available agents so launcher paths point
151
+ at the current checkout.
152
+
153
+ The default install uses the bundled stdio MCP adapter, because OpenViking `0.3.12` does not expose the native `/mcp`
154
+ HTTP route:
155
+
156
+ ```bash
157
+ codex mcp add threadnote -- threadnote-mcp-server
158
+ claude mcp add threadnote -- threadnote-mcp-server
159
+ ```
160
+
161
+ If a future OpenViking build exposes a healthy native endpoint, install it explicitly:
162
+
163
+ ```bash
164
+ threadnote mcp-install claude --native-http --apply
165
+ ```
166
+
167
+ ## Notes
168
+
169
+ OpenViking itself is not vendored here. This prototype installs and controls a local service and should get legal and
170
+ security review before broader rollout.
171
+
172
+ ## Publishing
173
+
174
+ The npm package ships bundled CommonJS `.cjs` entrypoints in `dist/`; `tsx` is only used by `npm run dev` for
175
+ source-checkout development. There is no published TypeScript runner and no runtime npm dependency tree. The generated
176
+ user shim tries Node, Bun, then Deno.
177
+
178
+ ```bash
179
+ npm run typecheck
180
+ npm run build
181
+ npm pack --dry-run
182
+ npm publish
183
+ ```
184
+
185
+ See `docs/migration.md` for switching an existing repo workflow to `threadnote` without deleting canonical
186
+ `AGENTS.md`, `CLAUDE.md`, `.claude/`, or `.agents/` files.
187
+
188
+ See `docs/demo.md` for an engineer-facing demo script that shows recall, read, remember, handoff, and repair across
189
+ agents or worktrees.
190
+
191
+ See `docs/agent-instructions.md` for the user-level agent guidance installed by `threadnote install`.
192
+
193
+ ## Recall And Read
194
+
195
+ Recall is a search step. It returns candidate `viking://` URIs plus abstracts. Agents should then read or list the
196
+ selected URI:
197
+
198
+ ```bash
199
+ threadnote recall --query "agent context"
200
+ threadnote read viking://agent/threadnote/memories/.abstract.md
201
+ threadnote list viking://agent/threadnote/memories --all --recursive
202
+ ```
203
+
204
+ When MCP is installed, the agent should use OpenViking MCP `search`, then `read` or `list` directly. The CLI commands
205
+ are the fallback path.
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ require('../dist/mcp_server.cjs');
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ require('../dist/threadnote.cjs');
@@ -0,0 +1,31 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>Label</key>
6
+ <string>io.threadnote.openviking</string>
7
+ <key>ProgramArguments</key>
8
+ <array>
9
+ <string>openviking-server</string>
10
+ <string>--config</string>
11
+ <string>{{THREADNOTE_HOME}}/ov.conf</string>
12
+ <string>--host</string>
13
+ <string>{{OPENVIKING_HOST}}</string>
14
+ <string>--port</string>
15
+ <string>{{OPENVIKING_PORT}}</string>
16
+ </array>
17
+ <key>EnvironmentVariables</key>
18
+ <dict>
19
+ <key>OPENVIKING_CONFIG_FILE</key>
20
+ <string>{{THREADNOTE_HOME}}/ov.conf</string>
21
+ </dict>
22
+ <key>RunAtLoad</key>
23
+ <true/>
24
+ <key>KeepAlive</key>
25
+ <true/>
26
+ <key>StandardOutPath</key>
27
+ <string>{{THREADNOTE_HOME}}/logs/server.log</string>
28
+ <key>StandardErrorPath</key>
29
+ <string>{{THREADNOTE_HOME}}/logs/server.log</string>
30
+ </dict>
31
+ </plist>
@@ -0,0 +1,14 @@
1
+ {
2
+ "default_account": "{{OPENVIKING_ACCOUNT}}",
3
+ "default_user": "{{OPENVIKING_USER}}",
4
+ "default_agent": "{{OPENVIKING_AGENT_ID}}",
5
+ "storage": {
6
+ "workspace": "{{THREADNOTE_HOME}}/data"
7
+ },
8
+ "auto_generate_l0": false,
9
+ "auto_generate_l1": false,
10
+ "server": {
11
+ "host": "{{OPENVIKING_HOST}}",
12
+ "port": "{{OPENVIKING_PORT}}"
13
+ }
14
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "url": "http://{{OPENVIKING_HOST}}:{{OPENVIKING_PORT}}",
3
+ "account": "{{OPENVIKING_ACCOUNT}}",
4
+ "user": "{{OPENVIKING_USER}}",
5
+ "agent_id": "{{OPENVIKING_AGENT_ID}}",
6
+ "timeout": 60
7
+ }
@@ -0,0 +1,15 @@
1
+ # Example only. Developers should generate ~/.openviking/seed-manifest.yaml from their own checkouts with:
2
+ # threadnote init-manifest --repo /path/to/repo
3
+ version: 1
4
+ projects:
5
+ - name: example-service
6
+ path: ~/src/example-service
7
+ uri: viking://resources/repos/example-service
8
+ seed:
9
+ - AGENTS.md
10
+ - CLAUDE.md
11
+ - .github/AGENTS.md
12
+ - .github/CLAUDE.md
13
+ - .claude/commands/*.md
14
+ - .claude/skills/**/SKILL.md
15
+ - docs/**/*.md