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
Copy file name to clipboardExpand all lines: docs/content/docs/cli/collect.mdx
+4-10Lines changed: 4 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,22 +17,16 @@ agentcrumbs collect
17
17
18
18
### Agent workflow
19
19
20
-
When an agent needs to debug something, it should start the collector itself:
20
+
When an agent needs to debug something, it should start the collector, clear old crumbs, reproduce, and query:
21
21
22
22
```bash
23
-
# Start collector in background
24
23
agentcrumbs collect --quiet &
25
-
26
-
# Run the service with crumbs enabled
24
+
agentcrumbs clear
27
25
AGENTCRUMBS=1 node app.js
28
-
29
-
# ... reproduce the issue ...
30
-
31
-
# Query the trail
32
-
agentcrumbs query --since 5m
26
+
agentcrumbs query
33
27
```
34
28
35
-
The agent owns the collector lifecycle. Start it before debugging, query the results, stop it when done. The `--quiet` flag keeps it from cluttering stdout.
29
+
Clear before reproducing so you only see crumbs from this run. No `--since` guessing needed. The `--quiet` flag keeps the collector from cluttering stdout.
A single env var controls everything. Non-JSON values are shorthand:
156
-
157
-
| Value | Effect |
158
-
|-------|--------|
159
-
|`1`, `*`, `true`| Enable all namespaces |
160
-
|`auth-*`| Enable matching namespaces (raw string treated as filter) |
161
-
|`{"ns":"auth-*,api-*"}`| JSON config with namespace filter |
162
-
|`{"ns":"* -internal-*"}`| Wildcard with exclusions |
163
-
|`{"ns":"*","port":9999}`| Custom collector port |
164
-
|`{"ns":"*","format":"json"}`| JSON output to stderr |
165
-
| (unset) | Disabled — all calls are noop |
166
-
167
-
## The Noop Guarantee
168
-
169
-
When `trail()` is called and the namespace is disabled, it returns a pre-frozen noop function. There is no per-call `if (enabled)` check. The function body is empty.
crumb("msg", { data }); // empty function, returns undefined
175
-
crumb.child({ x: 1 }); // returns same NOOP
176
-
crumb.scope("op", fn); // calls fn() directly
177
-
crumb.wrap("name", fn); // returns original fn
178
-
```
37
+
## Noop Guarantee
179
38
180
-
The noopcheck happens once at `trail()`creation time, not on every call.
39
+
When disabled, `trail()` returns a frozen noop. No per-call check. `crumb.child()` returns same noop. `crumb.scope("op", fn)`calls `fn()` directly. `crumb.wrap("name", fn)` returns original `fn`.
0 commit comments