Skip to content

Commit 4508610

Browse files
committed
docs: strengthen query guidance in skills against over-filtering
- Add over-filtering as critical mistake #1 in core skill - Rewrite querying section with explicit CORRECT/AVOID examples - Fix CLI quick reference to show --cursor instead of --after - Add query + cursor examples to init skill template - Add inline guidance note to init template CLI section
1 parent 642abbc commit 4508610

File tree

2 files changed

+31
-21
lines changed

2 files changed

+31
-21
lines changed

packages/agentcrumbs/skills/agentcrumbs/SKILL.md

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ agentcrumbs tail # Live tail (auto-scoped to current app)
8383
agentcrumbs tail --app foo # Tail a specific app
8484
agentcrumbs tail --all-apps # Tail all apps
8585
agentcrumbs query --since 5m # Query last 5 minutes (all namespaces, 50 per page)
86-
agentcrumbs query --since 5m --after <timestamp> # Next page
86+
agentcrumbs query --since 5m --cursor <id> # Next page (cursor from output)
8787
agentcrumbs clear # Clear crumbs for current app
8888
agentcrumbs clear --all-apps # Clear crumbs for all apps
8989
agentcrumbs strip # Remove all crumb markers from source
@@ -95,27 +95,33 @@ Most commands accept `--app <name>` and `--all-apps`. Default is auto-detect fro
9595

9696
## Querying crumbs
9797

98-
Start broad — query a time window across all namespaces, then paginate if there are too many results. Do NOT filter by namespace or match text unless you are looking for something very specific. The whole point of crumbs is seeing the full picture across services.
98+
**IMPORTANT: Query broadly, paginate — don't filter narrowly.** The value of crumbs is seeing what happened across ALL services, not just one. Filtering to a single namespace or adding match filters defeats the purpose — you'll miss the cross-service interactions that reveal the real bug.
99+
100+
The right approach:
101+
1. Query a time window with no namespace filter
102+
2. Read the first page of results
103+
3. Use `--cursor` to paginate forward if you need more
99104

100105
```bash
101-
# Start here: get recent crumbs across all services
106+
# CORRECT: broad query, paginate through results
102107
agentcrumbs query --since 5m
108+
agentcrumbs query --since 5m --cursor a1b2c3d4 # cursor from previous output
103109

104-
# Paginate forward using the cursor from the output
105-
agentcrumbs query --since 5m --cursor a1b2c3d4
106-
107-
# Time window with absolute bounds
108-
agentcrumbs query --after 2026-03-11T14:00:00Z --before 2026-03-11T14:05:00Z
110+
# CORRECT: narrow the time window, not the namespaces
111+
agentcrumbs query --after 2026-03-11T14:00:00Z --before 2026-03-11T14:01:00Z
109112

110-
# Smaller pages if context is tight
113+
# CORRECT: smaller pages to save context
111114
agentcrumbs query --since 5m --limit 25
112115

113-
# Only filter by namespace/match when you have a specific reason
114-
agentcrumbs query --since 5m --tag error
116+
# CORRECT: filter by session (still shows all namespaces in that session)
115117
agentcrumbs query --session a1b2c3
118+
119+
# AVOID: don't filter to one namespace unless you already know the root cause
120+
# agentcrumbs query --since 5m --ns auth-service # too narrow!
121+
# agentcrumbs query --since 5m --match "userId:123" # too narrow!
116122
```
117123

118-
Results are paginated (50 per page by default). When there are more results, the output includes a `--cursor` ID for the next page. Pass it back to get the next page.
124+
Results are paginated (50 per page by default). When there are more results, the output includes a short `--cursor` ID for the next page.
119125

120126
Run `agentcrumbs <command> --help` for detailed options on any command.
121127

@@ -148,9 +154,10 @@ agentcrumbs stats --all-apps # Per-app statistics
148154

149155
## Critical mistakes
150156

151-
1. **Missing markers** — Every crumb line needs `// @crumbs` or a `#region @crumbs` block. Without them, `strip` can't clean up.
152-
2. **Creating trail() in hot paths**`trail()` parses the env var each call. Create once at module scope, use `child()` for per-request context.
153-
3. **No collector running** — Without `agentcrumbs collect`, crumbs go to stderr only and can't be queried. Start the collector before reproducing issues.
157+
1. **Over-filtering queries** — Do NOT add `--ns` or `--match` filters to narrow results. Use `--limit` and `--cursor` to paginate instead. Filtering to one namespace hides cross-service bugs. If there are too many results, narrow the time window or reduce `--limit`, not the namespaces.
158+
2. **Missing markers** — Every crumb line needs `// @crumbs` or a `#region @crumbs` block. Without them, `strip` can't clean up.
159+
3. **Creating trail() in hot paths**`trail()` parses the env var each call. Create once at module scope, use `child()` for per-request context.
160+
4. **No collector running** — Without `agentcrumbs collect`, crumbs go to stderr only and can't be queried. Start the collector before reproducing issues.
154161

155162
## Further discovery
156163

packages/agentcrumbs/skills/agentcrumbs/init/SKILL.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,16 @@ production.
141141
### CLI
142142

143143
```bash
144-
AGENTCRUMBS=1 node app.js # enable tracing (or AGENTCRUMBS_APP=my-project)
145-
agentcrumbs collect # start collector (multi-service)
146-
agentcrumbs tail # live tail (scoped to this app)
147-
agentcrumbs tail --app my-project # tail a specific app
148-
agentcrumbs clear # clear crumbs for this app
149-
agentcrumbs strip # remove crumbs before merge
144+
AGENTCRUMBS=1 node app.js # enable tracing
145+
agentcrumbs collect # start collector
146+
agentcrumbs tail # live tail (scoped to this app)
147+
agentcrumbs query --since 5m # query recent crumbs (all namespaces)
148+
agentcrumbs query --since 5m --cursor <id> # paginate (cursor from output)
149+
agentcrumbs clear # clear crumbs for this app
150+
agentcrumbs strip # remove crumbs before merge
150151
```
152+
153+
When querying, always start broad (all namespaces) and paginate with `--cursor`. Do not filter by `--ns` or `--match` — the value is in seeing the full cross-service picture.
151154
````
152155

153156
Adapt the example above to the actual discovered namespaces and app name.

0 commit comments

Comments
 (0)