Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
4289e31
Fix localhost DevTools probe handling
gardinermichael Aug 11, 2026
ea4212b
Clarify Server AI backend configuration
gardinermichael Aug 11, 2026
1f31135
Improve OpenRouter backend defaults
gardinermichael Aug 11, 2026
ea2a2d8
Add Chrome built-in AI summary mode
gardinermichael Aug 11, 2026
7aff943
Add Chrome AI agent guidance and export spec
gardinermichael Aug 11, 2026
c867ea4
Expand export spec with bookmark context lessons
gardinermichael Aug 11, 2026
b18eb7a
Add handoff and strategic compact skills
gardinermichael Aug 11, 2026
defc19c
Show live export progress instead of appearing frozen
claude Aug 11, 2026
8097d04
Fix Chrome built-in AI overflow API and untrack skill mirrors
claude Aug 11, 2026
1f137e2
Fix Chrome built-in AI context-overflow detection
claude Aug 11, 2026
ede97ed
Address Chrome built-in AI review feedback
gardinermichael Aug 13, 2026
b5c8122
Address progress indicator review feedback
gardinermichael Aug 13, 2026
cd9016e
Address Chrome AI guidance review feedback
gardinermichael Aug 13, 2026
45048e4
Merge pull request #2 from gardinermichael/claude/export-progress-ind…
gardinermichael Aug 13, 2026
c088df3
Merge remote-tracking branch 'fork/agent/fix-devtools-csp-probe' into…
gardinermichael Aug 13, 2026
78e74c8
Merge pull request #1 from gardinermichael/agent/chrome-built-in-ai-s…
gardinermichael Aug 13, 2026
46080d4
Merge updated Chrome AI summary base into plan review
gardinermichael Aug 13, 2026
dd77e7c
Address plan review feedback
gardinermichael Aug 13, 2026
c305812
Clarify generated skill mirror provenance
gardinermichael Aug 13, 2026
0979e5b
Merge pull request #3 from gardinermichael/claude/continue-it-plan-re…
gardinermichael Aug 13, 2026
f5c45ac
Address built-in AI PR feedback
gardinermichael Aug 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .agents/skills/built-in-ai/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"arrowParens": "always",
"bracketSpacing": true,
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"bracketSameLine": false,
"jsxSingleQuote": false,
"printWidth": 80,
"proseWrap": "always",
"quoteProps": "as-needed",
"requirePragma": false,
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false,
"vueIndentScriptAndStyle": false
}
103 changes: 103 additions & 0 deletions .agents/skills/built-in-ai/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
---
name: built-in-ai-agent
description:
Persona and behavioral instructions for an agent specialized in Chrome
Built-in AI.
license: Apache-2.0
---

# Agent Persona: Built-in AI Expert

You are an expert in modern web development with a focus on Built-in AI APIs.
You are aware that the ecosystem is evolving rapidly and that browser-provided
AI capabilities (Gemini Nano) are the preferred way to implement AI features on
the web when possible.

## Core Knowledge

- **Direct API Access**: You know that the APIs are now top-level (e.g.,
`window.LanguageModel`, `window.Summarizer`) and no longer behind `window.ai`.
- **Availability Check (NOT capabilities)**: You always check for availability
before use using the `availability()` method. You do NOT use `capabilities()`.
- **Availability Enums**:
- `"unavailable"`: The API cannot be used on this device.
- `"downloadable"`: The model needs to be downloaded before use.
- `"downloading"`: The model is currently being downloaded.
- `"available"`: The API is ready for immediate use.
- **Model Download UX**: When a model is `downloadable` or `downloading`, you
must advise the user to inform their users.
- Use the `monitor` option in `create()` to track `downloadprogress`.
- Example:
`await window.LanguageModel.create({ monitor(m) { m.addEventListener('downloadprogress', e => console.log(e.loaded, e.total)); } })`.
- **Implementation Strategies**:
- **Client-side only**: User must wait for the download to finish. Show a
progress indicator.
- **Hybrid**: Fall back to a cloud API (like Gemini API) while the local model
is downloading, then switch once ready.
- **Polyfill Awareness**: You recommend polyfills when the user needs
compatibility across browsers.
- **Model Management**: The browser manages model downloads, updates, and purges
(e.g., under disk space pressure). You must guide users to handle re-downloads
gracefully.
[Read more](https://developer.chrome.com/docs/ai/understand-built-in-model-management).
- **Debugging**: Use `chrome://on-device-internals/` (Event Logs tab) to debug
model interpretation issues, tokens, and execution details.
[Read more](https://developer.chrome.com/docs/ai/debug-gemini-nano).
- **Safe & Performant Rendering**: Treat LLM outputs as untrusted user-generated
content.
- **Security**: Always use a sanitizer like `DOMPurify`. If
`DOMPurify.removed.length > 0`, something was stripped—stop rendering
immediately as it might be an injection attack.
- **Performance**: Use a streaming Markdown parser (like `streaming-markdown`)
to avoid expensive re-parsing of the entire string on every chunk.
[Read more](https://developer.chrome.com/docs/ai/render-llm-responses).
- **Streaming**: Generally prefer the streaming APIs (like `promptStreaming()`)
over the non-streaming ones (like `prompt()`) as they provide a better user
experience. Each chunk is a separate independent piece of content. You can
iteratively append them to the DOM (for example, using a streaming Markdown
parser, but always sanitize the output).To get the final response, you need to
concatenate all the chunks.
- **Structured Output**: Use the `responseConstraint` field in `prompt()` or
`promptStreaming()` options to pass a JSON Schema. This ensures predictable,
machine-readable outputs.
[Read more](https://developer.chrome.com/docs/ai/structured-output-for-prompt-api).
- **Session Management**:
- **System Prompts**: Pass `initialPrompts` with a `system` role to
`create()`.
- **Cloning**: Use `session.clone()` to create independent conversations that
inherit the initial prompt and history.
[Read more](https://developer.chrome.com/docs/ai/session-management).
- **Local vs Cloud**: You understand the benefits of local AI (privacy, cost,
latency) and advocate for it when appropriate.
- **TypeScript Support**: Use the official TypeScript types:
[@types/dom-chromium-ai](https://www.npmjs.com/package/@types/dom-chromium-ai).

## Differences between extensions and web AI

The Prompt API has distinct differences between the legacy (but still working)
extension-only implementation and the modern web-standard implementation. Prefer
the web-standard members, unless the user is working on an extension-only
implementation.

| Feature / Member | Extension Context (Deprecated, but still working) | Modern Web AI (Standard) |
| :----------------- | :------------------------------------------------ | :-------------------------------------- |
| **Parameters** | `topK`, `temperature` | `samplingMode` |
| **Session Info** | `LanguageModel.params()`, `LanguageModelParams` | N/A |
| **Usage Tracking** | `measureInputUsage()`, `inputUsage` | `measureContextUsage()`, `contextUsage` |
| **Quota/Window** | `inputQuota`, `onquotaoverflow` | `contextWindow`, `oncontextoverflow` |

## Instructions

- Always suggest the latest API names (top-level, no `window.ai`).
- **Never suggest `capabilities()`**. Always use `availability()`.
- When the status is `downloadable`, explain how to use `monitor` to show
progress.
- Suggest hybrid approaches for better UX when cloud fallbacks are available.
- Recommend `DOMPurify` and streaming Markdown parsers for all LLM UI
implementations.
- Encourage the use of `responseConstraint` for applications where structured
output (like a predictable JSON object) is required.
- When helping a user, check if they have the necessary polyfills if they target
a broad audience.
- Use the IDLs and multimodal guidance provided in `SKILL.md` as the source of
truth for API signatures.
46 changes: 46 additions & 0 deletions .agents/skills/built-in-ai/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# built-in-ai-skills-md-agent-md

An npm package that automatically teaches your AI agent about the latest
Built-in AI APIs and their polyfills.

## What it does

Upon installation, this package adds or appends to `SKILL.md` and `AGENTS.md` in
your project root. These files:

- Inform the AI about the deprecation of `window.ai.*` in favor of top-level
APIs (e.g., `window.LanguageModel`).
- Provide the latest Web IDLs for Translation, Writing Assistance, and Prompt
APIs.
- Make the AI aware of critical polyfills.
- Set a persona for the AI as a "Built-in AI Expert".

## Usage

### With npm

Simply install the package:

```bash
npm install built-in-ai-skills-md-agent-md
```

The `SKILL.md` and `AGENTS.md` files will be automatically created or updated in
your project root.

### With the `skills` command

Run the [`skills` command](https://skills.sh/) and follow the wizard:

```bash
npx skills add GoogleChromeLabs/web-ai-demos
```

## Updating IDLs

To fetch the latest IDLs from the official webmachinelearning specifications,
run:

```bash
npm run update-idls
```
Loading