@ngo-a/native-memory-citations 0.1.0 → 0.1.2

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
@@ -3,6 +3,8 @@
3
3
  Native OpenClaw plugin for cited local memory search and retrieval.
4
4
  Native means OpenClaw-native plugin, not native system memory.
5
5
 
6
+ ![Architecture](docs/architecture.svg)
7
+
6
8
  ## Tools
7
9
 
8
10
  - `native_memory_search`: search approved memory roots and return snippets with source paths, line numbers, and file SHA-256 hashes.
@@ -48,22 +50,93 @@ npm run plugin:validate
48
50
  npm test
49
51
  ```
50
52
 
51
- ## Config
53
+ ## Configuration
54
+
55
+ Plugin configuration is supplied in the plugin's entry within the OpenClaw Gateway
56
+ configuration. It governs which files the plugin is permitted to read and cite. The
57
+ plugin reads existing memory files only; it does not create, modify, or delete them.
58
+ All keys are optional.
59
+
60
+ | Key | Type | Default | Description |
61
+ |-----|------|---------|-------------|
62
+ | `workspace` | string | `$OPENCLAW_WORKSPACE`, then `~/.openclaw/workspace` | Absolute path against which roots are resolved. |
63
+ | `allowedRoots` | string[] | Built-in default set (see Default Scope) | Workspace-relative files or directories to search. When set to a non-empty array, it replaces the default set in full. |
64
+ | `sharedMode` | boolean | `false` | When `true`, excludes the private `MEMORY.md` from the default set. Has no effect when `allowedRoots` is set. |
65
+ | `maxFileBytes` | number | `1048576` (1 MiB) | Per-file size limit. Files exceeding this limit are skipped rather than reported as errors. |
66
+
67
+ ### Default search scope
68
+
69
+ The default roots are defined in the Default Scope section above: `memory/`,
70
+ `MEMORY.md`, `USER.md`, `IDENTITY.md`, and `TOOLS.md`. With `sharedMode: true`,
71
+ `MEMORY.md` is excluded.
72
+
73
+ ### Defining custom roots
74
+
75
+ Set `allowedRoots` to the exact set of workspace-relative files or directories that
76
+ should be searchable. This value replaces the default set in full and takes
77
+ precedence over `sharedMode`. Any default entries that should remain searchable must
78
+ be listed explicitly.
79
+
80
+ Each entry must be a workspace-relative, visible path. An entry is rejected, with an
81
+ `Invalid allowedRoots entry` error, if it is empty, `.`, `..`, an absolute path,
82
+ contains a `..` segment, or contains a hidden segment (a segment beginning with `.`,
83
+ for example `memory/.dreams`). These restrictions are part of the access boundary
84
+ and are enforced intentionally.
85
+
86
+ ### Examples
52
87
 
53
- Plugin config is read from the plugin's entry in the OpenClaw Gateway config.
54
- All keys are optional:
88
+ Shared or team deployment, retaining the defaults while excluding the private
89
+ journal:
55
90
 
56
91
  ```json
57
- {
58
- "workspace": "/home/ad/.openclaw/workspace",
59
- "allowedRoots": ["memory", "USER.md", "TOOLS.md"],
60
- "sharedMode": true,
61
- "maxFileBytes": 1048576
62
- }
92
+ { "sharedMode": true }
93
+ ```
94
+
95
+ Restricting the plugin to a specific, minimal set:
96
+
97
+ ```json
98
+ { "allowedRoots": ["memory", "USER.md"] }
99
+ ```
100
+
101
+ Adding custom directories. Because `allowedRoots` replaces the default set, any
102
+ defaults that should remain searchable are listed again:
103
+
104
+ ```json
105
+ { "allowedRoots": ["memory", "USER.md", "IDENTITY.md", "TOOLS.md", "notes", "decisions"] }
106
+ ```
107
+
108
+ Permitting larger files (4 MiB) and specifying a non-default workspace:
109
+
110
+ ```json
111
+ { "workspace": "/srv/openclaw/workspace", "maxFileBytes": 4194304 }
63
112
  ```
64
113
 
65
- If `workspace` is omitted, the plugin uses `$OPENCLAW_WORKSPACE`, then
66
- `~/.openclaw/workspace`. There is no hardcoded user-specific default.
114
+ ### Operational notes
115
+
116
+ - `allowedRoots` replaces the default set; it does not extend it. A value of
117
+ `["notes"]` makes `MEMORY.md`, `USER.md`, and the remaining defaults unreachable.
118
+ List every path that should remain searchable.
119
+ - `sharedMode` has no effect once `allowedRoots` is set; the explicit list takes
120
+ precedence.
121
+ - Files exceeding `maxFileBytes` are skipped and logged rather than reported as
122
+ errors. Set the limit to accommodate the largest memory files in use.
123
+ - Hidden directories, `..` segments, and absolute paths cannot be included. This is
124
+ enforced by the access boundary.
125
+
126
+ ### Settings not exposed through configuration
127
+
128
+ Redaction is implemented in code and is not configurable through plugin
129
+ configuration; the schema rejects unrecognized keys. The named secret patterns and
130
+ the high-entropy backstop are defined in `src/core.ts`. Modifying redaction behavior
131
+ requires editing that file and re-running the test suite (`npm test`) to confirm
132
+ that the redaction invariants continue to hold. It is not a configuration setting in
133
+ this version.
134
+
135
+ ### Per-request limit
136
+
137
+ `native_memory_fetch` accepts a `maxChars` argument (default `8000`, constrained to
138
+ the range 256 to 20000) that bounds the amount of cited content returned by a single
139
+ fetch. This is a per-call tool argument and is independent of plugin configuration.
67
140
 
68
141
  ## Notes
69
142
 
@@ -107,11 +180,13 @@ earlier citations stale even when the cited lines themselves are unchanged.
107
180
 
108
181
  ## Install
109
182
 
110
- ```bash
111
- openclaw plugins install ./native-memory-citations # current/private local checkout
112
- openclaw plugins install clawhub:ngo-a/native-memory-citations # future publish mode
113
- openclaw plugins install @ngo-a/native-memory-citations # npm publish mode
114
- ```
183
+ From npm (recommended):
184
+
185
+ openclaw plugins install @ngo-a/native-memory-citations
186
+
187
+ From a local checkout (development):
188
+
189
+ openclaw plugins install ./native-memory-citations
115
190
 
116
191
  Reload the Gateway after installing so the plugin host exposes the tools.
117
192
 
@@ -127,11 +202,19 @@ is redacted before it leaves the plugin; named secret patterns provide nicer
127
202
  labels, while the high-entropy backstop handles unknown token formats. Redaction
128
203
  is not an authorization or access-control boundary.
129
204
 
130
- ## Publish
205
+ ## Releasing
206
+
207
+ Published to npm as `@ngo-a/native-memory-citations`.
208
+
209
+ To cut a new release:
210
+
211
+ 1. Make changes and confirm the suite is green: `npm test`
212
+ 2. Bump `version` in `package.json` (e.g. `0.1.0` -> `0.1.1`) per semver.
213
+ 3. `npm publish`
131
214
 
132
- Deferred until distribution mode. When publishing: remove `private`, add the
133
- `files` allowlist and `prepublishOnly` script, then
134
- `clawhub package publish ngo-a/native-memory-citations` (or `npm publish`).
215
+ The `prepublishOnly` script rebuilds `dist/` first, and `publishConfig.access`
216
+ is `public`, so no extra flags are needed. A published version number cannot be
217
+ overwritten; fixes ship as a new version.
135
218
 
136
219
  ## License
137
220
 
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "additionalProperties": false
32
32
  },
33
- "version": "0.1.0",
33
+ "version": "0.1.2",
34
34
  "contracts": {
35
35
  "tools": [
36
36
  "native_memory_search",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngo-a/native-memory-citations",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "description": "Native OpenClaw plugin for cited local memory search and retrieval.",
6
6
  "license": "MIT",