toolnet-memory 0.2.10 → 0.2.12

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 CHANGED
@@ -30,6 +30,43 @@ It stores durable working context such as:
30
30
 
31
31
  ToolNet Memory is **not a raw transcript dump**. Session history and durable project memory are treated separately, and only useful project context should be promoted into long-term memory.
32
32
 
33
+ ## Quick Start
34
+
35
+ ```bash
36
+ # Install globally (once per VPS/user)
37
+ curl -fsSL https://memory.toolnet.tech/install | bash
38
+
39
+ # Initialize project
40
+ cd /path/to/project
41
+ toolnet-memory init
42
+
43
+ # View fast startup context
44
+ toolnet-memory
45
+ ```
46
+
47
+ **Fast Context Output:**
48
+
49
+ ```text
50
+ # Profile
51
+
52
+ Your development preferences and coding style.
53
+
54
+ ---
55
+
56
+ # Current Work
57
+
58
+ Mission: Build authentication system
59
+ Objective: Implement OAuth2 flow
60
+ Phase: Implementation
61
+ Task: Add token refresh logic
62
+
63
+ Next Actions:
64
+ - [ ] Implement refresh token endpoint
65
+ - [ ] Add token expiry validation
66
+ ```
67
+
68
+ The default command (`toolnet-memory` with no arguments) prints fast startup context from local files only (~150ms, no network/storage access). This provides AI agents with immediate project context at session start.
69
+
33
70
  ## Installation
34
71
 
35
72
  ToolNet Memory is installed **once per VPS/user account**, not once per project.
@@ -61,6 +98,48 @@ toolnet-memory --version
61
98
  toolnet-memory doctor
62
99
  ```
63
100
 
101
+ ## Storage Configuration
102
+
103
+ ToolNet Memory supports multiple storage backends. **Cloudflare R2 is recommended** for production use due to zero egress fees and S3 compatibility.
104
+
105
+ ### Cloudflare R2 (Recommended)
106
+
107
+ ```bash
108
+ # In ~/.config/toolnet-memory/.env
109
+ STORAGE_PROVIDER=r2
110
+ R2_ACCOUNT_ID=your-account-id
111
+ R2_ACCESS_KEY_ID=your-access-key
112
+ R2_SECRET_ACCESS_KEY=your-secret-key
113
+ R2_BUCKET_NAME=toolnet-memory
114
+ ```
115
+
116
+ ### AWS S3 / S3-Compatible
117
+
118
+ ```bash
119
+ STORAGE_PROVIDER=s3
120
+ S3_REGION=us-east-1
121
+ S3_BUCKET=toolnet-memory
122
+ AWS_ACCESS_KEY_ID=your-access-key
123
+ AWS_SECRET_ACCESS_KEY=your-secret-key
124
+ ```
125
+
126
+ ### Hugging Face S3 (Legacy)
127
+
128
+ ```bash
129
+ STORAGE_PROVIDER=huggingface
130
+ HF_TOKEN=hf_your_token
131
+ HF_REPO=username/toolnet-memory
132
+ ```
133
+
134
+ ### Local Storage
135
+
136
+ ```bash
137
+ STORAGE_PROVIDER=local
138
+ LOCAL_STORAGE_PATH=/path/to/storage
139
+ ```
140
+
141
+ See [docs/STORAGE.md](docs/STORAGE.md) for detailed setup instructions.
142
+
64
143
  ## One-time VPS setup
65
144
 
66
145
  Global configuration is stored at:
@@ -75,7 +154,7 @@ Run setup once on a new VPS/user account:
75
154
  toolnet-memory setup
76
155
  ```
77
156
 
78
- The setup flow can configure Hugging Face-backed storage and detect supported coding agents. Credentials stay outside project repositories and must never be committed.
157
+ The setup flow can configure storage backend and detect supported coding agents. Credentials stay outside project repositories and must never be committed.
79
158
 
80
159
  ## Per-project setup
81
160
 
@@ -84,7 +163,12 @@ Each source project gets a stable identity and isolated remote namespace.
84
163
  ```bash
85
164
  cd /path/to/project
86
165
 
166
+ # Initialize project and create agent instruction files
167
+ toolnet-memory init
168
+
169
+ # Or manually:
87
170
  toolnet-memory project:manual-init --project "$PWD"
171
+ toolnet-memory profile:sync
88
172
  toolnet-memory index
89
173
  ```
90
174
 
@@ -92,19 +176,31 @@ ToolNet creates project metadata under:
92
176
 
93
177
  ```text
94
178
  .toolnet/
179
+ ├── profile.md # Your development preferences
180
+ └── current.md # Current work state
181
+ ```
182
+
183
+ And agent instruction files in the project root:
184
+
185
+ ```text
186
+ GEMINI.md # Instructions for Gemini/Agy
187
+ AGENTS.md # Standard agent instructions
188
+ CLAUDE.md # Instructions for Claude/Codex
95
189
  ```
96
190
 
191
+ These files provide fast startup context to AI agents without requiring network access or deep memory recovery.
192
+
97
193
  A stable project identity prevents memory from being mixed merely because folders are renamed or moved.
98
194
 
99
195
  Remote storage is scoped by project:
100
196
 
101
197
  ```text
102
198
  projects/<project-remote>/
103
- ├── memory/
104
- ├── code/
105
- ├── sessions/
106
- ├── work/
107
- └── snapshots/
199
+ ├── memory/ # Persistent project memory
200
+ ├── code/ # Code intelligence index
201
+ ├── sessions/ # Session transcripts (filtered)
202
+ ├── work/ # Work continuity state
203
+ └── snapshots/ # Project snapshots
108
204
  ```
109
205
 
110
206
  ## Agent integration
@@ -133,7 +229,72 @@ OpenCode ├──> ToolNet Memory ──> Project-scoped context
133
229
  Codex ┘
134
230
  ```
135
231
 
136
- The intended normal workflow does not require users to manually say save memory or load memory”. Agent/session hooks capture meaningful activity and restore relevant project context at the next session.
232
+ The intended normal workflow does not require users to manually say "save memory" or "load memory". Agent/session hooks capture meaningful activity and restore relevant project context at the next session.
233
+
234
+ ## Fast Context vs Deep Recovery
235
+
236
+ ToolNet Memory provides two levels of context:
237
+
238
+ ### Fast Context (Default)
239
+
240
+ Fast context reads only local files (`.toolnet/profile.md`, `.toolnet/current.md`) and completes in ~150ms without network or storage access. This is the default behavior and provides immediate startup context.
241
+
242
+ ```bash
243
+ # Fast context (default command)
244
+ toolnet-memory
245
+ toolnet-memory context:print
246
+
247
+ # Sync profile and current work to local files
248
+ toolnet-memory profile:sync
249
+ ```
250
+
251
+ ### Deep Recovery (Manual Only)
252
+
253
+ Deep memory recovery fetches full session history and project memory from remote storage. This is **manual only** and not run automatically at agent startup to avoid noise and latency.
254
+
255
+ ```bash
256
+ # Recover last 10 sessions (default limit)
257
+ toolnet-memory session:agy-recover
258
+
259
+ # Get latest handoff brief
260
+ toolnet-memory handoff:latest
261
+
262
+ # Full brief with memory
263
+ toolnet-memory brief
264
+ ```
265
+
266
+ Session transcripts are filtered to remove:
267
+
268
+ - System messages and tool logs
269
+ - npm install/build noise
270
+ - Sensitive data patterns
271
+ - Redundant context
272
+
273
+ ## Example Workflow
274
+
275
+ ```bash
276
+ # 1. Initialize project
277
+ cd /path/to/project
278
+ toolnet-memory init
279
+
280
+ # 2. Start coding with your agent
281
+ agy "implement user authentication"
282
+
283
+ # 3. Fast context is automatically injected at session start
284
+ # Agent sees profile.md + current.md (~150ms)
285
+
286
+ # 4. Work continues across sessions
287
+ codex "add password reset flow"
288
+
289
+ # 5. Query semantic code context
290
+ toolnet-memory semantic "auth flow"
291
+
292
+ # 6. Check change impact
293
+ toolnet-memory impact src/auth.ts
294
+
295
+ # 7. Manual deep recovery if needed
296
+ toolnet-memory session:agy-recover --limit 5
297
+ ```
137
298
 
138
299
  ## Core capabilities
139
300
 
@@ -250,6 +411,7 @@ ToolNet Memory processes source-code metadata, coding-agent activity, and projec
250
411
  - Never silently inject memory from another project.
251
412
  - Avoid placing full authentication tokens in logs or diagnostics.
252
413
  - Treat raw agent transcripts as potentially sensitive.
414
+ - Storage credentials are stored in `~/.config/toolnet-memory/.env` (never in project repos).
253
415
 
254
416
  See [SECURITY.md](SECURITY.md) for vulnerability reporting.
255
417
 
@@ -259,6 +421,9 @@ See [SECURITY.md](SECURITY.md) for vulnerability reporting.
259
421
  git clone https://github.com/LBT-AI/toolnet-memory.git
260
422
  cd toolnet-memory
261
423
  npm ci
424
+ npm run lint
425
+ npm run format:check
426
+ npm run typecheck
262
427
  npm test
263
428
  npm run build:release
264
429
  npm pack --dry-run
@@ -19,7 +19,7 @@ if [ "${1:-}" = "--version" ] || [ "${1:-}" = "-v" ]; then
19
19
  exit 0
20
20
  fi
21
21
 
22
- COMMAND="${1:-help}"
22
+ COMMAND="${1:-context:print}"
23
23
 
24
24
  run() {
25
25
  DIST="$1"
@@ -269,6 +269,50 @@ case "$COMMAND" in
269
269
  exit 1
270
270
  ;;
271
271
 
272
+ memory:review)
273
+ shift
274
+
275
+ if [ -x "${TSX:-}" ]; then
276
+ exec "$TSX" "$ROOT/src/session/memory-review-cli.ts" "$@"
277
+ fi
278
+
279
+ echo "Memory review not available."
280
+ exit 1
281
+ ;;
282
+
283
+ guard:check)
284
+ shift
285
+
286
+ if [ -x "${TSX:-}" ]; then
287
+ exec "$TSX" "$ROOT/src/guard/cli.ts" "$@"
288
+ fi
289
+
290
+ echo "Guard not available."
291
+ exit 1
292
+ ;;
293
+
294
+ guard:explain)
295
+ shift
296
+
297
+ if [ -x "${TSX:-}" ]; then
298
+ exec "$TSX" "$ROOT/src/guard/cli.ts" "$@"
299
+ fi
300
+
301
+ echo "Guard not available."
302
+ exit 1
303
+ ;;
304
+
305
+ guard:json)
306
+ shift
307
+
308
+ if [ -x "${TSX:-}" ]; then
309
+ exec "$TSX" "$ROOT/src/guard/cli.ts" --json "$@"
310
+ fi
311
+
312
+ echo "Guard not available."
313
+ exit 1
314
+ ;;
315
+
272
316
  project:manual-init)
273
317
  shift
274
318
 
@@ -389,6 +433,26 @@ case "$COMMAND" in
389
433
  exec "$TSX" "$ROOT/src/work-continuity/context-runtime-cli.ts" refresh "$@"
390
434
  ;;
391
435
 
436
+ profile:show)
437
+ shift
438
+
439
+ if [ -f "$ROOT/bundle/context-runtime.js" ]; then
440
+ exec node "$ROOT/bundle/context-runtime.js" profile-show "$@"
441
+ fi
442
+
443
+ exec "$TSX" "$ROOT/src/work-continuity/context-runtime-cli.ts" profile-show "$@"
444
+ ;;
445
+
446
+ profile:sync)
447
+ shift
448
+
449
+ if [ -f "$ROOT/bundle/context-runtime.js" ]; then
450
+ exec node "$ROOT/bundle/context-runtime.js" profile-sync "$@"
451
+ fi
452
+
453
+ exec "$TSX" "$ROOT/src/work-continuity/context-runtime-cli.ts" profile-sync "$@"
454
+ ;;
455
+
392
456
  session:codex-context)
393
457
  shift
394
458
 
@@ -405,9 +469,56 @@ case "$COMMAND" in
405
469
 
406
470
  help|--help|-h)
407
471
  cat <<'HELP'
408
- ToolNet Memory
472
+ ToolNet Memory - Project Context & Memory System
473
+
474
+ FAST CONTEXT (default):
475
+ toolnet-memory Print fast project context (default)
476
+ toolnet-memory context:print Print fast project context
477
+ toolnet-memory context:sync Show context hash/size
478
+ toolnet-memory profile:show Show .toolnet/profile.md
479
+ toolnet-memory profile:sync Sync profile to GEMINI.md/AGENTS.md/CLAUDE.md
480
+
481
+ MANUAL DEEP RECOVERY (do not run automatically):
482
+ toolnet-memory context:refresh Rebuild deep startup brief cache
483
+ toolnet-memory brief [--tokens N] Show full project brief
484
+ toolnet-memory handoff:latest Show latest session handoff
485
+ toolnet-memory session:agy-recover [--limit N] Recover Agy sessions
486
+ toolnet-memory session:codex-recover [--limit N] Recover Codex sessions
487
+ toolnet-memory session:opencode-recover [--limit N] Recover OpenCode sessions
488
+
489
+ MEMORY OPERATIONS:
490
+ toolnet-memory memory:review [--project PATH] [--session ID]
491
+ toolnet-memory memory:reconcile [--project PATH]
492
+
493
+ GUARD (Architecture & Rule Checking):
494
+ toolnet-memory guard:check Check project rules and evidence
495
+ toolnet-memory guard:check --file <path> Check if file violates rules
496
+ toolnet-memory guard:check --command "<cmd>" Check if command is dangerous
497
+ toolnet-memory guard:explain Show rules and evidence
498
+ toolnet-memory guard:json Output guard result as JSON
499
+
500
+ NOTE: Raw transcripts are not injected into prompts.
501
+ Durable memory is promoted selectively based on importance scoring.
502
+ Guard mode: warn (default), strict, or off (TOOLNET_GUARD_MODE)
503
+
504
+ PROJECT MANUAL:
505
+ toolnet-memory project:manual-init [--project PATH]
506
+ toolnet-memory project:manual-show [--project PATH]
507
+ toolnet-memory project:manual-sync [--project PATH]
508
+
509
+ WORK CONTINUITY:
510
+ toolnet-memory work:status [--project PATH]
511
+ toolnet-memory work:json [--project PATH]
512
+ toolnet-memory work:reconcile [--project PATH]
409
513
 
410
- Commands:
514
+ CODE INTELLIGENCE:
515
+ toolnet-memory index
516
+ toolnet-memory index:graph
517
+ toolnet-memory incremental
518
+ toolnet-memory semantic "query"
519
+ toolnet-memory impact [file]
520
+
521
+ SETUP & INTEGRATION:
411
522
  toolnet-memory --version
412
523
  toolnet-memory doctor
413
524
  toolnet-memory setup
@@ -415,36 +526,26 @@ Commands:
415
526
  toolnet-memory config get KEY
416
527
  toolnet-memory config set KEY VALUE
417
528
  toolnet-memory config open
418
- toolnet-memory index
419
- toolnet-memory index:graph
420
- toolnet-memory incremental
421
- toolnet-memory semantic "query"
422
- toolnet-memory impact [file]
423
- toolnet-memory mcp
424
529
  toolnet-memory integrate:auto
530
+ toolnet-memory integrate:opencode
531
+ toolnet-memory integrate:agy
532
+ toolnet-memory integrate:codex
533
+ toolnet-memory mcp
534
+
535
+ SNAPSHOTS:
425
536
  toolnet-memory snapshot:list
426
537
  toolnet-memory snapshot:create "reason"
427
538
  toolnet-memory snapshot:restore <id>
428
539
  toolnet-memory recover
429
- toolnet-memory integrate:opencode
430
- toolnet-memory integrate:agy
431
- toolnet-memory integrate:codex
432
- toolnet-memory session:codex-sync <thread-id>
433
- toolnet-memory session:codex-recover [--limit N]
434
- toolnet-memory memory:reconcile [--project PATH]
435
- toolnet-memory project:manual-init [--project PATH]
436
- toolnet-memory project:manual-show [--project PATH]
437
- toolnet-memory project:manual-sync [--project PATH]
438
- toolnet-memory work:status [--project PATH]
439
- toolnet-memory work:json [--project PATH]
440
- toolnet-memory work:reconcile [--project PATH]
441
- toolnet-memory brief [--project PATH] [--tokens N]
442
- toolnet-memory brief:json [--project PATH] [--tokens N]
443
- toolnet-memory handoff:latest [--project PATH]
540
+
541
+ SESSION SYNC (manual):
444
542
  toolnet-memory session:agy-sync <conversation-id> --transcript <path>
445
- toolnet-memory session:agy-recover [--limit N]
543
+ toolnet-memory session:codex-sync <thread-id>
446
544
  toolnet-memory session:opencode-sync <session-id>
447
- toolnet-memory session:opencode-recover [--limit N]
545
+
546
+ IMPORTANT:
547
+ Deep recovery commands (brief, handoff:latest, session:*-recover) are manual only.
548
+ Do not run them automatically at startup. Use fast context commands instead.
448
549
  HELP
449
550
  ;;
450
551