Skip to content

Commit 62abf24

Browse files
committed
fix: fix @tanstack/intent skill discovery and consolidate skills
The intent walker only recurses into directories that contain a SKILL.md. The skills/agentcrumbs/ namespace directory had no SKILL.md, so consumers saw 0 skills after installing. - Add top-level agentcrumbs SKILL.md covering workflow, core API, markers, CLI reference, and pointers to further discovery - Remove granular sub-skills (core, cli, scopes, sessions, testing) - Keep agentcrumbs/init as a separate action skill - Add prepublishOnly validation via @tanstack/intent validate - Add CLAUDE.md with changeset and skill validation guidelines
1 parent cd2564a commit 62abf24

File tree

10 files changed

+141
-1109
lines changed

10 files changed

+141
-1109
lines changed

.changeset/fix-skill-discovery.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"agentcrumbs": minor
3+
---
4+
5+
Fix @tanstack/intent skill discovery and consolidate skills
6+
7+
- Add parent SKILL.md at the namespace level so the intent walker can recurse into skill subdirectories
8+
- Consolidate 6 granular skills into 2: a top-level usage skill and the init skill
9+
- Top-level skill covers workflow, core API, markers, CLI reference, and pointers to further discovery

CLAUDE.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# CLAUDE.md
2+
3+
## Changesets
4+
5+
Never run `changeset version` — that happens in CI. Only add changeset files via `pnpm changeset` or by creating a markdown file in `.changeset/`.
6+
7+
## Skills
8+
9+
After modifying any `SKILL.md` files, validate before committing:
10+
11+
```bash
12+
cd packages/agentcrumbs && npx @tanstack/intent@latest validate
13+
```
14+
15+
This also runs automatically via `prepublishOnly` in the package.

packages/agentcrumbs/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
"build": "tsc",
4444
"dev": "tsc --watch",
4545
"test": "vitest",
46-
"typecheck": "tsc --noEmit"
46+
"typecheck": "tsc --noEmit",
47+
"prepublishOnly": "npx @tanstack/intent@latest validate"
4748
},
4849
"devDependencies": {
4950
"@types/node": "^25.3.3",
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
---
2+
name: agentcrumbs
3+
description: >
4+
Debug mode for AI coding agents. Drop structured traces inline while writing
5+
code, query them when something breaks, strip before merge. Covers the core
6+
workflow: trail, crumb, markers, collector, query, strip. Activate when using
7+
agentcrumbs, adding debug tracing, or when an agent needs to understand
8+
runtime behavior.
9+
type: core
10+
library: agentcrumbs
11+
library_version: "0.2.0"
12+
sources:
13+
- "triggerdotdev/trigger-labs:debug-mode/README.md"
14+
- "triggerdotdev/trigger-labs:debug-mode/src/trail.ts"
15+
- "triggerdotdev/trigger-labs:debug-mode/src/types.ts"
16+
---
17+
18+
# agentcrumbs
19+
20+
Structured debug traces that agents drop inline while writing code, then query when something breaks. Stripped before merge, zero cost when off.
21+
22+
## Workflow
23+
24+
```
25+
1. Write code + crumbs → crumb("user verified", { userId }); // @crumbs
26+
2. Run with collector → agentcrumbs collect & AGENTCRUMBS=1 node app.js
27+
3. Something breaks → agentcrumbs query --since 5m
28+
4. Fix the bug → (read the trail, find the cause, fix it)
29+
5. Strip before merge → agentcrumbs strip
30+
```
31+
32+
## Core API
33+
34+
```typescript
35+
import { trail } from "agentcrumbs"; // @crumbs
36+
const crumb = trail("my-service"); // @crumbs — create once at module level
37+
38+
// Basic crumb
39+
crumb("checkout started", { cartId: "c_91" }); // @crumbs
40+
41+
// With tags (third arg) for filtering
42+
crumb("cache miss", { key }, { tags: ["perf"] }); // @crumbs
43+
44+
// Child context for per-request tracing
45+
const reqCrumb = crumb.child({ requestId: req.id }); // @crumbs
46+
reqCrumb("handling request", { path: req.url }); // @crumbs
47+
48+
// Scoped operations with automatic enter/exit/error tracking
49+
const user = await crumb.scope("validate-token", async (ctx) => { // @crumbs
50+
ctx.crumb("checking jwt"); // @crumbs
51+
return await verifyToken(token); // @crumbs
52+
}); // @crumbs
53+
54+
// Guard expensive args
55+
if (crumb.enabled) { crumb("dump", { state: structuredClone(big) }); } // @crumbs
56+
```
57+
58+
## Markers
59+
60+
Every crumb line needs a marker so `agentcrumbs strip` can remove it before merge.
61+
62+
```typescript
63+
// Single-line marker
64+
crumb("event", { data }); // @crumbs
65+
66+
// Block marker for multi-line sections
67+
// #region @crumbs
68+
const result = await crumb.scope("operation", async (ctx) => {
69+
ctx.crumb("step 1");
70+
ctx.crumb("step 2");
71+
return value;
72+
});
73+
// #endregion @crumbs
74+
```
75+
76+
**Unmarked crumbs will leak into production code.** The strip command only removes lines with `// @crumbs` or code inside `#region @crumbs` blocks.
77+
78+
## CLI quick reference
79+
80+
```bash
81+
agentcrumbs collect # Start HTTP collector (required for query/tail)
82+
agentcrumbs tail # Live tail (--ns, --tag, --match filters)
83+
agentcrumbs query --since 5m # Query history (--ns, --tag, --session, --json)
84+
agentcrumbs strip # Remove all crumb markers from source
85+
agentcrumbs strip --check # CI gate — exits 1 if markers found
86+
agentcrumbs --help # Full command reference
87+
```
88+
89+
Run `agentcrumbs <command> --help` for detailed options on any command.
90+
91+
## Enable tracing
92+
93+
```bash
94+
AGENTCRUMBS=1 node app.js # Enable all namespaces
95+
AGENTCRUMBS='{"ns":"auth-*"}' node app.js # Filter by namespace
96+
```
97+
98+
When `AGENTCRUMBS` is not set, `trail()` returns a frozen noop. No conditionals, no overhead.
99+
100+
## Critical mistakes
101+
102+
1. **Missing markers** — Every crumb line needs `// @crumbs` or a `#region @crumbs` block. Without them, `strip` can't clean up.
103+
2. **Creating trail() in hot paths**`trail()` parses the env var each call. Create once at module scope, use `child()` for per-request context.
104+
3. **No collector running** — Without `agentcrumbs collect`, crumbs go to stderr only and can't be queried. Start the collector before reproducing issues.
105+
106+
## Further discovery
107+
108+
- **CLI details**: `agentcrumbs --help` and `agentcrumbs <command> --help`
109+
- **TypeScript types**: Check the type definitions in `node_modules/agentcrumbs/dist/index.d.ts`
110+
- **Docs**: https://agentcrumbs.dev/docs
111+
- **Sessions and tags**: `crumb.session()` for grouping, `{ tags: [...] }` as third arg for filtering
112+
- **Testing**: `import { MemorySink, addSink } from "agentcrumbs"` to capture crumbs in tests
113+
- **Scopes**: `crumb.scope()`, `crumb.wrap()`, `crumb.snapshot()`, `crumb.assert()` for structured tracing

0 commit comments

Comments
 (0)