toolnet-memory 0.2.11 → 0.2.13

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
@@ -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
 
@@ -443,8 +487,20 @@ MANUAL DEEP RECOVERY (do not run automatically):
443
487
  toolnet-memory session:opencode-recover [--limit N] Recover OpenCode sessions
444
488
 
445
489
  MEMORY OPERATIONS:
490
+ toolnet-memory memory:review [--project PATH] [--session ID]
446
491
  toolnet-memory memory:reconcile [--project PATH]
447
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
+
448
504
  PROJECT MANUAL:
449
505
  toolnet-memory project:manual-init [--project PATH]
450
506
  toolnet-memory project:manual-show [--project PATH]