Skip to content

Commit 642abbc

Browse files
committed
docs: update all docs and READMEs for app concept and cursor pagination
- Fix storage path to ~/.agentcrumbs/<app>/crumbs.jsonl everywhere - Add app field to cross-language examples (curl, Python, Go, Rust) - Update CLI examples with --app, --all-apps, --cursor flags - Add AGENTCRUMBS_APP env var to README env var table - Update collect.mdx to show per-app routing - Update multi-service guide with per-app storage
1 parent d1b9d16 commit 642abbc

File tree

6 files changed

+54
-34
lines changed

6 files changed

+54
-34
lines changed

README.md

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Crumbs are development-only. They get stripped before merge and cost nothing whe
77
```
88
Service A ──┐ ┌── $ agentcrumbs tail
99
Service B ──┤── fetch() ──> Collector :8374 ──┤── $ agentcrumbs query --since 5m
10-
Service C ──┘ (fire & forget) └── ~/.agentcrumbs/crumbs.jsonl
10+
Service C ──┘ (fire & forget) └── ~/.agentcrumbs/<app>/crumbs.jsonl
1111
```
1212

1313
## Getting started
@@ -54,14 +54,16 @@ When something goes wrong, the agent starts the collector and queries the trail:
5454
```bash
5555
agentcrumbs collect --quiet &
5656
AGENTCRUMBS=1 node app.js
57-
agentcrumbs query --since 5m --ns auth-service
57+
agentcrumbs query --since 5m
5858
```
5959

6060
```
6161
auth-service login attempt +0ms { tokenPrefix: "eyJhbGci" }
6262
auth-service token decode ok +3ms { userId: "u_8f3k" }
6363
auth-service permissions check +8ms { roles: [] }
6464
auth-service rejected: no roles +8ms { status: 401 }
65+
66+
4 crumbs.
6567
```
6668

6769
Now the agent knows: the token is valid, but the user has no roles. The fix is in role assignment, not token validation.
@@ -114,8 +116,11 @@ Everything is controlled by a single `AGENTCRUMBS` environment variable.
114116
| `auth-*,api-*` | Multiple patterns (comma or space separated) |
115117
| `* -internal-*` | Match all except excluded patterns |
116118
| `{"ns":"*","port":9999}` | JSON config with full control |
119+
| `{"app":"my-app","ns":"*"}` | Explicit app name |
120+
121+
JSON config fields: `app` (app name, default auto-detect from package.json), `ns` (namespace filter, required), `port` (collector port, default 8374), `format` (`"pretty"` or `"json"`, default `"pretty"`).
117122

118-
JSON config fields: `ns` (namespace filter, required), `port` (collector port, default 8374), `format` (`"pretty"` or `"json"`, default `"pretty"`).
123+
You can also set `AGENTCRUMBS_APP` to override the app name independently.
119124

120125
## CLI
121126

@@ -127,24 +132,27 @@ agentcrumbs collect --quiet & # Start in background
127132
agentcrumbs collect --port 9999 # Custom port
128133

129134
# Live tail
130-
agentcrumbs tail # All namespaces
135+
agentcrumbs tail # All namespaces (scoped to current app)
131136
agentcrumbs tail --ns auth-service # Filter by namespace
132-
agentcrumbs tail --tag perf # Filter by tag
137+
agentcrumbs tail --app my-app # Tail a specific app
138+
agentcrumbs tail --all-apps # Tail all apps
133139

134-
# Query
135-
agentcrumbs query --since 5m # Last 5 minutes
136-
agentcrumbs query --ns auth-service --since 1h
137-
agentcrumbs query --tag root-cause
138-
agentcrumbs query --json --limit 50
140+
# Query (paginated, 50 per page)
141+
agentcrumbs query --since 5m # Last 5 minutes
142+
agentcrumbs query --since 5m --cursor a1b2c3d4 # Next page
143+
agentcrumbs query --since 1h --limit 25 # Smaller pages
144+
agentcrumbs query --session a1b2c3 # Filter by session
145+
agentcrumbs query --tag root-cause # Filter by tag
139146

140147
# Strip
141148
agentcrumbs strip --dry-run # Preview removals
142149
agentcrumbs strip # Remove all crumb code
143150
agentcrumbs strip --check # CI gate (exits 1 if markers found)
144151

145152
# Utilities
146-
agentcrumbs stats # Crumb counts, file size
147-
agentcrumbs clear # Delete stored crumbs
153+
agentcrumbs stats # Crumb counts (current app)
154+
agentcrumbs stats --all-apps # Stats for all apps
155+
agentcrumbs clear # Clear crumbs (current app)
148156
```
149157

150158
Time units: `s` (seconds), `m` (minutes), `h` (hours), `d` (days).
@@ -160,7 +168,7 @@ The collector is language-agnostic. Any language with HTTP support can send crum
160168
```bash
161169
curl -X POST http://localhost:8374/crumb \
162170
-H "Content-Type: application/json" \
163-
-d '{"ts":"2026-01-01T00:00:00Z","ns":"shell","msg":"hello","type":"crumb","dt":0,"pid":1}'
171+
-d '{"app":"my-app","ts":"2026-01-01T00:00:00Z","ns":"shell","msg":"hello","type":"crumb","dt":0,"pid":1}'
164172
```
165173

166174
## Runtime compatibility

docs/content/docs/cli/collect.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The collector is an HTTP server that receives crumbs via `POST /crumb` and write
1111
agentcrumbs collect
1212
# agentcrumbs collector
1313
# http: http://localhost:8374/crumb
14-
# store: ~/.agentcrumbs/crumbs.jsonl
14+
# crumbs stored per-app in ~/.agentcrumbs/<app>/
1515
# press ctrl+c to stop
1616
```
1717

@@ -50,8 +50,8 @@ agentcrumbs collect --quiet
5050

5151
1. Listens on the specified port for `POST /crumb` requests
5252
2. Validates the JSON body matches the crumb schema
53-
3. Appends each crumb as a line to `crumbs.jsonl`
54-
4. The `tail` and `query` commands read from this file
53+
3. Routes each crumb to per-app storage at `~/.agentcrumbs/<app>/crumbs.jsonl`
54+
4. The `tail` and `query` commands read from these files
5555

5656
### Without the collector
5757

docs/content/docs/guides/cross-language.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Send a `POST` request to `http://localhost:8374/crumb` with a JSON body matching
1313

1414
| Field | Type | Description |
1515
| --- | --- | --- |
16+
| `app` | `string` | App name (used for per-app storage routing) |
1617
| `ts` | `string` | ISO 8601 timestamp |
1718
| `ns` | `string` | Namespace |
1819
| `msg` | `string` | Message |
@@ -38,7 +39,7 @@ Send a `POST` request to `http://localhost:8374/crumb` with a JSON body matching
3839
```bash
3940
curl -X POST http://localhost:8374/crumb \
4041
-H "Content-Type: application/json" \
41-
-d '{"ts":"2026-01-01T00:00:00Z","ns":"shell","msg":"hello","type":"crumb","dt":0,"pid":1}'
42+
-d '{"app":"my-app","ts":"2026-01-01T00:00:00Z","ns":"shell","msg":"hello","type":"crumb","dt":0,"pid":1}'
4243
```
4344

4445
### Python
@@ -50,6 +51,7 @@ from datetime import datetime
5051
def crumb(ns, msg, data=None):
5152
try:
5253
requests.post("http://localhost:8374/crumb", json={
54+
"app": "my-app",
5355
"ts": datetime.utcnow().isoformat() + "Z",
5456
"ns": ns,
5557
"msg": msg,
@@ -69,6 +71,7 @@ crumb("python-service", "processing started", {"items": 42})
6971
```go
7072
func crumb(ns, msg string, data any) {
7173
body, _ := json.Marshal(map[string]any{
74+
"app": "my-app",
7275
"ts": time.Now().UTC().Format(time.RFC3339Nano),
7376
"ns": ns,
7477
"msg": msg,
@@ -86,6 +89,7 @@ func crumb(ns, msg string, data any) {
8689
```rust
8790
fn crumb(ns: &str, msg: &str) {
8891
let body = serde_json::json!({
92+
"app": "my-app",
8993
"ts": chrono::Utc::now().to_rfc3339(),
9094
"ns": ns,
9195
"msg": msg,

docs/content/docs/guides/multi-service.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ agentcrumbs is designed for systems with multiple services running locally.
1010
```
1111
Service A ──┐ ┌── $ agentcrumbs tail
1212
Service B ──┤── fetch() ──> Collector :8374 ──┤── $ agentcrumbs query --since 5m
13-
Service C ──┘ (fire & forget) └── ~/.agentcrumbs/crumbs.jsonl
13+
Service C ──┘ (fire & forget) └── ~/.agentcrumbs/<app>/crumbs.jsonl
1414
```
1515

1616
1. Each service imports `agentcrumbs` and calls `trail()` to create namespaced trail functions
1717
2. When `AGENTCRUMBS` is set, crumbs are sent via HTTP to the collector
18-
3. The collector writes crumbs to a shared JSONL file
19-
4. The CLI reads from the JSONL file to provide tail, query, and replay
18+
3. The collector routes crumbs to per-app storage at `~/.agentcrumbs/<app>/crumbs.jsonl`
19+
4. The CLI reads from these files to provide tail, query, and replay (auto-scoped to current app)
2020

2121
## Setup
2222

docs/content/docs/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Crumbs are development-only. They get stripped before merge and cost nothing whe
1414
```
1515
Service A ──┐ ┌── $ agentcrumbs tail
1616
Service B ──┤── fetch() ──> Collector :8374 ──┤── $ agentcrumbs query --since 5m
17-
Service C ──┘ (fire & forget) └── ~/.agentcrumbs/crumbs.jsonl
17+
Service C ──┘ (fire & forget) └── ~/.agentcrumbs/<app>/crumbs.jsonl
1818
```
1919

2020
## Why agents need this

packages/agentcrumbs/README.md

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Crumbs are development-only. They get stripped before merge and cost nothing whe
77
```
88
Service A ──┐ ┌── $ agentcrumbs tail
99
Service B ──┤── fetch() ──> Collector :8374 ──┤── $ agentcrumbs query --since 5m
10-
Service C ──┘ (fire & forget) └── ~/.agentcrumbs/crumbs.jsonl
10+
Service C ──┘ (fire & forget) └── ~/.agentcrumbs/<app>/crumbs.jsonl
1111
```
1212

1313
## Getting started
@@ -54,14 +54,16 @@ When something goes wrong, the agent starts the collector and queries the trail:
5454
```bash
5555
agentcrumbs collect --quiet &
5656
AGENTCRUMBS=1 node app.js
57-
agentcrumbs query --since 5m --ns auth-service
57+
agentcrumbs query --since 5m
5858
```
5959

6060
```
6161
auth-service login attempt +0ms { tokenPrefix: "eyJhbGci" }
6262
auth-service token decode ok +3ms { userId: "u_8f3k" }
6363
auth-service permissions check +8ms { roles: [] }
6464
auth-service rejected: no roles +8ms { status: 401 }
65+
66+
4 crumbs.
6567
```
6668

6769
Now the agent knows: the token is valid, but the user has no roles. The fix is in role assignment, not token validation.
@@ -114,8 +116,11 @@ Everything is controlled by a single `AGENTCRUMBS` environment variable.
114116
| `auth-*,api-*` | Multiple patterns (comma or space separated) |
115117
| `* -internal-*` | Match all except excluded patterns |
116118
| `{"ns":"*","port":9999}` | JSON config with full control |
119+
| `{"app":"my-app","ns":"*"}` | Explicit app name |
120+
121+
JSON config fields: `app` (app name, default auto-detect from package.json), `ns` (namespace filter, required), `port` (collector port, default 8374), `format` (`"pretty"` or `"json"`, default `"pretty"`).
117122

118-
JSON config fields: `ns` (namespace filter, required), `port` (collector port, default 8374), `format` (`"pretty"` or `"json"`, default `"pretty"`).
123+
You can also set `AGENTCRUMBS_APP` to override the app name independently.
119124

120125
## CLI
121126

@@ -127,24 +132,27 @@ agentcrumbs collect --quiet & # Start in background
127132
agentcrumbs collect --port 9999 # Custom port
128133

129134
# Live tail
130-
agentcrumbs tail # All namespaces
135+
agentcrumbs tail # All namespaces (scoped to current app)
131136
agentcrumbs tail --ns auth-service # Filter by namespace
132-
agentcrumbs tail --tag perf # Filter by tag
137+
agentcrumbs tail --app my-app # Tail a specific app
138+
agentcrumbs tail --all-apps # Tail all apps
133139

134-
# Query
135-
agentcrumbs query --since 5m # Last 5 minutes
136-
agentcrumbs query --ns auth-service --since 1h
137-
agentcrumbs query --tag root-cause
138-
agentcrumbs query --json --limit 50
140+
# Query (paginated, 50 per page)
141+
agentcrumbs query --since 5m # Last 5 minutes
142+
agentcrumbs query --since 5m --cursor a1b2c3d4 # Next page
143+
agentcrumbs query --since 1h --limit 25 # Smaller pages
144+
agentcrumbs query --session a1b2c3 # Filter by session
145+
agentcrumbs query --tag root-cause # Filter by tag
139146

140147
# Strip
141148
agentcrumbs strip --dry-run # Preview removals
142149
agentcrumbs strip # Remove all crumb code
143150
agentcrumbs strip --check # CI gate (exits 1 if markers found)
144151

145152
# Utilities
146-
agentcrumbs stats # Crumb counts, file size
147-
agentcrumbs clear # Delete stored crumbs
153+
agentcrumbs stats # Crumb counts (current app)
154+
agentcrumbs stats --all-apps # Stats for all apps
155+
agentcrumbs clear # Clear crumbs (current app)
148156
```
149157

150158
Time units: `s` (seconds), `m` (minutes), `h` (hours), `d` (days).
@@ -160,7 +168,7 @@ The collector is language-agnostic. Any language with HTTP support can send crum
160168
```bash
161169
curl -X POST http://localhost:8374/crumb \
162170
-H "Content-Type: application/json" \
163-
-d '{"ts":"2026-01-01T00:00:00Z","ns":"shell","msg":"hello","type":"crumb","dt":0,"pid":1}'
171+
-d '{"app":"my-app","ts":"2026-01-01T00:00:00Z","ns":"shell","msg":"hello","type":"crumb","dt":0,"pid":1}'
164172
```
165173

166174
## Runtime compatibility

0 commit comments

Comments
 (0)