Skip to content

Commit 448c2fa

Browse files
authored
Merge pull request #10 from triggerdotdev/fix/skill-discovery
fix: @tanstack/intent skill discovery and consolidate skills, website improvements
2 parents cd2564a + bb1eb1f commit 448c2fa

File tree

16 files changed

+180
-1155
lines changed

16 files changed

+180
-1155
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.

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,8 @@ agentcrumbs ships with [@tanstack/intent](https://tanstack.com/blog/from-docs-to
2929

3030
| Skill | What it teaches |
3131
| --- | --- |
32+
| `agentcrumbs` | Core workflow, API, markers, CLI reference, common mistakes |
3233
| `agentcrumbs/init` | Scans repo, discovers namespaces, writes config |
33-
| `agentcrumbs/core` | `trail()`, `crumb()`, markers, env var, noop guarantee |
34-
| `agentcrumbs/scopes-and-context` | `scope()`, `wrap()`, `child()`, `snapshot()`, `assert()` |
35-
| `agentcrumbs/sessions-and-tags` | `session()`, tags, grouping and filtering |
36-
| `agentcrumbs/cli` | `collect`, `tail`, `query`, `strip`, `session` |
3734

3835
Skills travel with the package version. The agent always has docs matching the installed code.
3936

docs/content/docs/skills.mdx

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,43 +30,34 @@ Each skill is a Markdown file with YAML frontmatter:
3030

3131
```yaml
3232
---
33-
name: agentcrumbs/core
33+
name: agentcrumbs
3434
description: >
35-
Core debug tracing with agentcrumbs: trail(), crumb(),
36-
@crumbs markers, env var config, noop strategy...
35+
Debug mode for AI coding agents. Drop structured traces inline
36+
while writing code, query them when something breaks, strip
37+
before merge.
3738
type: core
3839
library: agentcrumbs
39-
library_version: "0.1.0"
40+
library_version: "0.2.0"
4041
sources:
42+
- "triggerdotdev/agentcrumbs:README.md"
4143
- "triggerdotdev/agentcrumbs:src/trail.ts"
42-
- "triggerdotdev/agentcrumbs:src/env.ts"
4344
---
4445
```
4546

46-
The content includes correct usage patterns, explicitly flags common mistakes, and defines constraints the agent must follow.
47+
The content includes correct usage patterns, explicitly flags common mistakes, and points agents to CLI help and docs for deeper discovery.
4748

4849
## Available skills
4950

5051
| Skill | What it teaches |
5152
| --- | --- |
53+
| `agentcrumbs` | Core workflow, API, markers, CLI quick reference, critical mistakes, and pointers to further discovery |
5254
| `agentcrumbs/init` | Scans repo structure, discovers namespaces, writes config to CLAUDE.md or .cursorrules |
53-
| `agentcrumbs/core` | `trail()`, `crumb()`, `// @crumbs` markers, `#region @crumbs` blocks, env var, noop guarantee |
54-
| `agentcrumbs/scopes-and-context` | `scope()`, `wrap()`, `child()`, `snapshot()`, `assert()`, context propagation |
55-
| `agentcrumbs/sessions-and-tags` | `session()`, tags, grouping crumbs for replay and filtering |
5655

57-
| `agentcrumbs/cli` | `collect`, `tail`, `query`, `strip`, `session`, and other CLI commands |
58-
59-
## What each skill contains
60-
61-
**Patterns.** Correct usage examples the agent can copy. These show the right way to use each API, with proper markers, at module scope, with structured data.
62-
63-
**Common mistakes.** Explicitly marked with severity levels (CRITICAL, HIGH, MEDIUM). Things like: checking `process.env.AGENTCRUMBS` on every call instead of using the noop, creating `trail()` inside request handlers, forgetting `// @crumbs` markers. The agent learns what to avoid, not just what to do.
64-
65-
**Constraints.** Hard rules: every crumb line must have a marker, don't invent namespaces without checking the catalog, create trails at module scope.
56+
The top-level `agentcrumbs` skill covers the essentials an agent needs to use crumbs correctly: the write-collect-query-strip workflow, core API (`trail`, `crumb`, `child`, `scope`), marker syntax, and the most common mistakes. For deeper functionality like sessions, tags, scopes, and testing patterns, it points agents to CLI help (`agentcrumbs --help`), type definitions, and the docs.
6657

6758
## The init skill
6859

69-
The `agentcrumbs/init` skill deserves special mention. It's the entry point for setting up agentcrumbs in any project.
60+
The `agentcrumbs/init` skill is the entry point for setting up agentcrumbs in any project.
7061

7162
When the agent runs init, it:
7263

@@ -81,9 +72,8 @@ After init, every agent working in the repo uses the same consistent namespaces.
8172
If you don't use @tanstack/intent, you can point agents to skills directly:
8273

8374
```
84-
skills/agentcrumbs/core/SKILL.md
85-
skills/agentcrumbs/cli/SKILL.md
86-
skills/agentcrumbs/init/SKILL.md
75+
node_modules/agentcrumbs/skills/agentcrumbs/SKILL.md
76+
node_modules/agentcrumbs/skills/agentcrumbs/init/SKILL.md
8777
```
8878

8979
Or add a reference in your agent config file manually. But `npx @tanstack/intent install` handles all of this automatically.

docs/public/favicon.ico

14.7 KB
Binary file not shown.

docs/src/app/home.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@
120120
.hp-skills h2 { font-family: var(--hp-title); font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 12px; }
121121
.hp-skills-install { background: var(--hp-bg-code); border: 1px solid var(--hp-border); border-radius: 8px; overflow: hidden; margin-bottom: 24px; }
122122
.hp-skills-pre { padding: 20px; overflow-x: auto; font-family: var(--hp-mono); font-size: 12.5px; line-height: 1.7; color: var(--hp-text-dim); margin: 0; background: transparent !important; }
123+
.hp-skills-config { padding: 20px; font-family: var(--hp-mono); font-size: 13px; }
124+
.hp-skills-config-heading { color: var(--hp-text); font-weight: 600; margin-bottom: 12px; }
125+
.hp-skills-table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
126+
.hp-skills-table th { text-align: left; color: var(--hp-text-dim); font-weight: 500; padding: 6px 16px 6px 0; border-bottom: 1px solid var(--hp-border); }
127+
.hp-skills-table td { color: var(--hp-text-dim); padding: 6px 16px 6px 0; border-bottom: 1px solid var(--hp-border); }
128+
.hp-skills-config-note { color: var(--hp-text-muted); font-size: 12px; }
123129
.hp-skills-detail { display: flex; gap: 32px; }
124130
.hp-skills-detail p { color: var(--hp-text-dim); font-size: 14px; line-height: 1.6; flex: 1; }
125131
.hp-skills-detail a { color: var(--hp-accent); }

docs/src/app/page.tsx

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -225,30 +225,33 @@ export default function HomePage() {
225225
{/* SKILLS */}
226226
<section className="hp-skills">
227227
<div className="hp-container">
228-
<h2>The init skill is the real setup</h2>
229-
<p className="hp-section-subtitle">After installing, tell your agent to run <code>agentcrumbs/init</code>. It scans your repo, discovers your services and modules, and builds a <strong>namespace catalog</strong> that gets written to your agent config (CLAUDE.md, .cursorrules, etc.).</p>
230-
<p className="hp-section-subtitle">This is the critical step. Without the catalog, every agent invents its own namespace names: <code>auth</code>, <code>auth-service</code>, <code>authService</code>, <code>authentication</code>, all pointing at the same thing. The catalog locks it down. Every agent, every session, same names.</p>
228+
<h2>Set up with <code>agentcrumbs/init</code></h2>
229+
<p className="hp-section-subtitle">The init skill scans your repo, discovers services and modules, and writes a namespace table to your agent config (CLAUDE.md, .cursorrules, etc.). Agents use the table to pick consistent namespace names across sessions.</p>
231230

232231
<div className="hp-skills-install">
233232
<div className="hp-code-pane-header" style={{ borderRadius: '8px 8px 0 0' }}>
234233
<div className="hp-code-pane-label">what init writes to your agent config</div>
235234
</div>
236-
<pre className="hp-skills-pre"><code dangerouslySetInnerHTML={{ __html: `<span class="trail-msg">## agentcrumbs</span>
237-
238-
<span class="trail-msg">### Namespaces</span>
239-
240-
<span class="cc-dim">| Namespace | Description | Path |</span>
241-
<span class="cc-dim">| --- | --- | --- |</span>
242-
| <span class="trail-name">api-gateway</span> | <span class="cc-dim">HTTP API and routing</span> | <span class="cc-dim">apps/gateway</span> |
243-
| <span class="trail-name-b">auth-service</span> | <span class="cc-dim">Authentication and token handling</span> | <span class="cc-dim">apps/auth</span> |
244-
| <span class="trail-name-c">billing</span> | <span class="cc-dim">Stripe integration and charges</span> | <span class="cc-dim">apps/billing</span> |
245-
| <span class="trail-name">task-runner</span> | <span class="cc-dim">Background job execution</span> | <span class="cc-dim">apps/worker</span> |
246-
247-
<span class="cc-dim">Do not invent new namespaces. Pick from this table or ask first.</span>` }} /></pre>
235+
<div className="hp-skills-config">
236+
<div className="hp-skills-config-heading">## agentcrumbs</div>
237+
<div className="hp-skills-config-heading">### Namespaces</div>
238+
<table className="hp-skills-table">
239+
<thead>
240+
<tr><th>Namespace</th><th>Description</th><th>Path</th></tr>
241+
</thead>
242+
<tbody>
243+
<tr><td className="trail-name">api-gateway</td><td>HTTP API and routing</td><td>apps/gateway</td></tr>
244+
<tr><td className="trail-name-b">auth-service</td><td>Authentication and token handling</td><td>apps/auth</td></tr>
245+
<tr><td className="trail-name-c">billing</td><td>Stripe integration and charges</td><td>apps/billing</td></tr>
246+
<tr><td className="trail-name">task-runner</td><td>Background job execution</td><td>apps/worker</td></tr>
247+
</tbody>
248+
</table>
249+
<div className="hp-skills-config-note">Do not invent new namespaces. Pick from this table or ask first.</div>
250+
</div>
248251
</div>
249252

250253
<div className="hp-skills-detail">
251-
<p>agentcrumbs ships 5 skills via <a href="https://tanstack.com/blog/from-docs-to-agents" target="_blank">@tanstack/intent</a>, covering the full API, CLI, and common mistakes. Skills travel with the package version, so the agent always has docs matching the installed code.</p>
254+
<p>agentcrumbs ships 2 skills via <a href="https://tanstack.com/blog/from-docs-to-agents" target="_blank">@tanstack/intent</a>: one covering the core workflow, API, and common mistakes, and an init skill that sets up your repo. Skills travel with the package version, so the agent always has docs matching the installed code.</p>
252255
<p>Compatible with Claude Code, Cursor, GitHub Copilot, and any agent that supports the <a href="https://agentskills.io" target="_blank">Agent Skills spec</a>.</p>
253256
</div>
254257
</div>

packages/agentcrumbs/README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,8 @@ agentcrumbs ships with [@tanstack/intent](https://tanstack.com/blog/from-docs-to
2929

3030
| Skill | What it teaches |
3131
| --- | --- |
32+
| `agentcrumbs` | Core workflow, API, markers, CLI reference, common mistakes |
3233
| `agentcrumbs/init` | Scans repo, discovers namespaces, writes config |
33-
| `agentcrumbs/core` | `trail()`, `crumb()`, markers, env var, noop guarantee |
34-
| `agentcrumbs/scopes-and-context` | `scope()`, `wrap()`, `child()`, `snapshot()`, `assert()` |
35-
| `agentcrumbs/sessions-and-tags` | `session()`, tags, grouping and filtering |
36-
| `agentcrumbs/cli` | `collect`, `tail`, `query`, `strip`, `session` |
3734

3835
Skills travel with the package version. The agent always has docs matching the installed code.
3936

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)