You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
semble search "save model to disk" ./my-project --top-k 10
70
70
```
71
71
72
-
If you anticipate doing more than one search, use `semble index` to create an index.
73
-
74
-
```bash
75
-
semble index ./my-project -o my_index
76
-
```
77
-
78
-
You can then reuse this index later on:
79
-
80
-
```bash
81
-
semble search "save_pretrained" --index my_index
82
-
```
83
-
84
-
An index is not automatically updated, so if the code changes significantly, reindex. If you notice stale results while resolving searches to files, reindex.
72
+
The index is built on first run (and cached for subsequent runs) and invalidated automatically when files change.
85
73
86
74
Use `--content docs` to search documentation and prose, `--content config` for config files (yaml, toml, etc.), or `--content all` to search code, docs, and config:
87
75
@@ -97,20 +85,17 @@ Use `semble find-related` to discover code similar to a known location (pass `fi
97
85
semble find-related src/auth.py 42 ./my-project
98
86
```
99
87
100
-
Like search, `find-related` also accepts an `--index` argument.
101
-
102
88
`path` defaults to the current directory when omitted; git URLs are accepted.
103
89
104
90
If `semble` is not on `$PATH`, use `uvx --from "semble[mcp]" semble` in its place.
105
91
106
92
### Workflow
107
93
108
-
1. Index the repo using `semble index -o cached_index`.
109
-
2. Start with `semble search` to find relevant chunks. Pass the index to achieve results faster.
110
-
3. Use `--content docs` for documentation, `--content config` for config files, or `--content all` for everything.
111
-
4. Inspect full files only when the returned chunk does not give enough context.
112
-
5. Optionally use `semble find-related` with a promising result's `file_path` and `line` to discover related implementations.
113
-
6. Use grep only when you need exhaustive literal matches or quick confirmation of an exact string.
94
+
1. Start with `semble search` to find relevant chunks. The index is built and cached automatically.
95
+
2. Use `--content docs` for documentation, `--content config` for config files, or `--content all` for everything.
96
+
3. Inspect full files only when the returned chunk does not give enough context.
97
+
4. Optionally use `semble find-related` with a promising result's `file_path` and `line` to discover related implementations.
98
+
5. Use grep only when you need exhaustive literal matches or quick confirmation of an exact string.
114
99
```
115
100
116
101
</details>
@@ -330,7 +315,55 @@ Add to `~/.config/zed/settings.json` (or `.zed/settings.json` in your project):
330
315
By default the MCP server indexes only code files. To also index documentation, config, or everything, append `--content docs`, `--content config`, or `--content all` to the server command, or a combination, e.g. `--content code docs`. For example, in Claude Code: `claude mcp add semble -s user -- uvx --from "semble[mcp]" semble --content all`.
331
316
332
317
333
-
## Sub-agent setup
318
+
<aid="bash-agentsmd"></a>
319
+
320
+
## Bash / AGENTS.md
321
+
322
+
An alternative to MCP is to invoke Semble via Bash. Sub-agents cannot call MCP tools directly, so this is the only option for sub-agent support; it can also be used alongside MCP for the top-level agent.
323
+
324
+
To add Bash support, append the following to your `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, or equivalent:
325
+
326
+
```markdown
327
+
## Code Search
328
+
329
+
Use `semble search` to find code by describing what it does or naming a symbol/identifier, instead of grep:
330
+
331
+
```bash
332
+
semble search "authentication flow" ./my-project
333
+
semble search "save_pretrained" ./my-project
334
+
semble search "save model to disk" ./my-project --top-k 10
335
+
```
336
+
337
+
The index is built on first run (and cached for subsequent runs) and invalidated automatically when files change.
338
+
339
+
Use `--content docs` to search documentation and prose, `--content config` for config files (yaml, toml, etc.), or `--content all` to search code, docs, and config:
semble search "authentication" ./my-project --content all
345
+
```
346
+
347
+
Use `semble find-related` to discover code similar to a known location (pass `file_path` and `line` from a prior search result):
348
+
349
+
```bash
350
+
semble find-related src/auth.py 42 ./my-project
351
+
```
352
+
353
+
`path` defaults to the current directory when omitted; git URLs are accepted.
354
+
355
+
If `semble` is not on `$PATH`, use `uvx --from "semble[mcp]" semble` in its place.
356
+
357
+
### Workflow
358
+
359
+
1. Start with `semble search` to find relevant chunks. The index is built and cached automatically.
360
+
2. Use `--content docs` for documentation, `--content config` for config files, or `--content all` for everything.
361
+
3. Inspect full files only when the returned chunk does not give enough context.
362
+
4. Optionally use `semble find-related` with a promising result's `file_path` and `line` to discover related implementations.
363
+
5. Use grep only when you need exhaustive literal matches or quick confirmation of an exact string.
364
+
```
365
+
366
+
### Sub-agent setup
334
367
335
368
Claude Code, Gemini CLI, Cursor, OpenCode, GitHub Copilot CLI, and Kiro all support a dedicated semble search sub-agent. Run `semble init` once in your project root:
336
369
@@ -350,13 +383,9 @@ If semble is not on `$PATH`, prefix the command with `uvx --from "semble[mcp]"`.
350
383
Semble also ships as a standalone CLI. This is useful in scripts or anywhere you want search results without an MCP session.
351
384
352
385
```bash
353
-
# Search a local repo
386
+
# Search a local repo (index is built and cached automatically)
354
387
semble search "authentication flow" ./my-project
355
388
356
-
# Index first for faster repeated searches (--index works with any command below)
`--content` accepts `code` (default), `docs`, `config`, or `all`. `path` defaults to the current directory when omitted; git URLs are accepted. If `semble` is not on `$PATH`, use `uvx --from "semble[mcp]" semble` in its place.
374
403
404
+
<details>
405
+
<summary>Controlling which files are indexed</summary>
406
+
407
+
Semble reads `.gitignore` and `.sembleignore` files to determine which files to index. Both files use standard gitignore syntax and their patterns are merged. `.sembleignore` lets you add semble-specific rules without touching `.gitignore`. Rules are applied recursively, so a `.sembleignore` in a subdirectory applies to that subtree.
408
+
409
+
**Excluding files:** add patterns the same way you would in `.gitignore`:
410
+
411
+
```
412
+
# .sembleignore
413
+
generated/ # exclude generated dir
414
+
*.pb.go. # exclude Go protobuf files
415
+
```
416
+
417
+
**Including non-default extensions:** prefix the extension pattern with `!` to force-include files that semble wouldn't index by default:
418
+
419
+
```
420
+
# .sembleignore
421
+
!*.proto # include Protobuf files
422
+
!*.cob # include COBOL files
423
+
```
424
+
425
+
Semble also always skips a set of well-known non-source directories regardless of ignore files (e.g. `node_modules/`, `.venv/`, `dist/`, `build/`, `__pycache__/`, and similar).
426
+
427
+
</details>
428
+
375
429
<details>
376
430
<summary>Savings</summary>
377
431
@@ -394,7 +448,7 @@ semble savings --verbose # also show breakdown by call type
394
448
395
449
Savings are calculated as follows: for each call, semble records the total character count of the unique files containing returned chunks and the character count of the snippets returned. Estimated tokens saved is `(file chars − snippet chars) / 4` (4 chars per token). This is a conservative estimate: the baseline is reading matched files in full, which is how coding agents often explore unfamiliar code.
396
450
397
-
Stats are stored in `~/.semble/savings.jsonl`.
451
+
Stats are stored in the OS cache folder (`~/Library/Caches/semble/` on macOS, `~/.cache/semble/` on Linux, `%LOCALAPPDATA%\semble\Cache\` on Windows).
semble search "save model to disk" ./my-project --top-k 10
13
13
```
14
14
15
-
If you anticipate doing more than one search, use `semble index` to create an index.
16
-
17
-
```bash
18
-
semble index ./my-project -o my_index
19
-
```
20
-
21
-
You can then reuse this index later on:
22
-
23
-
```bash
24
-
semble search "save_pretrained" --index my_index
25
-
```
26
-
27
-
An index is not automatically updated, so if the code changes significantly, reindex. If you notice stale results while resolving searches to files, reindex.
15
+
Results are cached automatically on first run and invalidated when files change.
28
16
29
17
Use `--content docs` to search documentation and prose, `--content config` for config files (yaml, toml, etc.), or `--content all` to search code, docs, and config:
30
18
@@ -40,17 +28,14 @@ Use `semble find-related` to discover code similar to a known location (pass `fi
40
28
semble find-related src/auth.py 42 ./my-project
41
29
```
42
30
43
-
Like search, `find-related` also accepts an `--index` argument.
44
-
45
31
`path` defaults to the current directory when omitted; git URLs are accepted.
46
32
47
33
If `semble` is not on `$PATH`, use `uvx --from "semble[mcp]" semble` in its place.
48
34
49
35
### Workflow
50
36
51
-
1. Index the repo using `semble index -o cached_index`.
52
-
2. Start with `semble search` to find relevant chunks. Pass the index to achieve results faster.
53
-
3. Use `--content docs` for documentation, `--content config` for config files, or `--content all` for everything.
54
-
4. Inspect full files only when the returned chunk does not give enough context.
55
-
5. Optionally use `semble find-related` with a promising result's `file_path` and `line` to discover related implementations.
56
-
6. Use grep only when you need exhaustive literal matches or quick confirmation of an exact string.
37
+
1. Start with `semble search` to find relevant chunks. The index is built and cached automatically.
38
+
2. Use `--content docs` for documentation, `--content config` for config files, or `--content all` for everything.
39
+
3. Inspect full files only when the returned chunk does not give enough context.
40
+
4. Optionally use `semble find-related` with a promising result's `file_path` and `line` to discover related implementations.
41
+
5. Use grep only when you need exhaustive literal matches or quick confirmation of an exact string.
semble search "save model to disk" ./my-project --top-k 10
13
13
```
14
14
15
-
If you anticipate doing more than one search, use `semble index` to create an index.
16
-
17
-
```bash
18
-
semble index ./my-project -o my_index
19
-
```
20
-
21
-
You can then reuse this index later on:
22
-
23
-
```bash
24
-
semble search "save_pretrained" --index my_index
25
-
```
26
-
27
-
An index is not automatically updated, so if the code changes significantly, reindex. If you notice stale results while resolving searches to files, reindex.
15
+
Results are cached automatically on first run and invalidated when files change.
28
16
29
17
Use `--content docs` to search documentation and prose, `--content config` for config files (yaml, toml, etc.), or `--content all` to search code, docs, and config:
30
18
@@ -40,17 +28,14 @@ Use `semble find-related` to discover code similar to a known location (pass `fi
40
28
semble find-related src/auth.py 42 ./my-project
41
29
```
42
30
43
-
Like search, `find-related` also accepts an `--index` argument.
44
-
45
31
`path` defaults to the current directory when omitted; git URLs are accepted.
46
32
47
33
If `semble` is not on `$PATH`, use `uvx --from "semble[mcp]" semble` in its place.
48
34
49
35
### Workflow
50
36
51
-
1. Index the repo using `semble index -o cached_index`.
52
-
2. Start with `semble search` to find relevant chunks. Pass the index to achieve results faster.
53
-
3. Use `--content docs` for documentation, `--content config` for config files, or `--content all` for everything.
54
-
4. Inspect full files only when the returned chunk does not give enough context.
55
-
5. Optionally use `semble find-related` with a promising result's `file_path` and `line` to discover related implementations.
56
-
6. Use grep only when you need exhaustive literal matches or quick confirmation of an exact string.
37
+
1. Start with `semble search` to find relevant chunks. The index is built and cached automatically.
38
+
2. Use `--content docs` for documentation, `--content config` for config files, or `--content all` for everything.
39
+
3. Inspect full files only when the returned chunk does not give enough context.
40
+
4. Optionally use `semble find-related` with a promising result's `file_path` and `line` to discover related implementations.
41
+
5. Use grep only when you need exhaustive literal matches or quick confirmation of an exact string.
semble search "save model to disk" ./my-project --top-k 10
12
12
```
13
13
14
-
If you anticipate doing more than one search, use `semble index` to create an index.
15
-
16
-
```bash
17
-
semble index ./my-project -o my_index
18
-
```
19
-
20
-
You can then reuse this index later on:
21
-
22
-
```bash
23
-
semble search "save_pretrained" --index my_index
24
-
```
25
-
26
-
An index is not automatically updated, so if the code changes significantly, reindex. If you notice stale results while resolving searches to files, reindex.
14
+
Results are cached automatically on first run and invalidated when files change.
27
15
28
16
Use `--content docs` to search documentation and prose, `--content config` for config files (yaml, toml, etc.), or `--content all` to search code, docs, and config:
29
17
@@ -39,17 +27,14 @@ Use `semble find-related` to discover code similar to a known location (pass `fi
39
27
semble find-related src/auth.py 42 ./my-project
40
28
```
41
29
42
-
Like search, `find-related` also accepts an `--index` argument.
43
-
44
30
`path` defaults to the current directory when omitted; git URLs are accepted.
45
31
46
32
If `semble` is not on `$PATH`, use `uvx --from "semble[mcp]" semble` in its place.
47
33
48
34
### Workflow
49
35
50
-
1. Index the repo using `semble index -o cached_index`.
51
-
2. Start with `semble search` to find relevant chunks. Pass the index to achieve results faster.
52
-
3. Use `--content docs` for documentation, `--content config` for config files, or `--content all` for everything.
53
-
4. Inspect full files only when the returned chunk does not give enough context.
54
-
5. Optionally use `semble find-related` with a promising result's `file_path` and `line` to discover related implementations.
55
-
6. Use grep only when you need exhaustive literal matches or quick confirmation of an exact string.
36
+
1. Start with `semble search` to find relevant chunks. The index is built and cached automatically.
37
+
2. Use `--content docs` for documentation, `--content config` for config files, or `--content all` for everything.
38
+
3. Inspect full files only when the returned chunk does not give enough context.
39
+
4. Optionally use `semble find-related` with a promising result's `file_path` and `line` to discover related implementations.
40
+
5. Use grep only when you need exhaustive literal matches or quick confirmation of an exact string.
0 commit comments