claude-mem 12.1.2 → 12.1.4
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 +0 -44
- package/dist/npx-cli/index.js +125 -116
- package/openclaw/dist/index.js +14 -14
- package/openclaw/src/index.test.ts +0 -204
- package/openclaw/src/index.ts +3 -94
- package/package.json +2 -2
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/hooks/hooks.json +9 -9
- package/plugin/package.json +1 -1
- package/plugin/scripts/bun-runner.js +6 -14
- package/plugin/scripts/context-generator.cjs +48 -48
- package/plugin/scripts/mcp-server.cjs +13 -13
- package/plugin/scripts/smart-install.js +1 -54
- package/plugin/scripts/worker-service.cjs +212 -216
- package/plugin/skills/mem-search/SKILL.md +48 -0
- package/plugin/skills/smart-explore/SKILL.md +0 -45
|
@@ -126,6 +126,54 @@ get_observations(ids=[11131, 10942, 10855], orderBy="date_desc")
|
|
|
126
126
|
- **Batch fetch:** 1 HTTP request vs N individual requests
|
|
127
127
|
- **10x token savings** by filtering before fetching
|
|
128
128
|
|
|
129
|
+
## Smart-Explore Language Support
|
|
130
|
+
|
|
131
|
+
Smart-explore tools (`smart_search`, `smart_outline`, `smart_unfold`) use tree-sitter AST parsing. The following languages are supported out of the box.
|
|
132
|
+
|
|
133
|
+
### 24 Bundled Languages
|
|
134
|
+
|
|
135
|
+
JS, TS, Python, Go, Rust, Ruby, Java, C, C++, Kotlin, Swift, PHP, Elixir, Lua, Scala, Bash, Haskell, Zig, CSS, SCSS, TOML, YAML, SQL, Markdown
|
|
136
|
+
|
|
137
|
+
### Markdown Special Support
|
|
138
|
+
|
|
139
|
+
Markdown files get structure-aware parsing beyond generic tree-sitter:
|
|
140
|
+
|
|
141
|
+
- **Heading hierarchy** -- `#`/`##`/`###` headings are extracted as nested symbols (sections contain subsections)
|
|
142
|
+
- **Code block detection** -- fenced code blocks are surfaced as `code` symbols with language annotation
|
|
143
|
+
- **Section-aware unfold** -- `smart_unfold` on a heading returns the full section content (heading through all subsections until the next heading of equal or higher level)
|
|
144
|
+
|
|
145
|
+
### User-Installable Grammars via `.claude-mem.json`
|
|
146
|
+
|
|
147
|
+
Add custom tree-sitter grammars for languages not in the bundled set. Place `.claude-mem.json` in the project root:
|
|
148
|
+
|
|
149
|
+
```json
|
|
150
|
+
{
|
|
151
|
+
"grammars": {
|
|
152
|
+
"gleam": {
|
|
153
|
+
"package": "tree-sitter-gleam",
|
|
154
|
+
"extensions": [".gleam"]
|
|
155
|
+
},
|
|
156
|
+
"protobuf": {
|
|
157
|
+
"package": "tree-sitter-proto",
|
|
158
|
+
"extensions": [".proto"],
|
|
159
|
+
"query": ".claude-mem/queries/proto.scm"
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**Fields:**
|
|
166
|
+
|
|
167
|
+
- `package` (string, required) -- npm package name for the tree-sitter grammar
|
|
168
|
+
- `extensions` (array of strings, required) -- file extensions to associate with this language
|
|
169
|
+
- `query` (string, optional) -- path to a custom `.scm` query file for symbol extraction. If omitted, a generic query is used.
|
|
170
|
+
|
|
171
|
+
**Rules:**
|
|
172
|
+
|
|
173
|
+
- User grammars do NOT override bundled languages. If a language is already bundled, the entry is ignored.
|
|
174
|
+
- The npm package must be installed in the project (`npm install tree-sitter-gleam`).
|
|
175
|
+
- Config is cached per project root. Changes to `.claude-mem.json` take effect on next worker restart.
|
|
176
|
+
|
|
129
177
|
## Knowledge Agents
|
|
130
178
|
|
|
131
179
|
Want synthesized answers instead of raw records? Use `/knowledge-agent` to build a queryable corpus from your observation history. The knowledge agent reads all matching observations and answers questions conversationally.
|
|
@@ -143,48 +143,3 @@ Use smart_* tools for code exploration, Read for non-code files. Mix freely.
|
|
|
143
143
|
| Explore agent | ~39,000-59,000 | Cross-file synthesis with narrative |
|
|
144
144
|
|
|
145
145
|
**4-8x savings** on file understanding (outline + unfold vs Read). **11-18x savings** on codebase exploration vs Explore agent. The narrower the query, the wider the gap — a 27-line function costs 55x less to read via unfold than via an Explore agent, because the agent still reads the entire file.
|
|
146
|
-
|
|
147
|
-
## Language Support
|
|
148
|
-
|
|
149
|
-
Smart-explore uses **tree-sitter AST parsing** for structural analysis. Unsupported file types fall back to text-based search.
|
|
150
|
-
|
|
151
|
-
### Bundled Languages
|
|
152
|
-
|
|
153
|
-
| Language | Extensions |
|
|
154
|
-
|----------|-----------|
|
|
155
|
-
| JavaScript | `.js`, `.mjs`, `.cjs` |
|
|
156
|
-
| TypeScript | `.ts` |
|
|
157
|
-
| TSX / JSX | `.tsx`, `.jsx` |
|
|
158
|
-
| Python | `.py`, `.pyw` |
|
|
159
|
-
| Go | `.go` |
|
|
160
|
-
| Rust | `.rs` |
|
|
161
|
-
| Ruby | `.rb` |
|
|
162
|
-
| Java | `.java` |
|
|
163
|
-
| C | `.c`, `.h` |
|
|
164
|
-
| C++ | `.cpp`, `.cc`, `.cxx`, `.hpp`, `.hh` |
|
|
165
|
-
|
|
166
|
-
Files with unrecognized extensions are parsed as plain text — `smart_search` still works (grep-style), but `smart_outline` and `smart_unfold` will not extract structured symbols.
|
|
167
|
-
|
|
168
|
-
### Custom Grammars (`.claude-mem.json`)
|
|
169
|
-
|
|
170
|
-
You can register additional tree-sitter grammars for file types not in the bundled list. Create or update `.claude-mem.json` in your project root:
|
|
171
|
-
|
|
172
|
-
```json
|
|
173
|
-
{
|
|
174
|
-
"grammars": {
|
|
175
|
-
".sol": "tree-sitter-solidity",
|
|
176
|
-
".graphql": "tree-sitter-graphql"
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
Each key is a file extension; each value is the npm package name of the tree-sitter grammar. The grammar must be installed locally (`npm install tree-sitter-solidity`). Once registered, `smart_outline` and `smart_unfold` will parse those extensions structurally instead of falling back to plain text.
|
|
182
|
-
|
|
183
|
-
### Markdown Special Support
|
|
184
|
-
|
|
185
|
-
Markdown files (`.md`, `.mdx`) receive special handling beyond the generic plain-text fallback:
|
|
186
|
-
|
|
187
|
-
- **`smart_outline`** — extracts headings (`#`, `##`, `###`) as the symbol tree. Use it to navigate long documents without reading the full file.
|
|
188
|
-
- **`smart_search`** — searches within code fences as well as prose, so queries for function names inside ` ```ts ``` ` blocks work as expected.
|
|
189
|
-
- **`smart_unfold`** — expands heading sections rather than function bodies; each section up to the next same-level heading is returned as a chunk.
|
|
190
|
-
- **Frontmatter** — YAML frontmatter (lines between leading `---` delimiters) is included in `smart_outline` output under a synthetic `frontmatter` symbol so metadata like `title:` and `description:` is visible without reading the whole file.
|