@vpxa/aikit 0.1.151 → 0.1.153
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/packages/blocks-core/dist/index.d.ts +471 -0
- package/packages/blocks-core/dist/index.js +863 -0
- package/packages/chunker/dist/index.d.ts +12 -0
- package/packages/chunker/dist/index.js +4 -4
- package/packages/cli/dist/index.js +15 -15
- package/packages/cli/dist/{init-Dk0WDziB.js → init-O57V8aOH.js} +1 -1
- package/packages/cli/dist/{scaffold-BB6OrTuA.js → scaffold-DwQDdiCJ.js} +1 -1
- package/packages/cli/dist/{templates-D4t_3cJs.js → templates-VOIHbNnT.js} +1 -1
- package/packages/present/dist/index.html +818 -3629
- package/packages/server/dist/index.js +1 -1
- package/packages/server/dist/server-Bs6Rib4s.js +398 -0
- package/packages/store/dist/index.js +12 -12
- package/scaffold/dist/adapters/_shared.mjs +2 -1
- package/scaffold/dist/adapters/claude-code.mjs +10 -9
- package/scaffold/dist/adapters/codex.mjs +3 -3
- package/scaffold/dist/adapters/copilot.mjs +20 -20
- package/scaffold/dist/adapters/gemini.mjs +9 -3
- package/scaffold/dist/definitions/agents.mjs +16 -120
- package/scaffold/dist/definitions/bodies.mjs +214 -254
- package/scaffold/dist/definitions/protocols.mjs +110 -206
- package/scaffold/dist/definitions/skills/adr-skill.mjs +27 -0
- package/scaffold/dist/definitions/skills/brainstorming.mjs +14 -0
- package/scaffold/dist/definitions/skills/browser-use.mjs +1 -1
- package/scaffold/dist/definitions/skills/c4-architecture.mjs +46 -1
- package/scaffold/dist/definitions/skills/docs.mjs +34 -0
- package/scaffold/dist/definitions/skills/frontend-design.mjs +20 -0
- package/scaffold/dist/definitions/skills/present.mjs +31 -0
- package/scaffold/dist/definitions/skills/session-handoff.mjs +20 -0
- package/packages/server/dist/server-D67lImHa.js +0 -540
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
> This file contains shared protocols for all code-modifying agents (Implementer, Frontend, Refactor, Debugger). Each agent's definition file contains only its unique identity, constraints, and workflow. **Do not duplicate this content in agent files.**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
## AI Kit MCP Tool Naming Convention
|
|
1
|
+
function e(e){return`
|
|
2
|
+
## Flow Context Bootstrap
|
|
7
3
|
|
|
8
|
-
|
|
9
|
-
At runtime, these are MCP tools exposed by the AI Kit server. Depending on your IDE/client, the actual tool name will be prefixed:
|
|
4
|
+
When dispatched as a subagent within an active flow:
|
|
10
5
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
1. **Withdraw context first** — before any search or file reads:
|
|
7
|
+
\`\`\`
|
|
8
|
+
knowledge({ action: 'withdraw', scope: 'flow', profile: '${e}', budget: 6000 })
|
|
9
|
+
\`\`\`
|
|
10
|
+
This returns pre-analyzed context from prior agents.
|
|
16
11
|
|
|
17
|
-
|
|
12
|
+
2. **Use returned context** — do NOT re-search or re-read files already covered
|
|
13
|
+
3. **\`read_file\` ONLY** for exact lines needed for editing
|
|
14
|
+
4. **Deposit new discoveries:**
|
|
15
|
+
\`\`\`
|
|
16
|
+
knowledge({ action: 'remember', scope: 'flow', title: '<discovery>', content: '<details>', category: 'context' })
|
|
17
|
+
\`\`\`
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
${e===`<PROFILE>`?`**Profile:** Check your role → implementer | documenter | reviewer | researcher | debugger`:`**Profile:** \`${e}\``}
|
|
20
20
|
|
|
21
|
-
If
|
|
21
|
+
---`}function t(){return"\n## Evidence Citation Protocol (tier-aware)\n\n**Standalone mode:** If no FORGE task_id was provided in your dispatch prompt, skip `evidence_map` calls entirely — provide free-form findings with `file:line` citations only.\n\nThe Orchestrator runs `forge_classify` before dispatching you, and runs the final `evidence_map({ action: 'gate', task_id })` after you respond. **Do not create your own task_id or run the gate** — feed into the Orchestrator's existing evidence map.\n\n| Tier | Your responsibility |\n|------|---------------------|\n| Floor | Free-form findings with `file.ts#Lxx` citations. No `evidence_map` calls required. |\n| Standard | For every CRITICAL or HIGH finding: `evidence_map({action:'add', task_id, claim, status:'V', receipt:'file.ts#Lxx'})`. Max 2-4 adds to keep signal high. |\n| Critical | Structured claims for all CRITICAL/HIGH findings (2-4 Verified + receipts) AND tag contract/security claims with `safety_gate:'commitment'` or `safety_gate:'provenance'`. |\n\n**Every response MUST include:**\n- `**FORGE Task ID:** <task_id>` (passed in by Orchestrator, or state \"not provided\")\n- `**Tier applied:** Floor | Standard | Critical`\n- `**Findings:** <list>` with `file:line` receipts\n- Verdict: `APPROVED` | `CHANGES_REQUESTED` | `BLOCKED`\n\nDo NOT:\n- Create a new `evidence_map` (the Orchestrator already did)\n- Run `evidence_map({action:'gate'})` yourself — the Orchestrator owns the gate\n- Duplicate findings into the map that weren't CRITICAL/HIGH"}const n={"code-agent-base":`# Code Agent — Shared Base Instructions
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
> This file contains shared protocols for all code-modifying agents (Implementer, Frontend, Refactor, Debugger). Each agent's definition file contains only its unique identity, constraints, and workflow. **Do not duplicate this content in agent files.**
|
|
24
24
|
|
|
25
25
|
## Invocation Mode Detection
|
|
26
26
|
|
|
@@ -97,6 +97,10 @@ Always follow this order when you need to understand something. **Never skip to
|
|
|
97
97
|
|
|
98
98
|
Past decisions, conventions, and patterns are stored in curated knowledge. Auto-knowledge captures facts automatically from tool outputs (conventions, errors, test results, research). Use \`search()\` with specific keywords to surface these — they are indexed alongside manually curated entries. You MUST search before implementing:
|
|
99
99
|
|
|
100
|
+
- If running as a sub-agent, start with \`knowledge({ action: "withdraw", scope: "flow", profile: "<your-role>", budget: 6000 })\` to pull prior compressed context.
|
|
101
|
+
- Before re-running \`file_summary\`, \`compact\`, \`stratum_card\`, \`search\`, or \`blast_radius\`, check existing flow context first and reuse it when it is sufficient.
|
|
102
|
+
- Reuse existing stash/checkpoint/workset context when present before creating new compressed artifacts.
|
|
103
|
+
|
|
100
104
|
\`\`\`
|
|
101
105
|
search("keywords about the feature/area you're changing") // check for past decisions
|
|
102
106
|
knowledge({ action: "list", category: "decisions" }) // scan recent decisions that might apply
|
|
@@ -110,6 +114,7 @@ knowledge({ action: "withdraw", scope: "flow", profile: "<your-role>", budget: 6
|
|
|
110
114
|
**Rules:**
|
|
111
115
|
- If results exist → **READ them and FOLLOW** established patterns. Do not silently override.
|
|
112
116
|
- If results conflict with the current task → **surface the conflict** to the user/orchestrator.
|
|
117
|
+
- If flow-context search results already contain enough detail → **use them directly** instead of re-running the original tool.
|
|
113
118
|
- If no results → proceed, but **persist your decisions with \`knowledge({ action: "remember", ... })\`** afterward for future recall.
|
|
114
119
|
- Never assume "there's nothing stored" — always search first.
|
|
115
120
|
|
|
@@ -141,7 +146,7 @@ If unsure which AI Kit tool to use → run \`guide({ topic: "what you need" })\`
|
|
|
141
146
|
|
|
142
147
|
---
|
|
143
148
|
|
|
144
|
-
## Loop Detection &
|
|
149
|
+
## Loop Detection & Tooling Failure Modes
|
|
145
150
|
|
|
146
151
|
Track repeated failures. If the same approach fails, **stop and change strategy**.
|
|
147
152
|
|
|
@@ -159,6 +164,27 @@ Track repeated failures. If the same approach fails, **stop and change strategy*
|
|
|
159
164
|
|
|
160
165
|
**Never brute-force.** If you catch yourself making the same type of edit repeatedly, you are in a loop.
|
|
161
166
|
|
|
167
|
+
### Tooling failure exits
|
|
168
|
+
| Signal | Stop condition | Exit action |
|
|
169
|
+
|--------|---------------|-------------|
|
|
170
|
+
| \`evidence_map\` returns HOLD | Insufficient evidence for FORGE gate | Surface concrete gaps to user — do not retry |
|
|
171
|
+
| Sub-agent returns BLOCKED | Subagent cannot proceed | Read its message, escalate to user with options |
|
|
172
|
+
| \`onboard\` reports stale index (>7 days) | Index is stale | Run \`reindex({})\` ONCE; if still stale, surface to user |
|
|
173
|
+
| \`check\` or \`test_run\` fails 3x identical | Same failure mode repeating | STOP — surface to user with full output, do not retry |
|
|
174
|
+
| \`compact\` returns < 50% reduction | Compression ineffective | Use \`file_summary\` or \`stratum_card\` instead |
|
|
175
|
+
|
|
176
|
+
## Sub-agent Context Budget
|
|
177
|
+
|
|
178
|
+
When dispatching subagents, choose tier based on task complexity:
|
|
179
|
+
|
|
180
|
+
| Tier | Budget | Tools | Use For |
|
|
181
|
+
|------|--------|-------|---------|
|
|
182
|
+
| **Floor** | T1 stratum_card only | Read-only | Quick lookups, single-file Q&A |
|
|
183
|
+
| **Standard** | compact() + T2 stratum_card | Read-only + search | Multi-file analysis, research |
|
|
184
|
+
| **Critical** | digest() + stratum_card + flow context | Full | Implementation, decisions, multi-step |
|
|
185
|
+
|
|
186
|
+
Always tell the subagent: profile, tier, and what they should NOT do.
|
|
187
|
+
|
|
162
188
|
---
|
|
163
189
|
|
|
164
190
|
## Hallucination Self-Check
|
|
@@ -183,12 +209,14 @@ Track repeated failures. If the same approach fails, **stop and change strategy*
|
|
|
183
209
|
|
|
184
210
|
---
|
|
185
211
|
|
|
186
|
-
##
|
|
212
|
+
## Ambiguity Resolution Protocol
|
|
187
213
|
|
|
188
|
-
|
|
214
|
+
When a task admits ≥2 valid interpretations:
|
|
215
|
+
1. **Name** each interpretation in one sentence.
|
|
216
|
+
2. **Identify** which assumption causes the most harm if wrong (irreversibility, blast radius, user surprise).
|
|
217
|
+
3. **Ask** ONE question — the one that disambiguates the highest-harm assumption.
|
|
189
218
|
|
|
190
|
-
|
|
191
|
-
**Required pattern:** \`file_summary\` → \`read_file\` (exact edit region) → \`replace_string_in_file\`
|
|
219
|
+
Do NOT silently pick. Do NOT ask multiple questions if one is sufficient.
|
|
192
220
|
|
|
193
221
|
## Scope Guard
|
|
194
222
|
|
|
@@ -234,30 +262,9 @@ For outdated AI Kit entries → \`knowledge({ action: "update", path, content, r
|
|
|
234
262
|
|
|
235
263
|
---
|
|
236
264
|
|
|
237
|
-
##
|
|
238
|
-
|
|
239
|
-
Auto-knowledge captures tool responses as shared context between agents. **Before running any read tool, check if another agent already ran it.**
|
|
240
|
-
|
|
241
|
-
**Check-before-run pattern:**
|
|
242
|
-
1. Before \`file_summary\`, \`compact\`, \`stratum_card\`, \`search\`, \`blast_radius\`:
|
|
243
|
-
- \`search({ query: "<tool-name>: <path-or-query>", tags: ["flow-context"], limit: 3 })\`
|
|
244
|
-
- Example: \`search({ query: "file_summary: src/auth.ts", tags: ["flow-context"] })\`
|
|
245
|
-
2. If results found with enough detail → **use them directly** — do NOT re-run the tool
|
|
246
|
-
3. Only run the original tool if no cached results exist or results are insufficient
|
|
247
|
-
|
|
248
|
-
**At agent startup (FIRST action):**
|
|
249
|
-
- Call \`knowledge({ action: "withdraw", profile: "<your-role>", budget: 6000 })\` to receive pre-analyzed context from prior agents in the same flow
|
|
250
|
-
- This surfaces file summaries, search results, and analysis that other agents already performed
|
|
251
|
-
- Parse the withdrawn context — it may contain the exact information you need
|
|
252
|
-
|
|
253
|
-
**Why this matters:**
|
|
254
|
-
- Each re-run wastes tokens and time
|
|
255
|
-
- Auto-knowledge stores \`file_summary\`, \`compact\`, \`search\`, \`stratum_card\`, \`blast_radius\`, \`scope_map\` results
|
|
256
|
-
- Results are tagged with \`flow-context\` and searchable via \`search()\`
|
|
257
|
-
|
|
258
|
-
---
|
|
265
|
+
## AI Kit Tool Discipline
|
|
259
266
|
|
|
260
|
-
|
|
267
|
+
Use AI Kit retrieval and compression tools first. Prefer reusable compressed context over raw reads, and only drop to native tools when precision for an edit or tool fallback requires it.
|
|
261
268
|
|
|
262
269
|
| NEVER use this | USE THIS instead | Why |
|
|
263
270
|
|---|---|---|
|
|
@@ -268,33 +275,28 @@ Auto-knowledge captures tool responses as shared context between agents. **Befor
|
|
|
268
275
|
| \`grep_search\` for a symbol name | \`symbol({ name })\` | Definition + references with scope and call context |
|
|
269
276
|
| \`run_in_terminal\` for tsc/lint | \`check({})\` | Typecheck + lint combined, summary output |
|
|
270
277
|
| \`run_in_terminal\` for test | \`test_run({})\` | Run tests with structured output |
|
|
278
|
+
| Editing without reading | \`file_summary\` then targeted \`read_file\` | Prevents wrong-position edits |
|
|
271
279
|
|
|
272
280
|
**\`read_file\` is ONLY acceptable when you need exact line content FOR EDITING (before \`replace_string_in_file\`).**
|
|
273
281
|
|
|
274
|
-
|
|
282
|
+
For edits, first understand structure with \`file_summary\` or \`compact\`, then use targeted \`read_file\` only for the exact region.
|
|
283
|
+
Never patch from search snippets or assumptions alone.
|
|
275
284
|
|
|
276
|
-
##
|
|
285
|
+
## compact() Failure Recovery
|
|
277
286
|
|
|
278
|
-
|
|
279
|
-
- **\`file_summary({ path })\`** — Structure, exports, imports (~50 tokens vs ~1000+ for read_file)
|
|
280
|
-
- **\`compact({ path, query })\`** — Extract relevant sections from a single file (5-20x token reduction)
|
|
281
|
-
- **\`digest({ sources })\`** — Compress 3+ files into a single token-budgeted summary
|
|
282
|
-
- **\`stratum_card({ files, query })\`** — Generate a reusable T1/T2 context card for files you'll reference repeatedly
|
|
287
|
+
If \`compact()\` returns <200 bytes or empty content, the file is NOT indexed. Follow this fallback:
|
|
283
288
|
|
|
284
|
-
**
|
|
289
|
+
1. **Do NOT retry** compact on the same file — it will fail again
|
|
290
|
+
2. **Use \`read_file\`** with a LARGE range (e.g., \`startLine: 1, endLine: 9999\`) — NEVER chunk into small ranges
|
|
291
|
+
3. **Use \`stash()\`** to cache findings from unindexed files — context pressure causes re-reads
|
|
292
|
+
4. **Check \`status()\`** to see which paths are indexed before calling compact
|
|
285
293
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
| **Execute** | Make changes, one sub-task at a time | Yes — compact between independent sub-tasks |
|
|
291
|
-
| **Verify** | \`check\` + \`test_run\` + \`blast_radius\` | — |
|
|
294
|
+
**Anti-patterns to avoid:**
|
|
295
|
+
- Retrying compact 3x on same unindexed file (wastes 3 tool calls)
|
|
296
|
+
- Falling back to read_file in small chunks (10-50 lines) — each chunk costs ~3K prompt tokens in overhead
|
|
297
|
+
- Re-reading the same file later because you forgot the content — use stash() to cache
|
|
292
298
|
|
|
293
|
-
|
|
294
|
-
- **Never compact mid-operation** — finish the current sub-task first
|
|
295
|
-
- **Recycle context to files** — save analysis results via \`stash\` or \`knowledge({ action: "remember", ... })\`, not just in conversation
|
|
296
|
-
- **Decompose monolithic work** — break into independent chunks, pass results via artifact files between sub-tasks
|
|
297
|
-
- **One-shot sub-tasks** — for self-contained changes, provide all context upfront to avoid back-and-forth
|
|
299
|
+
*Why:* these tools reduce token cost, shrink duplicate reads, and lower the odds of wrong-file or wrong-position edits while preserving reusable context.
|
|
298
300
|
|
|
299
301
|
---
|
|
300
302
|
|
|
@@ -401,26 +403,7 @@ When you need user input or need to explain something before asking:
|
|
|
401
403
|
- **Prefer the simplest method** that adequately conveys the information
|
|
402
404
|
- **CLI mode override:** When running in terminal (not VS Code chat), always use \`format: "browser"\` for any rich content
|
|
403
405
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
When dispatched as a subagent within an active flow:
|
|
407
|
-
|
|
408
|
-
1. **Withdraw context first** — before any search or file reads:
|
|
409
|
-
\`\`\`
|
|
410
|
-
knowledge({ action: 'withdraw', profile: '<PROFILE>', budget: 6000 })
|
|
411
|
-
\`\`\`
|
|
412
|
-
This returns pre-analyzed context from prior agents.
|
|
413
|
-
|
|
414
|
-
2. **Use returned context** — do NOT re-search or re-read files already covered
|
|
415
|
-
3. **\`read_file\` ONLY** for exact lines needed for editing
|
|
416
|
-
4. **Deposit new discoveries:**
|
|
417
|
-
\`\`\`
|
|
418
|
-
knowledge({ action: 'remember', scope: 'flow', title: '<discovery>', content: '<details>', category: 'context' })
|
|
419
|
-
\`\`\`
|
|
420
|
-
|
|
421
|
-
**Profile:** Check your role → implementer | documenter | reviewer | researcher | debugger
|
|
422
|
-
|
|
423
|
-
---
|
|
406
|
+
${e(`<PROFILE>`)}
|
|
424
407
|
|
|
425
408
|
## Handoff Format
|
|
426
409
|
|
|
@@ -439,6 +422,23 @@ Always return this structure when invoked as a sub-agent:
|
|
|
439
422
|
<blockers>{any blocking issues}</blockers>
|
|
440
423
|
</handoff>
|
|
441
424
|
\`\`\`
|
|
425
|
+
|
|
426
|
+
## AI Kit MCP Tool Naming Convention
|
|
427
|
+
|
|
428
|
+
All tool references in these instructions use **short names** (e.g. \`status\`, \`compact\`, \`search\`).
|
|
429
|
+
At runtime, these are MCP tools exposed by the AI Kit server. Depending on your IDE/client, the actual tool name will be prefixed:
|
|
430
|
+
|
|
431
|
+
| Client | Tool naming pattern | Example |
|
|
432
|
+
|--------|-------------------|---------|
|
|
433
|
+
| VS Code Copilot | \`mcp_<serverName>_<tool>\` | \`mcp_aikit_status\` |
|
|
434
|
+
| Claude Code | \`mcp__<serverName>__<tool>\` | \`mcp__aikit__status\` |
|
|
435
|
+
| Other MCP clients | \`<serverName>_<tool>\` or bare \`<tool>\` | \`aikit_status\` or \`status\` |
|
|
436
|
+
|
|
437
|
+
The server name is \`aikit\` — check your MCP configuration if tools aren't found.
|
|
438
|
+
|
|
439
|
+
**When these instructions say** \`status({})\` **→ call the MCP tool whose name ends with** \`_status\` **and pass** \`{}\` **as arguments.**
|
|
440
|
+
|
|
441
|
+
If tools are deferred/lazy-loaded, load them first (e.g. in VS Code Copilot: \`tool_search_tool_regex({ pattern: "aikit" })\`).
|
|
442
442
|
`,"researcher-base":`# Researcher — Shared Base Instructions
|
|
443
443
|
|
|
444
444
|
> Shared methodology for all Researcher variants. Each variant's definition contains only its unique identity and model assignment. **Do not duplicate.**
|
|
@@ -453,26 +453,7 @@ Follow the **MANDATORY FIRST ACTION** and **Information Lookup Order** from code
|
|
|
453
453
|
|
|
454
454
|
**Start with pre-analyzed artifacts.** They cover 80%+ of common research needs.
|
|
455
455
|
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
When dispatched as a subagent within an active flow:
|
|
459
|
-
|
|
460
|
-
1. **Withdraw context first** — before any search or file reads:
|
|
461
|
-
\`\`\`
|
|
462
|
-
knowledge({ action: 'withdraw', scope: 'flow', profile: 'researcher', budget: 6000 })
|
|
463
|
-
\`\`\`
|
|
464
|
-
This returns pre-analyzed context from prior agents.
|
|
465
|
-
|
|
466
|
-
2. **Use returned context** — do NOT re-search or re-read files already covered
|
|
467
|
-
3. **\`read_file\` ONLY** for exact lines needed for editing
|
|
468
|
-
4. **Deposit new discoveries:**
|
|
469
|
-
\`\`\`
|
|
470
|
-
knowledge({ action: 'remember', scope: 'flow', title: '<discovery>', content: '<details>', category: 'context' })
|
|
471
|
-
\`\`\`
|
|
472
|
-
|
|
473
|
-
**Profile:** \`researcher\`
|
|
474
|
-
|
|
475
|
-
---
|
|
456
|
+
${e(`researcher`)}
|
|
476
457
|
|
|
477
458
|
## Research Methodology
|
|
478
459
|
|
|
@@ -550,19 +531,13 @@ When invoked for a decision analysis, you receive a specific question. You MUST:
|
|
|
550
531
|
|
|
551
532
|
## Invocation Mode Detection
|
|
552
533
|
|
|
553
|
-
|
|
554
|
-
- **Sub-agent** (prompt has "## Prior AI Kit Context") → Skip AI Kit Recall, use provided context
|
|
534
|
+
> **Mode:** Researchers always run as subagents — no Direct mode.
|
|
555
535
|
|
|
556
536
|
---
|
|
557
537
|
|
|
558
538
|
## Context Efficiency
|
|
559
539
|
|
|
560
|
-
|
|
561
|
-
- **\`file_summary\`** for structure (exports, imports, call edges — 10x fewer tokens)
|
|
562
|
-
- **\`compact\`** for specific sections (5-20x token reduction vs read_file)
|
|
563
|
-
- **\`digest\`** when synthesizing from 3+ sources
|
|
564
|
-
- **\`stratum_card\`** for files you'll reference repeatedly
|
|
565
|
-
- **\`read_file\` is ONLY acceptable** when you need exact lines for a pending edit operation
|
|
540
|
+
> **Reminder:** Apply Context Efficiency rules — prefer compact/digest/file_summary over raw read_file. See \`code-agent-base\` for full table.
|
|
566
541
|
|
|
567
542
|
## Parallel Exploration via \`lane\`
|
|
568
543
|
|
|
@@ -585,26 +560,7 @@ Follow the **MANDATORY FIRST ACTION** and **Information Lookup Order** from code
|
|
|
585
560
|
2. If onboard shows ❌ → Run \`onboard({ path: '.' })\` and wait for completion
|
|
586
561
|
3. If onboard shows ✅ → Read relevant onboard artifacts using \`compact({ path: '<Onboard Directory>/<file>' })\` — especially \`patterns.md\` and \`api-surface.md\` for review context
|
|
587
562
|
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
When dispatched as a subagent within an active flow:
|
|
591
|
-
|
|
592
|
-
1. **Withdraw context first** — before any search or file reads:
|
|
593
|
-
\`\`\`
|
|
594
|
-
knowledge({ action: 'withdraw', scope: 'flow', profile: 'reviewer', budget: 6000 })
|
|
595
|
-
\`\`\`
|
|
596
|
-
This returns pre-analyzed context from prior agents.
|
|
597
|
-
|
|
598
|
-
2. **Use returned context** — do NOT re-search or re-read files already covered
|
|
599
|
-
3. **\`read_file\` ONLY** for exact lines needed for editing
|
|
600
|
-
4. **Deposit new discoveries:**
|
|
601
|
-
\`\`\`
|
|
602
|
-
knowledge({ action: 'remember', scope: 'flow', title: '<discovery>', content: '<details>', category: 'context' })
|
|
603
|
-
\`\`\`
|
|
604
|
-
|
|
605
|
-
**Profile:** \`reviewer\`
|
|
606
|
-
|
|
607
|
-
---
|
|
563
|
+
${e(`reviewer`)}
|
|
608
564
|
|
|
609
565
|
## Review Workflow
|
|
610
566
|
|
|
@@ -656,28 +612,7 @@ When dispatched as a subagent within an active flow:
|
|
|
656
612
|
- **FAILED** for any CRITICAL finding
|
|
657
613
|
- Always check for **test coverage** on new/changed code
|
|
658
614
|
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
**Standalone mode:** If no FORGE task_id was provided in your dispatch prompt, skip \`evidence_map\` calls entirely — provide free-form findings with \`file:line\` citations only.
|
|
662
|
-
|
|
663
|
-
The Orchestrator runs \`forge_classify\` before dispatching you, and runs the final \`evidence_map({ action: 'gate', task_id })\` after you respond. **Do not create your own task_id or run the gate** — feed into the Orchestrator's existing evidence map.
|
|
664
|
-
|
|
665
|
-
| Tier | Your responsibility |
|
|
666
|
-
|------|---------------------|
|
|
667
|
-
| Floor | Free-form findings with \`file.ts#Lxx\` citations. No \`evidence_map\` calls required. |
|
|
668
|
-
| Standard | For every CRITICAL or HIGH finding: \`evidence_map({action:'add', task_id, claim, status:'V', receipt:'file.ts#Lxx'})\`. Max 2-4 adds to keep signal high. |
|
|
669
|
-
| Critical | Structured claims for all CRITICAL/HIGH findings (2-4 Verified + receipts) AND tag contract/security claims with \`safety_gate:'commitment'\` or \`safety_gate:'provenance'\`. |
|
|
670
|
-
|
|
671
|
-
**Every response MUST include:**
|
|
672
|
-
- \`**FORGE Task ID:** <task_id>\` (passed in by Orchestrator, or state "not provided")
|
|
673
|
-
- \`**Tier applied:** Floor | Standard | Critical\`
|
|
674
|
-
- \`**Findings:** <list>\` with \`file:line\` receipts
|
|
675
|
-
- Verdict: \`APPROVED\` | \`CHANGES_REQUESTED\` | \`BLOCKED\`
|
|
676
|
-
|
|
677
|
-
Do NOT:
|
|
678
|
-
- Create a new \`evidence_map\` (the Orchestrator already did)
|
|
679
|
-
- Run \`evidence_map({action:'gate'})\` yourself — the Orchestrator owns the gate
|
|
680
|
-
- Duplicate findings into the map that weren't CRITICAL/HIGH
|
|
615
|
+
${t()}
|
|
681
616
|
`,"architect-reviewer-base":`# Architect-Reviewer — Shared Base Instructions
|
|
682
617
|
|
|
683
618
|
> Shared methodology for all Architect-Reviewer variants. Each variant's definition contains only identity and model. **Do not duplicate.**
|
|
@@ -690,26 +625,7 @@ Follow the **MANDATORY FIRST ACTION** and **Information Lookup Order** from code
|
|
|
690
625
|
2. If onboard shows ❌ → Run \`onboard({ path: '.' })\` and wait for completion
|
|
691
626
|
3. If onboard shows ✅ → Read relevant onboard artifacts using \`compact({ path: '<Onboard Directory>/<file>' })\` — especially \`structure.md\`, \`dependencies.md\`, and \`diagram.md\` for architecture context
|
|
692
627
|
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
When dispatched as a subagent within an active flow:
|
|
696
|
-
|
|
697
|
-
1. **Withdraw context first** — before any search or file reads:
|
|
698
|
-
\`\`\`
|
|
699
|
-
knowledge({ action: 'withdraw', scope: 'flow', profile: 'reviewer', budget: 6000 })
|
|
700
|
-
\`\`\`
|
|
701
|
-
This returns pre-analyzed context from prior agents.
|
|
702
|
-
|
|
703
|
-
2. **Use returned context** — do NOT re-search or re-read files already covered
|
|
704
|
-
3. **\`read_file\` ONLY** for exact lines needed for editing
|
|
705
|
-
4. **Deposit new discoveries:**
|
|
706
|
-
\`\`\`
|
|
707
|
-
knowledge({ action: 'remember', scope: 'flow', title: '<discovery>', content: '<details>', category: 'context' })
|
|
708
|
-
\`\`\`
|
|
709
|
-
|
|
710
|
-
**Profile:** \`reviewer\`
|
|
711
|
-
|
|
712
|
-
---
|
|
628
|
+
${e(`reviewer`)}
|
|
713
629
|
|
|
714
630
|
## Review Workflow
|
|
715
631
|
|
|
@@ -757,28 +673,7 @@ When dispatched as a subagent within an active flow:
|
|
|
757
673
|
- **BLOCKED** — Fundamental design flaw requiring rethink
|
|
758
674
|
- Always validate **dependency direction** — inner layers must not depend on outer
|
|
759
675
|
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
**Standalone mode:** If no FORGE task_id was provided in your dispatch prompt, skip \`evidence_map\` calls entirely — provide free-form findings with \`file:line\` citations only.
|
|
763
|
-
|
|
764
|
-
The Orchestrator runs \`forge_classify\` before dispatching you, and runs the final \`evidence_map({ action: 'gate', task_id })\` after you respond. **Do not create your own task_id or run the gate** — feed into the Orchestrator's existing evidence map.
|
|
765
|
-
|
|
766
|
-
| Tier | Your responsibility |
|
|
767
|
-
|------|---------------------|
|
|
768
|
-
| Floor | Free-form findings with \`file.ts#Lxx\` citations. No \`evidence_map\` calls required. |
|
|
769
|
-
| Standard | For every CRITICAL or HIGH finding: \`evidence_map({action:'add', task_id, claim, status:'V', receipt:'file.ts#Lxx'})\`. Max 2-4 adds to keep signal high. |
|
|
770
|
-
| Critical | Structured claims for all CRITICAL/HIGH findings (2-4 Verified + receipts) AND tag contract/security claims with \`safety_gate:'commitment'\` or \`safety_gate:'provenance'\`. |
|
|
771
|
-
|
|
772
|
-
**Every response MUST include:**
|
|
773
|
-
- \`**FORGE Task ID:** <task_id>\` (passed in by Orchestrator, or state "not provided")
|
|
774
|
-
- \`**Tier applied:** Floor | Standard | Critical\`
|
|
775
|
-
- \`**Findings:** <list>\` with \`file:line\` receipts
|
|
776
|
-
- Verdict: \`APPROVED\` | \`CHANGES_REQUESTED\` | \`BLOCKED\`
|
|
777
|
-
|
|
778
|
-
Do NOT:
|
|
779
|
-
- Create a new \`evidence_map\` (the Orchestrator already did)
|
|
780
|
-
- Run \`evidence_map({action:'gate'})\` yourself — the Orchestrator owns the gate
|
|
781
|
-
- Duplicate findings into the map that weren't CRITICAL/HIGH
|
|
676
|
+
${t()}
|
|
782
677
|
|
|
783
678
|
## Graph-Assisted Layer Verification
|
|
784
679
|
|
|
@@ -810,7 +705,9 @@ The Orchestrator uses **multi-model decision analysis** to resolve non-trivial t
|
|
|
810
705
|
|
|
811
706
|
Dispatch ALL available Researcher variants **in parallel** via \`runSubagent\` — one call per variant, same question, simultaneous. Each returns an independent recommendation grounded in their thinking style:
|
|
812
707
|
|
|
813
|
-
**IMPORTANT: Include
|
|
708
|
+
**IMPORTANT: Include these instructions in every researcher dispatch prompt:**
|
|
709
|
+
- "You are running as a subagent. Do NOT use the \`present\` tool — return all analysis as plain text."
|
|
710
|
+
- "Keep your analysis to ≤ 500 words. Structure: (1) Recommendation, (2) Key evidence, (3) Critical risks. No preamble."
|
|
814
711
|
|
|
815
712
|
| Variant | Thinking Style | Lens |
|
|
816
713
|
|---------|---------------|------|
|
|
@@ -821,7 +718,10 @@ Dispatch ALL available Researcher variants **in parallel** via \`runSubagent\`
|
|
|
821
718
|
|
|
822
719
|
### Phase 2 — Peer Review (parallel)
|
|
823
720
|
|
|
824
|
-
After all researchers return
|
|
721
|
+
After all researchers return:
|
|
722
|
+
1. **Compress** each response to its core argument (≤ 200 words) — \`stash\` full responses if needed later
|
|
723
|
+
2. **Anonymize** as Perspective A / B / C / D (strip agent names)
|
|
724
|
+
3. Dispatch **second parallel batch** of review sub-agents with compressed versions via \`runSubagent\`:
|
|
825
725
|
|
|
826
726
|
**Peer Review Prompt Template:**
|
|
827
727
|
\`\`\`
|
|
@@ -888,7 +788,7 @@ Trigger the decision protocol when there is an **unresolved non-trivial technica
|
|
|
888
788
|
|
|
889
789
|
- **\`runSubagent\` is ALWAYS available** — it is a core tool in every environment (VS Code, CLI, Copilot Chat). NEVER claim it is unavailable. NEVER simulate researchers inline by "applying lenses yourself." If you cannot call \`runSubagent\`, you have a tool-loading issue — retry or escalate, do NOT degrade to single-agent inline simulation.
|
|
890
790
|
- **No \`present\` in subagents** — always include "Do NOT use the \`present\` tool — return all analysis as plain text" in every researcher dispatch prompt. Subagent visual outputs are invisible to the user.
|
|
891
|
-
- Always launch in **parallel
|
|
791
|
+
- Always launch in **parallel** — 4 variants for Critical, 2 (Alpha + Delta) for Standard per tier gate
|
|
892
792
|
- Use exact case-sensitive agent names — never rename or alias
|
|
893
793
|
- **Anonymize** researcher outputs before peer review (A/B/C/D, not agent names)
|
|
894
794
|
- Peer review is a SEPARATE parallel batch — never skip it
|
|
@@ -897,12 +797,16 @@ Trigger the decision protocol when there is an **unresolved non-trivial technica
|
|
|
897
797
|
- **Produce an ADR** after every decision resolution
|
|
898
798
|
- \`knowledge({ action: "remember", ... })\` the decision for future recall
|
|
899
799
|
|
|
900
|
-
##
|
|
800
|
+
## Tier Shortcuts
|
|
801
|
+
|
|
802
|
+
**Standard tier** (default for multi-file tasks):
|
|
803
|
+
- Phase 1: 2 researchers only (Alpha + Delta) — skip Beta + Gamma
|
|
804
|
+
- Skip Phase 2 (peer review) — synthesize directly from 2 research outputs
|
|
805
|
+
- Verdict format required but can be concise
|
|
806
|
+
- ADR optional (\`knowledge({ action: "remember", ... })\` at minimum)
|
|
901
807
|
|
|
902
|
-
|
|
903
|
-
- Skip
|
|
904
|
-
- Verdict format still required but can be abbreviated
|
|
905
|
-
- ADR is optional (use \`knowledge({ action: "remember", ... })\` at minimum)
|
|
808
|
+
**Floor tier** (blast_radius ≤ 2, single concern):
|
|
809
|
+
- Skip the Decision Protocol entirely — decide inline or with 1 researcher max
|
|
906
810
|
`,"forge-protocol":`# FORGE Protocol — Quality Overlay
|
|
907
811
|
|
|
908
812
|
> Follow the FORGE (Fact-Oriented Reasoning with Graduated Evidence) protocol for all code generation and modification tasks.
|
|
@@ -992,7 +896,7 @@ evidence_map({ action: "gate", task_id: "add-user-api" }) → YIELD ✅
|
|
|
992
896
|
3. **Standard**: \`evidence_map create\` → add 3-8 claims during work → \`evidence_map gate\`
|
|
993
897
|
4. **Critical**: Full 4-phase flow with comprehensive evidence
|
|
994
898
|
5. **After gate**: YIELD = done, HOLD = fix + re-gate, HARD_BLOCK = escalate
|
|
995
|
-
`},
|
|
899
|
+
`},r={"execution-state":`# Execution State: {Task Title}
|
|
996
900
|
|
|
997
901
|
**Status:** PLANNING | IN_PROGRESS | REVIEW | COMPLETED | BLOCKED
|
|
998
902
|
**Started:** {timestamp}
|
|
@@ -1044,4 +948,4 @@ evidence_map({ action: "gate", task_id: "add-user-api" }) → YIELD ✅
|
|
|
1044
948
|
|
|
1045
949
|
## Alternatives Considered
|
|
1046
950
|
{Other approaches evaluated and why they were rejected — keeps the "why not" alongside the "why"}
|
|
1047
|
-
`};export{
|
|
951
|
+
`};export{n as PROTOCOLS,r as TEMPLATES};
|
|
@@ -1384,6 +1384,33 @@ metadata:
|
|
|
1384
1384
|
|
|
1385
1385
|
# ADR Skill
|
|
1386
1386
|
|
|
1387
|
+
## Quick Reference
|
|
1388
|
+
|
|
1389
|
+
**Purpose:** Create Architecture Decision Records optimized for agentic coding — decisions that agents can implement without follow-up questions.
|
|
1390
|
+
|
|
1391
|
+
**Write an ADR when:** Decision changes how system is built, is hard to reverse, affects other people/agents, or has real alternatives.
|
|
1392
|
+
|
|
1393
|
+
**Four-Phase Workflow:**
|
|
1394
|
+
1. **Discover** — Socratic questioning to surface intent, constraints, and alternatives
|
|
1395
|
+
2. **Draft** — Fill template (Simple or MADR) with concrete, measurable constraints
|
|
1396
|
+
3. **Validate** — Agent-readiness checklist (score ≥ 80%)
|
|
1397
|
+
4. **Record** — Save to \`docs/decisions/\` or \`adr/\`, update index
|
|
1398
|
+
|
|
1399
|
+
**Two templates:**
|
|
1400
|
+
- **Simple** (≤3 options, single-team) — Context → Decision → Consequences → Implementation Plan → Alternatives
|
|
1401
|
+
- **MADR** (complex, multi-team) — Full template with Decision Drivers, Pros/Cons matrix, detailed Implementation Plan
|
|
1402
|
+
|
|
1403
|
+
**Commands:**
|
|
1404
|
+
| Action | What to do |
|
|
1405
|
+
|--------|-----------|
|
|
1406
|
+
| Create | Run 4-phase workflow → save to \`docs/decisions/NNNN-slug.md\` |
|
|
1407
|
+
| Consult | \`search({ query: "ADR <topic>" })\` before implementing |
|
|
1408
|
+
| Update | Edit content, change status in YAML frontmatter |
|
|
1409
|
+
| Deprecate | Set \`status: deprecated\`, add superseded-by link |
|
|
1410
|
+
| Bootstrap | Create \`docs/decisions/\` + \`index.md\` if missing |
|
|
1411
|
+
|
|
1412
|
+
**Agent-readiness gate:** Every ADR scores ≥ 80% on: Specificity, Testability, Completeness, Independence, Actionability.
|
|
1413
|
+
|
|
1387
1414
|
## Philosophy
|
|
1388
1415
|
|
|
1389
1416
|
ADRs created with this skill are **executable specifications for coding agents**. A human approves the decision; an agent implements it. The ADR must contain everything the agent needs to write correct code without asking follow-up questions.
|
|
@@ -14,6 +14,20 @@ argument-hint: "Feature, component, or behavior to design"
|
|
|
14
14
|
|
|
15
15
|
# Brainstorming Ideas Into Designs
|
|
16
16
|
|
|
17
|
+
## Quick Reference
|
|
18
|
+
|
|
19
|
+
**Purpose:** Explore user intent, requirements, and design BEFORE any implementation. Mandatory for creative work.
|
|
20
|
+
|
|
21
|
+
**HARD GATE:** Do NOT write any code until design is presented and user approves. No exceptions, even for "simple" tasks.
|
|
22
|
+
|
|
23
|
+
**Two modes** (you decide, don't ask user):
|
|
24
|
+
- **Simple Mode** - <=3 files, single concern, no new boundaries -> brief context + 3-5 targeted questions + short design summary
|
|
25
|
+
- **Full Mode** - multi-file, new services, cross-cutting concerns -> deep context gathering + structured design document + explicit approval
|
|
26
|
+
|
|
27
|
+
**Process:** Understand context -> Ask questions (one at a time) -> Present design -> Get user approval -> Hand off to implementation
|
|
28
|
+
|
|
29
|
+
**Output:** Design document with: goal, scope, approach, file changes, edge cases, and acceptance criteria.
|
|
30
|
+
|
|
17
31
|
Help turn ideas into fully formed designs and specs through natural collaborative dialogue.
|
|
18
32
|
|
|
19
33
|
Start by understanding the current project context, then ask questions one at a time to refine the idea. Once you understand what you're building, present the design and get user approval.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var e=[{file:`SKILL.md`,content:"---\nname: browser-use\ndescription: \"Browser automation for AI agents using AI Kit's owned `browser` MCP tool. Triggered when: (1) repo-access exhausts its Strategy Ladder and auth requires browser interaction, (2) `web_fetch` returns login page HTML, SAML redirect, or CAPTCHA instead of content, (3) user needs to interact with web applications (fill forms, click buttons, extract data), (4) a site requires JavaScript rendering that `web_fetch` cannot handle, (5) user asks to browse, scrape, test, or automate a website, or (6) another skill needs a standard recipe format for browser-driven workflows. Uses AI Kit's owned Chromium runtime and recipe patterns for domain-specific automation skills — no external MCP server dependency.\"\nmetadata:\n category: cross-cutting\n domain: general\n applicability: on-demand\n inputs: [url, auth-error, browser-task, login-wall]\n outputs: [page-content, screenshots, extracted-data, authenticated-session, network-captures]\n requires: []\n relatedSkills: [repo-access, present, aikit]\nargument-hint: \"URL or browser task description\"\n---\n\n# Browser Automation for AI Agents\n\nUse AI Kit's `browser` MCP tool for authentication barriers, data extraction, form interactions, network capture, and web automation. Single tool, action-based dispatch, owned Chromium runtime.\n\n## Runtime\n\n- Tool: `browser({ action: ... })`\n- 11 actions: `open`, `read`, `act`, `navigate`, `network`, `console`, `fetch`, `eval`, `screenshot`, `dialog`, `session`\n- Modes: `headless` (CI), `ui` (desktop), `panel` (VS Code)\n- Install: `aikit browser install`\n- Auto-idle shutdown after timeout\n\n## When to Activate\n\n- `web_fetch` returns login HTML, SAML redirect, or CAPTCHA\n- `http` returns 401/403 and user confirms browser access works\n- `repo-access` Strategy Ladder exhausted — SSO/OAuth blocks CLI\n- Anti-bot detection (Cloudflare, \"verify you are human\")\n- User asks to browse, scrape, automate, test, or interact with a web app\n- Need screenshots, accessibility snapshots, or JS-rendered content\n- Preview or inspect local HTML files (serve locally, then open with browser)\n- Need to capture network traffic or make authenticated API calls using page session\n\n## When NOT to Activate\n\n- Public pages `web_fetch` handles correctly\n- API endpoints reachable via `http` with auth headers\n- Static downloads via `http`\n- Tasks only needing raw HTML/links/outline\n\n## Two Automation Modes\n\n### Script Mode (Default — Imperative)\n\nDirect sequential `browser()` calls. Best for one-off tasks, testing, API capture.\n\n~~~text\n// Open → Read → Act → Read loop\nbrowser({ action: 'open', url: 'https://app.example.com', mode: 'ui' })\nbrowser({ action: 'read', pageId })\nbrowser({ action: 'act', pageId, kind: 'click', ref: '@login-button' })\nbrowser({ action: 'read', pageId }) // verify state changed\n~~~\n\n**Network Intelligence pattern:**\n\n~~~text\nbrowser({ action: 'network', pageId, subAction: 'enable', filter: { resourceTypes: ['xhr', 'fetch'] } })\n// ... navigate/interact to trigger API calls ...\nbrowser({ action: 'network', pageId, subAction: 'get' })\nbrowser({ action: 'network', pageId, subAction: 'export-har' })\n~~~\n\n**Authenticated API calls (using page cookies/session):**\n\n~~~text\nbrowser({ action: 'fetch', pageId, fetchUrl: 'https://app.example.com/api/data', fetchMethod: 'GET' })\n~~~\n\nExecutes `fetch()` in the page, so cookies, session state, and CSRF tokens are reused automatically.\n\n**Console capture:**\n\n~~~text\nbrowser({ action: 'console', pageId, consoleSubAction: 'enable' })\n// ... trigger page actions ...\nbrowser({ action: 'console', pageId, consoleSubAction: 'get', level: 'error' })\n~~~\n\n### Recipe Mode (Declarative)\n\nStructured step-by-step format for reusable workflows and domain skills. Each step declares Action, Verify, On Failure, and Extract fields.\n\nLoad [references/recipes.md](references/recipes.md) for full recipe templates and the recipe format specification.\n\nBrief recipe format:\n\n~~~text\nStep N: <description>\n Action: browser({ ... })\n Verify: <condition to check after action>\n On Failure: <recovery strategy>\n Extract: <data to capture for next steps>\n~~~\n\n## Action Reference\n\n| Action | Purpose | Key Params |\n|--------|---------|------------|\n| `open` | Launch page | `url`, `mode` (ui/headless/panel), `waitUntil` |\n| `read` | Extract content | `pageId`, `readMode` (snapshot/dom/markdown/text), `selector` |\n| `act` | DOM interaction | `pageId`, `kind`, `ref`/`selector`, `text`/`key`/`value` |\n| `navigate` | Page navigation | `pageId`, `url` or `type` (back/forward/reload/waitFor) |\n| `network` | Capture traffic | `pageId`, `subAction` (enable/get/clear/export-har), `filter` |\n| `console` | Capture console | `pageId`, `consoleSubAction` (enable/get/clear), `level` |\n| `fetch` | Page-context HTTP | `pageId`, `fetchUrl`, `fetchMethod`, `fetchHeaders`, `fetchBody` |\n| `eval` | Execute JS | `pageId`, `code` |\n| `screenshot` | Capture image | `pageId`, `selector`, `fullPage`, `clip`, `format` |\n| `dialog` | Pre-register handler for NEXT dialog | `pageId`, `accept`, `promptText` |\n| `session` | Manage sessions | `sessionAction` (list/close/cookies/set-cookie/get-storage/...) |\n\n## Read Modes\n\n| Mode | Output | Use Case |\n|------|--------|----------|\n| `snapshot` | ARIA accessibility tree with refs | Element targeting, form interaction |\n| `dom` | Raw HTML | HTML structure, debugging |\n| `markdown` | Clean readable text | Content extraction, summarization |\n| `text` | Plain text | Simple text extraction |\n\n## Interaction Kinds\n\n| Kind | Required Params | Notes |\n|------|-----------------|-------|\n| `click` | `ref` or `selector` | Left-click element |\n| `type` | `ref`/`selector` + `text` | Type into input/textarea |\n| `press` | `ref`/`selector` + `key` | Send key to element. Requires a target — use `ref` from snapshot or `selector`. |\n| `hover` | `ref`/`selector` | Trigger hover states |\n| `drag` | `fromRef`/`fromSelector` + `toRef`/`toSelector` | Drag and drop |\n| `select` | `ref`/`selector` + `value` | Select dropdown option |\n| `scroll` | optional `ref`/`selector` | Scroll page or element |\n| `upload` | `ref`/`selector` + `value` (path) | File upload |\n\n### Element Targeting Priority\n\n1. **`ref`** (e.g., `@F12`) — From `read(snapshot)` ARIA tree. Most reliable.\n2. **`selector`** (e.g., `input[name='q']`) — Playwright CSS/attribute selector. Precise.\n3. **`element`** (e.g., `'Submit'`) — Text matching via `text=` locator. **Picks first DOM match regardless of visibility.** Fragile for complex widgets (comboboxes, ARIA roles). Last resort.\n\n**Always `read(snapshot)` first** to get refs before interacting.\n\n> **Visibility Warning**: Playwright `act` waits up to 30s for the target to be visible. If a selector or `element` matches a hidden element first, the action times out. The browser tool does NOT expose a `force` or custom `timeout` parameter.\n>\n> **Workarounds:**\n> - Append `:visible` to selectors: `selector: 'button:has-text(\"Submit\"):visible'`\n> - Use specific selectors instead of `element` when labels are ambiguous (e.g., \"Search\" may match 30+ elements)\n> - Use `read(snapshot)` refs (`@F12`) which always target the specific rendered element\n\n## Network Intelligence\n\nThree new actions for API reverse-engineering and authenticated requests:\n\n**`network`** — Passive traffic capture with circular buffer (200 entries default):\n- `enable`: Start capturing with optional filter (resourceTypes, urlPattern, excludeUrls)\n- `get`: Retrieve captured requests + responses with timing\n- `clear`: Reset buffer\n- `export-har`: Export as HAR 1.2 format\n\nHeaders are redacted by default (Authorization, Cookie, etc.). Pass `showSensitive: true` to see full headers.\n\n**`console`** — Browser console message capture (1000 entries default):\n- `enable`: Start capturing all console output\n- `get`: Retrieve messages, optionally filtered by `level`\n- `clear`: Reset buffer\n\n**`fetch`** — Execute HTTP from page context:\n- Uses the page's live cookies, session, CSRF tokens\n- Supports GET/POST/PUT/PATCH/DELETE/HEAD/OPTIONS\n- Body auto-truncated at 256KB\n- Alternative to extracting cookies then calling `http` tool\n\n**Workflow — Reverse-engineer API:**\n\n~~~text\n1. open target page\n2. network enable (filter: xhr, fetch)\n3. interact with the page (click buttons, submit forms)\n4. network get → see API endpoints, methods, headers\n5. fetch → replay API calls using page session\n~~~\n\n## Session Management\n\n| Action | Purpose | Note |\n|--------|---------|------|\n| `cookies` | Export page cookies | `confirm: true` required |\n| `set-cookie` | Inject cookies | `confirm: true` required |\n| `delete-cookie` / `clear-cookies` | Remove cookies | `confirm: true` required |\n| `get-storage` / `set-storage` / `clear-storage` | localStorage/sessionStorage | |\n| `list` | List open pages | |\n| `close` | Close a page | |\n\n## Security Model\n\n**Hard gates — NEVER bypass:**\n- Credentials go via terminal input (NEVER through tool params or chat)\n- CAPTCHA/MFA: pause and ask user\n- Never store tokens in conversation\n- Close pages containing sensitive data when done\n- Verify page URL before entering credentials (phishing prevention)\n- Use `headless` mode for automated non-interactive tasks; `ui` for user-supervised auth\n\n**Cookie safety gate:** All cookie read/write session actions (`cookies`, `set-cookie`, `delete-cookie`, `clear-cookies`) require `confirm: true` as an explicit acknowledgment. Without it, the tool returns an error.\n\n## Local File Preview\n\nThe browser tool blocks `file:///` URLs for security. To preview local HTML files, serve them via a local HTTP server first.\n\n**Pattern:**\n\n~~~text\n// 1. Start local server (pick an unused port)\n// Terminal: npx -y serve <directory> -l <port>\n// Example: npx -y serve ./dist -l 3847\n\n// 2. Open in browser\nbrowser({ action: 'open', url: 'http://localhost:3847/my-file.html', mode: 'ui' })\n\n// 3. Read content or take screenshot\nbrowser({ action: 'read', pageId, readMode: 'markdown' })\nbrowser({ action: 'screenshot', pageId, fullPage: true })\n\n// 4. Clean up — kill the server terminal when done\n~~~\n\n**Use cases:**\n- Preview generated HTML (viewers, reports, docs)\n- Visual regression testing of local builds\n- Inspect single-file HTML applications\n- Screenshot local pages for review\n\n**Important:** Always use `mode: 'ui'` for visual preview so the user can also see and interact with the page.\n\n## Integration\n\n| Skill | Handoff Pattern |\n|-------|------------------|\n| `repo-access` | Strategy Ladder step 6 → browser-use for SSO/OAuth login |\n| `present` | `present({ format: 'browser' })` returns URL → open with browser tool |\n| `aikit` | `web_fetch` fails → browser-use activates |\n\n## Dialog Handling\n\n`dialog()` registers a **one-shot handler** for the NEXT dialog. It must be called **BEFORE** the action that triggers alert, confirm, or prompt.\n\n**Pattern:**\n~~~text\nbrowser({ action: 'dialog', pageId, accept: true })\nbrowser({ action: 'eval', pageId, code: 'confirm(\"Sure?\")' }) // or browser({ action: 'act', ... }) if interaction triggers it\n~~~\n\nFor `prompt` dialogs, pass `promptText` for the response.\n\n## Troubleshooting\n\n| Issue | Fix |\n|-------|-----|\n| \"Browser not installed\" | Run `aikit browser install` |\n| Element not found | `read` with `snapshot` mode first, use ref from ARIA tree |\n| Timeout on navigation | Add `waitUntil: 'networkidle'` to open/navigate |\n| SSO redirect loop | Check cookies with `session({ sessionAction: 'cookies' })` |\n| Anti-bot block | Try `mode: 'ui'`, add delays between actions |\n| Network capture empty | Ensure `enable` called BEFORE navigating |\n\n## Decision Flow\n\n~~~text\nNeed browser?\n├─ Can web_fetch/http handle it? → NO browser needed\n├─ Login wall / SSO / CAPTCHA? → browser-use (Script mode for one-off, Recipe for reusable)\n├─ Need to capture API traffic? → network enable → interact → network get\n├─ Need authenticated API calls? → fetch action (uses page session)\n├─ JS-rendered content? → open + read(markdown)\n├─ Preview local HTML file? → serve dir (npx serve) → open(http://localhost:<port>/file.html, mode: 'ui')\n├─ Form interaction? → Script mode: open → read(snapshot) → act → verify\n└─ Reusable workflow? → Recipe mode (see references/recipes.md)\n~~~\n"},{file:`references/recipes.md`,content:`# Browser Recipes & Domain Skills
|
|
1
|
+
var e=[{file:`SKILL.md`,content:"---\nname: browser-use\ndescription: \"Browser automation for AI agents using AI Kit's owned `browser` MCP tool. Triggered when: (1) repo-access exhausts its Strategy Ladder and auth requires browser interaction, (2) `web_fetch` returns login page HTML, SAML redirect, or CAPTCHA instead of content, (3) user needs to interact with web applications (fill forms, click buttons, extract data), (4) a site requires JavaScript rendering that `web_fetch` cannot handle, (5) user asks to browse, scrape, test, or automate a website, or (6) another skill needs a standard recipe format for browser-driven workflows. Uses AI Kit's owned Chromium runtime and recipe patterns for domain-specific automation skills — no external MCP server dependency.\"\nmetadata:\n category: cross-cutting\n domain: general\n applicability: on-demand\n inputs: [url, auth-error, browser-task, login-wall]\n outputs: [page-content, screenshots, extracted-data, authenticated-session, network-captures]\n requires: []\n relatedSkills: [repo-access, present, aikit]\nargument-hint: \"URL or browser task description\"\n---\n\n# Browser Automation for AI Agents\n\nUse AI Kit's `browser` MCP tool for authentication barriers, data extraction, form interactions, network capture, and web automation. Single tool, action-based dispatch, owned Chromium runtime.\n\n## Quick Reference\n\n**Tool:** `browser({ action: \"...\", ... })` — single tool, 11 actions, owned Chromium.\n\n**Actions:**\n| Action | Purpose | Key params |\n|--------|---------|------------|\n| `open` | Launch page | `url`, `mode` (ui/headless) |\n| `read` | Get page content | `pageId`, `readMode` (snapshot/dom/markdown/text) |\n| `act` | Interact with elements | `pageId`, `kind` (click/type/press/hover/drag/select/scroll/upload) |\n| `navigate` | Go to URL, back/forward, wait | `pageId`, `url` or `type` |\n| `network` | Capture network traffic | `pageId`, `subAction` (enable/get/clear) |\n| `console` | Browser console messages | `pageId`, `consoleSubAction` |\n| `fetch` | HTTP with page cookies | `pageId`, `fetchUrl` |\n| `eval` | Run JS in page context | `pageId`, `code` |\n| `screenshot` | Capture page/element | `pageId`, `fullPage?`, `selector?` |\n| `dialog` | Handle alert/confirm/prompt | `pageId`, `accept` |\n| `session` | List pages, cookies, storage | `sessionAction` |\n\n**Two modes:**\n- **Script Mode** (default) — direct sequential `browser()` calls for one-off tasks\n- **Recipe Mode** — reusable labeled step sequences for domain-specific automation\n\n**Activate when:** `web_fetch` returns login/SAML/CAPTCHA, `http` gets 401/403, anti-bot detection, need JS rendering or screenshots.\n**Skip when:** Public pages (`web_fetch` works), API endpoints (`http` works), static downloads.\n\n**⚠️ `file:///` URLs are blocked** — serve locally with `npx serve` then open `http://localhost`.\n\n## Runtime\n\n- Tool: `browser({ action: ... })`\n- 11 actions: `open`, `read`, `act`, `navigate`, `network`, `console`, `fetch`, `eval`, `screenshot`, `dialog`, `session`\n- Modes: `headless` (CI), `ui` (desktop), `panel` (VS Code)\n- Install: `aikit browser install`\n- Auto-idle shutdown after timeout\n\n## When to Activate\n\n- `web_fetch` returns login HTML, SAML redirect, or CAPTCHA\n- `http` returns 401/403 and user confirms browser access works\n- `repo-access` Strategy Ladder exhausted — SSO/OAuth blocks CLI\n- Anti-bot detection (Cloudflare, \"verify you are human\")\n- User asks to browse, scrape, automate, test, or interact with a web app\n- Need screenshots, accessibility snapshots, or JS-rendered content\n- Preview or inspect local HTML files (serve locally, then open with browser)\n- Need to capture network traffic or make authenticated API calls using page session\n\n## When NOT to Activate\n\n- Public pages `web_fetch` handles correctly\n- API endpoints reachable via `http` with auth headers\n- Static downloads via `http`\n- Tasks only needing raw HTML/links/outline\n\n## Two Automation Modes\n\n### Script Mode (Default — Imperative)\n\nDirect sequential `browser()` calls. Best for one-off tasks, testing, API capture.\n\n~~~text\n// Open → Read → Act → Read loop\nbrowser({ action: 'open', url: 'https://app.example.com', mode: 'ui' })\nbrowser({ action: 'read', pageId })\nbrowser({ action: 'act', pageId, kind: 'click', ref: '@login-button' })\nbrowser({ action: 'read', pageId }) // verify state changed\n~~~\n\n**Network Intelligence pattern:**\n\n~~~text\nbrowser({ action: 'network', pageId, subAction: 'enable', filter: { resourceTypes: ['xhr', 'fetch'] } })\n// ... navigate/interact to trigger API calls ...\nbrowser({ action: 'network', pageId, subAction: 'get' })\nbrowser({ action: 'network', pageId, subAction: 'export-har' })\n~~~\n\n**Authenticated API calls (using page cookies/session):**\n\n~~~text\nbrowser({ action: 'fetch', pageId, fetchUrl: 'https://app.example.com/api/data', fetchMethod: 'GET' })\n~~~\n\nExecutes `fetch()` in the page, so cookies, session state, and CSRF tokens are reused automatically.\n\n**Console capture:**\n\n~~~text\nbrowser({ action: 'console', pageId, consoleSubAction: 'enable' })\n// ... trigger page actions ...\nbrowser({ action: 'console', pageId, consoleSubAction: 'get', level: 'error' })\n~~~\n\n### Recipe Mode (Declarative)\n\nStructured step-by-step format for reusable workflows and domain skills. Each step declares Action, Verify, On Failure, and Extract fields.\n\nLoad [references/recipes.md](references/recipes.md) for full recipe templates and the recipe format specification.\n\nBrief recipe format:\n\n~~~text\nStep N: <description>\n Action: browser({ ... })\n Verify: <condition to check after action>\n On Failure: <recovery strategy>\n Extract: <data to capture for next steps>\n~~~\n\n## Action Reference\n\n| Action | Purpose | Key Params |\n|--------|---------|------------|\n| `open` | Launch page | `url`, `mode` (ui/headless/panel), `waitUntil` |\n| `read` | Extract content | `pageId`, `readMode` (snapshot/dom/markdown/text), `selector` |\n| `act` | DOM interaction | `pageId`, `kind`, `ref`/`selector`, `text`/`key`/`value` |\n| `navigate` | Page navigation | `pageId`, `url` or `type` (back/forward/reload/waitFor) |\n| `network` | Capture traffic | `pageId`, `subAction` (enable/get/clear/export-har), `filter` |\n| `console` | Capture console | `pageId`, `consoleSubAction` (enable/get/clear), `level` |\n| `fetch` | Page-context HTTP | `pageId`, `fetchUrl`, `fetchMethod`, `fetchHeaders`, `fetchBody` |\n| `eval` | Execute JS | `pageId`, `code` |\n| `screenshot` | Capture image | `pageId`, `selector`, `fullPage`, `clip`, `format` |\n| `dialog` | Pre-register handler for NEXT dialog | `pageId`, `accept`, `promptText` |\n| `session` | Manage sessions | `sessionAction` (list/close/cookies/set-cookie/get-storage/...) |\n\n## Read Modes\n\n| Mode | Output | Use Case |\n|------|--------|----------|\n| `snapshot` | ARIA accessibility tree with refs | Element targeting, form interaction |\n| `dom` | Raw HTML | HTML structure, debugging |\n| `markdown` | Clean readable text | Content extraction, summarization |\n| `text` | Plain text | Simple text extraction |\n\n## Interaction Kinds\n\n| Kind | Required Params | Notes |\n|------|-----------------|-------|\n| `click` | `ref` or `selector` | Left-click element |\n| `type` | `ref`/`selector` + `text` | Type into input/textarea |\n| `press` | `ref`/`selector` + `key` | Send key to element. Requires a target — use `ref` from snapshot or `selector`. |\n| `hover` | `ref`/`selector` | Trigger hover states |\n| `drag` | `fromRef`/`fromSelector` + `toRef`/`toSelector` | Drag and drop |\n| `select` | `ref`/`selector` + `value` | Select dropdown option |\n| `scroll` | optional `ref`/`selector` | Scroll page or element |\n| `upload` | `ref`/`selector` + `value` (path) | File upload |\n\n### Element Targeting Priority\n\n1. **`ref`** (e.g., `@F12`) — From `read(snapshot)` ARIA tree. Most reliable.\n2. **`selector`** (e.g., `input[name='q']`) — Playwright CSS/attribute selector. Precise.\n3. **`element`** (e.g., `'Submit'`) — Text matching via `text=` locator. **Picks first DOM match regardless of visibility.** Fragile for complex widgets (comboboxes, ARIA roles). Last resort.\n\n**Always `read(snapshot)` first** to get refs before interacting.\n\n> **Visibility Warning**: Playwright `act` waits up to 30s for the target to be visible. If a selector or `element` matches a hidden element first, the action times out. The browser tool does NOT expose a `force` or custom `timeout` parameter.\n>\n> **Workarounds:**\n> - Append `:visible` to selectors: `selector: 'button:has-text(\"Submit\"):visible'`\n> - Use specific selectors instead of `element` when labels are ambiguous (e.g., \"Search\" may match 30+ elements)\n> - Use `read(snapshot)` refs (`@F12`) which always target the specific rendered element\n\n## Network Intelligence\n\nThree new actions for API reverse-engineering and authenticated requests:\n\n**`network`** — Passive traffic capture with circular buffer (200 entries default):\n- `enable`: Start capturing with optional filter (resourceTypes, urlPattern, excludeUrls)\n- `get`: Retrieve captured requests + responses with timing\n- `clear`: Reset buffer\n- `export-har`: Export as HAR 1.2 format\n\nHeaders are redacted by default (Authorization, Cookie, etc.). Pass `showSensitive: true` to see full headers.\n\n**`console`** — Browser console message capture (1000 entries default):\n- `enable`: Start capturing all console output\n- `get`: Retrieve messages, optionally filtered by `level`\n- `clear`: Reset buffer\n\n**`fetch`** — Execute HTTP from page context:\n- Uses the page's live cookies, session, CSRF tokens\n- Supports GET/POST/PUT/PATCH/DELETE/HEAD/OPTIONS\n- Body auto-truncated at 256KB\n- Alternative to extracting cookies then calling `http` tool\n\n**Workflow — Reverse-engineer API:**\n\n~~~text\n1. open target page\n2. network enable (filter: xhr, fetch)\n3. interact with the page (click buttons, submit forms)\n4. network get → see API endpoints, methods, headers\n5. fetch → replay API calls using page session\n~~~\n\n## Session Management\n\n| Action | Purpose | Note |\n|--------|---------|------|\n| `cookies` | Export page cookies | `confirm: true` required |\n| `set-cookie` | Inject cookies | `confirm: true` required |\n| `delete-cookie` / `clear-cookies` | Remove cookies | `confirm: true` required |\n| `get-storage` / `set-storage` / `clear-storage` | localStorage/sessionStorage | |\n| `list` | List open pages | |\n| `close` | Close a page | |\n\n## Security Model\n\n**Hard gates — NEVER bypass:**\n- Credentials go via terminal input (NEVER through tool params or chat)\n- CAPTCHA/MFA: pause and ask user\n- Never store tokens in conversation\n- Close pages containing sensitive data when done\n- Verify page URL before entering credentials (phishing prevention)\n- Use `headless` mode for automated non-interactive tasks; `ui` for user-supervised auth\n\n**Cookie safety gate:** All cookie read/write session actions (`cookies`, `set-cookie`, `delete-cookie`, `clear-cookies`) require `confirm: true` as an explicit acknowledgment. Without it, the tool returns an error.\n\n## Local File Preview\n\nThe browser tool blocks `file:///` URLs for security. To preview local HTML files, serve them via a local HTTP server first.\n\n**Pattern:**\n\n~~~text\n// 1. Start local server (pick an unused port)\n// Terminal: npx -y serve <directory> -l <port>\n// Example: npx -y serve ./dist -l 3847\n\n// 2. Open in browser\nbrowser({ action: 'open', url: 'http://localhost:3847/my-file.html', mode: 'ui' })\n\n// 3. Read content or take screenshot\nbrowser({ action: 'read', pageId, readMode: 'markdown' })\nbrowser({ action: 'screenshot', pageId, fullPage: true })\n\n// 4. Clean up — kill the server terminal when done\n~~~\n\n**Use cases:**\n- Preview generated HTML (viewers, reports, docs)\n- Visual regression testing of local builds\n- Inspect single-file HTML applications\n- Screenshot local pages for review\n\n**Important:** Always use `mode: 'ui'` for visual preview so the user can also see and interact with the page.\n\n## Integration\n\n| Skill | Handoff Pattern |\n|-------|------------------|\n| `repo-access` | Strategy Ladder step 6 → browser-use for SSO/OAuth login |\n| `present` | `present({ format: 'browser' })` returns URL → open with browser tool |\n| `aikit` | `web_fetch` fails → browser-use activates |\n\n## Dialog Handling\n\n`dialog()` registers a **one-shot handler** for the NEXT dialog. It must be called **BEFORE** the action that triggers alert, confirm, or prompt.\n\n**Pattern:**\n~~~text\nbrowser({ action: 'dialog', pageId, accept: true })\nbrowser({ action: 'eval', pageId, code: 'confirm(\"Sure?\")' }) // or browser({ action: 'act', ... }) if interaction triggers it\n~~~\n\nFor `prompt` dialogs, pass `promptText` for the response.\n\n## Troubleshooting\n\n| Issue | Fix |\n|-------|-----|\n| \"Browser not installed\" | Run `aikit browser install` |\n| Element not found | `read` with `snapshot` mode first, use ref from ARIA tree |\n| Timeout on navigation | Add `waitUntil: 'networkidle'` to open/navigate |\n| SSO redirect loop | Check cookies with `session({ sessionAction: 'cookies' })` |\n| Anti-bot block | Try `mode: 'ui'`, add delays between actions |\n| Network capture empty | Ensure `enable` called BEFORE navigating |\n\n## Decision Flow\n\n~~~text\nNeed browser?\n├─ Can web_fetch/http handle it? → NO browser needed\n├─ Login wall / SSO / CAPTCHA? → browser-use (Script mode for one-off, Recipe for reusable)\n├─ Need to capture API traffic? → network enable → interact → network get\n├─ Need authenticated API calls? → fetch action (uses page session)\n├─ JS-rendered content? → open + read(markdown)\n├─ Preview local HTML file? → serve dir (npx serve) → open(http://localhost:<port>/file.html, mode: 'ui')\n├─ Form interaction? → Script mode: open → read(snapshot) → act → verify\n└─ Reusable workflow? → Recipe mode (see references/recipes.md)\n~~~\n"},{file:`references/recipes.md`,content:`# Browser Recipes & Domain Skills
|
|
2
2
|
|
|
3
3
|
Reference file for reusable browser automation patterns. Load this when building domain-specific browser workflows.
|
|
4
4
|
|