telescope
llms.txt2 starsChanged 14 days agoMITView on GitHub
Read what a running Flutter app captured, from an LLM agent or a CI script: HTTP traffic, logs, exceptions, debug dumps, in-app events, gate checks, database queries, cache operations and frame timings. Records sit in in-memory ring buffers, with an optional redacted JSONL timeline on disk, and are served as crumbs_* MCP tools and crumbs:* CLI commands on the dowel substrate. Stack: Dart >=3.13, Flutter >=3.47. A dowel plugin: CrumbsDowelProvider adds the crumbs:* commands and crumbs_* MCP tools, which call…
The file
Files
# crumbs
> Read what a running Flutter app captured, from an LLM agent or a CI script: HTTP traffic, logs, exceptions, debug dumps, in-app events, gate checks, database queries, cache operations and frame timings. Records sit in in-memory ring buffers, with an optional redacted JSONL timeline on disk, and are served as `crumbs_*` MCP tools and `crumbs:*` CLI commands on the `dowel` substrate.
**Stack**: Dart >=3.13, Flutter >=3.47. A `dowel` plugin: `CrumbsDowelProvider` adds the `crumbs:*` commands and `crumbs_*` MCP tools, which call `ext.crumbs.*` VM Service extensions inside the app. Production dependencies: the Flutter SDK, `dowel`, `logging`, `meta`. Crumbs adds no build-mode guard of its own, so guard the install with `if (!kReleaseMode)` (`crumbs:install` writes it): anyone who reaches the VM Service of a build that carries crumbs can read every buffer.
**Setup**:
```bash
flutter pub add crumbs
dart run crumbs crumbs:install # scaffolds ./bin/dowel, registers the plugin, patches lib/main.dart
dart run crumbs mcp:install # the `dowel` entry in .mcp.json; reconnect the MCP client after it
./bin/dowel start --device=chrome # or macos, linux, windows, a device id
./bin/dowel crumbs:tail # "No log records." on a fresh start is not an error
```
```dart
import 'package:crumbs/crumbs.dart';
import 'package:flutter/foundation.dart' show kReleaseMode;
import 'package:flutter/widgets.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
if (!kReleaseMode) {
CrumbsPlugin.install();
CrumbsPlugin.registerWatcher(ExceptionWatcher());
CrumbsPlugin.registerWatcher(DumpWatcher());
}
runApp(const Placeholder()); // your app
}
```
## API
- `CrumbsPlugin.install()`: registers the `ext.crumbs.*` extensions and installs `LogWatcher`, which listens on `Logger.root.onRecord`, turns on `hierarchicalLoggingEnabled` and sets `Logger.root.level` to `Level.ALL`. Idempotent; call it before `runApp` (before `Magic.init` on a Magic app). `--dart-define=CRUMBS_DISABLE=1` (or `true`, `yes`) makes it, `registerWatcher` and `registerHttpAdapter` return without installing anything.
- `CrumbsPlugin.registerWatcher(CrumbsWatcher)`: installs the watcher at once and does not deduplicate, so register each one once. `CrumbsWatcher` is an `abstract interface class` (`name`, `install()`, `uninstall()`): implement it, do not extend it. The shipped watchers are `final class`. Shipped: `ExceptionWatcher` (chains `FlutterError.onError` and `PlatformDispatcher.instance.onError`), `DumpWatcher` (chains `debugPrint`; installs only in debug builds unless `DumpWatcher()..allowInRelease = true` is set before `registerWatcher`, and the host guard allows the build), `FramePerfWatcher` (frame timings; `blocks` fill only while `FlutterTimeline` collection is on).
- `CrumbsPlugin.registerHttpAdapter(CrumbsHttpAdapter)`: an HTTP capture adapter; `CrumbsHttpAdapter` is an `abstract interface class` (`name`, `install()`, `uninstall()`, and `pendingCount`, which has no default body: return 0 when you do not track in-flight requests), and `CrumbsStore.pendingHttpCount` sums each adapter's `pendingCount`. No adapter is needed to record HTTP: an app's own interceptor builds an `HttpRequestRecord` and calls `CrumbsStore.recordHttp`. An adapter that holds a body as structured data runs it through `CrumbsRedaction.redactParameters` before stringifying it, and a string body through `CrumbsRedaction.redactBody` before truncating it: the store masks only JSON and form strings, and a cut JSON body no longer parses.
- `CrumbsStore`: the ring buffers. `recordX` (`recordHttp`, `recordLog`, `recordException`, `recordDump`, `recordEvent`, `recordGate`, `recordQuery`, `recordModel`, `recordCache`, `recordFramePerf`), `recentX({limit})` (`recentLogs` also takes `minLevel`), the `onXRecord` broadcast streams, `setCapacity(cap, kind: CrumbsKind.x)` (500 per buffer by default; frame perf holds 3600 and is set with `kind: CrumbsKind.framePerf`), `clear()`, `clearFramePerf()`, `pause()`, `resume()`, `resetForTesting()`.
- `CrumbsRedaction`: masking by key, always on (`hideRequestHeaders`, `hideRequestParameters`, `hideResponseParameters`, `redactParameters`, `redactBody`): HTTP headers, JSON and form bodies and URL query parameters, plus the Map elements of a query's bindings and a gate check's arguments (a positional binding has no key). The host text hook `redactor` masks free text (log, exception and dump messages, SQL, event payloads, the strings inside bindings and arguments, a gate's user id, the URL, header values and bodies of an HTTP record) before buffering; a hook that throws drops the record. Without a `redactor`, a credential written into free text is buffered as written. Model and cache records are never masked.
- `CrumbsFileSink.start(directory:, maxFileBytes: 1048576, maxFiles: 8)`: the rotating JSONL timeline of redacted log, event and exception records, in files named `timeline-<UTC stamp>-<n>.jsonl` with `n` from 1. Run one sink per directory: pruning deletes the files of a second process writing there. It throws a `FileSystemException` when the directory cannot be written.
- `CrumbsDowelProvider` and `followCursor` (`package:crumbs/cli.dart`): the provider dowel loads from `lib/app/_plugins.g.dart`, and the polling loop behind `--follow`.
- `MagicCrumbsIntegration.install()` (`package:magic_devtools/crumbs.dart`): the Magic HTTP adapter, the model, cache, event, gate and query watchers, and, from `magic_devtools` 1.1.0, `MagicLogWatcher` (every `Log.*` call, into the log buffer `crumbs_tail` reads), after `Magic.init()`. A `magic_devtools` release built on crumbs ships this integration; `crumbs:install` wires it when the resolved `magic_devtools` has that library, and otherwise warns and skips the Magic wiring, so Magic's buffers stay empty until you upgrade.
- MCP tools: `crumbs_tail` (logs, reads `ext.crumbs.console`; takes `limit`, `level`, `logger`, `since`), `crumbs_requests` (answers under `requests`), `crumbs_exceptions`, `crumbs_dumps`, `crumbs_events` (takes `limit`, `type`, `since`), `crumbs_gates`, `crumbs_queries`, `crumbs_caches`, `crumbs_frames`, `crumbs_clear`.
- CLI commands mirror the tools by name, except: `crumbs:install` and `crumbs:files` (the timeline files) have no tool. Pause and resume are extensions with neither.
## Platforms
Any Flutter target that exposes a VM Service in a debug or profile build: Android, iOS, macOS, Windows and Linux, and web for everything except the file sink. `crumbs:install` guards with `!kReleaseMode`, so debug and profile builds carry crumbs and a release build drops it. `CrumbsFileSink` imports `dart:io` with no conditional import, so the timeline on disk needs a native target and pub.dev shows no Web tag.
## Rules for agents
- Crumbs reads, it never drives. Exercise the app first (tapir, a test script or a person), then read what it recorded; an idle app proves nothing.
- An empty buffer is not a quiet app until its producer is known to be registered: logs need `package:logging` calls (a Magic app's `Log.*` calls need `MagicLogWatcher`, `magic_devtools` 1.1.0 or later), exceptions need `ExceptionWatcher`, dumps need `DumpWatcher` in a debug build, HTTP needs an adapter, events, gates, queries and caches need the Magic watchers (a `magic_devtools` release built on crumbs), frames need `FramePerfWatcher`. The CLI's empty-buffer warning names the missing producer for every buffer but logs and timeline files.
- `crumbs_frames` always carries `livenessCounter`, the count of frames drawn. After driving the UI, empty frames with a counter that does not move mean no `FramePerfWatcher` is registered or the engine stalled.
- Records come oldest first, the newest last. Without `since`, `limit` keeps the newest N.
- Zero the buffers with `crumbs_clear` before a repro; do not clear when chasing a fault that already happened.
- Page logs and events with the `cursor` each read returns, passed back as `since` (CLI: `--since`, or `--follow` to keep polling). A `since` that is not an integer is refused with `invalidParams` (the CLI exits 3), never ignored.
- A read command exits 75 when the extension is not registered yet (the app is still booting, is a release build, has no crumbs, or has `CRUMBS_DISABLE` set): retry a few times, then check the build mode and the install.
- `********` is crumbs' credential mask, not the app's value. A host `redactor` that throws drops the record, so a missing line after a sensitive log call can mean a failing redactor.
- Exceptions are the errors that reach `FlutterError.onError` or `PlatformDispatcher.instance.onError`; a `try`/`catch` that swallows an error shows up only if the code logged it.
- Magic model events go to the model buffer, which no extension, tool or command serves; `crumbs_events` holds auth, database and gate-definition events.
## Docs
- [Getting started](https://anilcancakir.com/crumbs/docs/getting-started/index.md): the overview of adding crumbs and wiring the watchers
- [Installation](https://anilcancakir.com/crumbs/docs/getting-started/installation.md): requirements, `crumbs:install`, the build-mode guard, MCP wiring
- [Quickstart](https://anilcancakir.com/crumbs/docs/getting-started/quickstart.md): from a fresh Flutter project to a first captured record
- [Buffers](https://anilcancakir.com/crumbs/docs/getting-started/buffers.md): the ring buffers, their capacities and eviction
- [Redaction](https://anilcancakir.com/crumbs/docs/getting-started/redaction.md): credential masking and the host `redactor`
- [File sink](https://anilcancakir.com/crumbs/docs/getting-started/file-sink.md): the JSONL timeline on disk and how to read it back
- [Watchers](https://anilcancakir.com/crumbs/docs/watchers/index.md): what each watcher and adapter captures and how to register it
- [FramePerfWatcher](https://anilcancakir.com/crumbs/docs/watchers/frames.md): frame timings, block attribution and the liveness counter
- [MCP overview](https://anilcancakir.com/crumbs/docs/mcp/overview.md): how the crumbs tools join dowel's MCP server
- [MCP setup](https://anilcancakir.com/crumbs/docs/mcp/setup.md): the `.mcp.json` entry and the reconnect
- [MCP tool reference](https://anilcancakir.com/crumbs/docs/mcp/tool-reference.md): input schema and response for every `crumbs_*` tool
- [Cursor and filters](https://anilcancakir.com/crumbs/docs/mcp/cursor-and-filters.md): `since`, `cursor`, `logger` and `type` on logs and events
## Links
- [README](https://github.com/anilcancakir/crumbs#readme): overview, feature tables and quick start
- [API reference](https://pub.dev/documentation/crumbs/latest/): generated from the doc comments
- [Changelog](https://github.com/anilcancakir/crumbs/blob/master/CHANGELOG.md): what changed in each version
- [Source](https://github.com/anilcancakir/crumbs): issues and pull requests
- [Agent skill](https://github.com/anilcancakir/crumbs/tree/master/skills/crumbs): install with `npx skills add anilcancakir/crumbs`
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

