@vpxa/aikit 0.1.151 → 0.1.152

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vpxa/aikit",
3
- "version": "0.1.151",
3
+ "version": "0.1.152",
4
4
  "type": "module",
5
5
  "description": "Local-first AI developer toolkit — knowledge base, code analysis, context management, and developer tools for LLM agents",
6
6
  "license": "MIT",
@@ -8,4 +8,5 @@ function e(e){return e&&e[0].toLowerCase()+e.slice(1)}function t(e){return!e||e.
8
8
  `).trimEnd()}function o(e){return[[`Session Start`,e.sessionStart],[`Before Code Change`,e.beforeCodeChange],[`Before Commit`,e.beforeCommit],[`Session End`,e.sessionEnd]].map(([e,t])=>{let n=(t?.actions||[]).map(e=>`- \`${e}\``);return[`### ${e}`,``,...n,``].join(`
9
9
  `)}).join(`
10
10
  `).trimEnd()}function s(e,t){let n=[];for(let[t,r]of Object.entries(e))if(r.variants)for(let[e,i]of Object.entries(r.variants)){let a=`${t}-${e}`;n.push(`| **${a}** | ${i.description} | ${r.category||`—`} |`)}else n.push(`| **${t}** | ${r.description} | ${r.category||`—`} |`);return`| Agent | Purpose | Category |\n|-------|---------|----------|\n${n.join(`
11
- `)}`}function c({serverName:e,mcpEntry:t,configKey:n,extraServerFields:r}){let i={...t};return r&&Object.assign(i,r),JSON.stringify({[n]:{[e]:i}},null,2)}export{n as buildAgentPrompt,s as buildAgentTable,o as buildHooksSection,r as buildInlineAgentSection,c as buildMcpConfigJson,i as buildPromptFile,a as buildPromptSections,t as buildSkillsSection,e as lowerFirst};
11
+ `)}`}function c(e){let t=[];for(let[n,r]of Object.entries(e)){if(n===`Orchestrator`)continue;let e=r.compactRole||r.description;if(r.variants){let i=Object.keys(r.variants);t.push(`| **${n}-${i.join(`/`)}** | ${e} |`)}else t.push(`| **${n}** | ${e} |`)}return`| Agent | Role |\n|-------|------|\n${t.join(`
12
+ `)}`}function l({serverName:e,mcpEntry:t,configKey:n,extraServerFields:r}){let i={...t};return r&&Object.assign(i,r),JSON.stringify({[n]:{[e]:i}},null,2)}export{n as buildAgentPrompt,s as buildAgentTable,c as buildCompactAgentTable,o as buildHooksSection,r as buildInlineAgentSection,l as buildMcpConfigJson,i as buildPromptFile,a as buildPromptSections,t as buildSkillsSection,e as lowerFirst};
@@ -1,10 +1,10 @@
1
- import{AGENTS as e}from"../definitions/agents.mjs";import{AGENT_BODIES as t}from"../definitions/bodies.mjs";import{HOOKS as n}from"../definitions/hooks.mjs";import{MCP_SERVER_ENTRY as r,SERVER_NAME as i}from"../definitions/mcp.mjs";import{CLAUDE_MODELS as a}from"../definitions/models.mjs";import{PROMPTS as o}from"../definitions/prompts.mjs";import{PROTOCOLS as s}from"../definitions/protocols.mjs";import{AIKIT_TOOLS as c,CLAUDE_CODE_TOOL_MAP as l,IDE_CAPABILITIES as u}from"../definitions/tools.mjs";import{buildAgentTable as d,buildHooksSection as f,buildInlineAgentSection as p,buildMcpConfigJson as m,buildPromptSections as h,buildSkillsSection as g,lowerFirst as _}from"./_shared.mjs";const v=[`## Flows`,``,"This project uses aikit's pluggable flow system. Check flow status with the `flow` MCP tool.","If a flow is active, follow the current step's skill instructions. Advance with `flow({ action: 'step', advance: 'next' })`.","Use `flow({ action: 'list' })` to see available flows and `flow({ action: 'start', name, topic })` to begin one."].join(`
2
- `),y=[`## Flows`,``,"This project uses aikit's pluggable flow system. Check flow status with the `flow` MCP tool.","If a flow is active, follow the current step's skill instructions. Advance with `flow({ action: 'step', advance: 'next' })`.","Use `flow({ action: 'list' })` to see available flows and `flow({ action: 'start', name, topic })` to begin one."].join(`
3
- `),b=[`## Flows`,``,"This project uses aikit's pluggable flow system. Use `flow({ action: 'status' })` to check if a flow is active.",`If dispatched as part of a flow, your work contributes to the current step. Do NOT advance or manage the flow — the Orchestrator handles flow lifecycle.`].join(`
4
- `);function x(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-+|-+$/g,``).toLowerCase()}function S(e){return`"${String(e).replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function C(e){let t=(u[e]||[]).flatMap(e=>l[e]||[]),n=c.map(e=>`mcp__aikit__${e}`);return[...new Set([...t,...n])].sort((e,t)=>e.localeCompare(t))}function w(e,t){let n=[];return n.push(`# aikit ${e}`),n.push(``),t.description&&(n.push(`> ${t.description}`),n.push(``)),n.push(t.content.trim()),n.push(``),n.join(`
5
- `)}function T(e,n){let r=t[e];return typeof r==`function`?r(n):r||``}function E(e){let t=[];e.extraBody&&t.push(e.extraBody),e.sharedBase&&s[e.sharedBase]&&t.push(s[e.sharedBase]);for(let n of e.sharedProtocols||[])s[n]&&t.push(s[n]);return t}function D(t){let n=[];for(let[r,i]of Object.entries(e)){let e=T(r,t),a=E(i);if(i.variants){for(let[t,o]of Object.entries(i.variants))n.push(p({name:`${r}-${t}`,title:i.title,description:o.description||i.description,body:e,skills:i.skills,additionalSections:[...a,o.bodyAddendum].filter(Boolean)}));continue}let o=[...a];r===`Orchestrator`&&o.push(v,y),n.push(p({name:r,title:i.title,description:i.description,body:e,skills:i.skills,additionalSections:o}))}return n.join(`
6
- `)}function O(e,t,n,r){let i=C(t.toolRole),a=E(t),o=g(t.skills),s=e===`Orchestrator`?[v,y]:[b],c=[n,...a,t.bodyAddendum,o,...s].filter(Boolean).join(`
1
+ import{AGENTS as e}from"../definitions/agents.mjs";import{AGENT_BODIES as t}from"../definitions/bodies.mjs";import{HOOKS as n}from"../definitions/hooks.mjs";import{MCP_SERVER_ENTRY as r,SERVER_NAME as i}from"../definitions/mcp.mjs";import{CLAUDE_MODELS as a}from"../definitions/models.mjs";import{PROMPTS as o}from"../definitions/prompts.mjs";import{PROTOCOLS as s}from"../definitions/protocols.mjs";import{AIKIT_TOOLS as c,CLAUDE_CODE_TOOL_MAP as l,IDE_CAPABILITIES as u}from"../definitions/tools.mjs";import{buildAgentTable as d,buildCompactAgentTable as f,buildHooksSection as p,buildInlineAgentSection as m,buildMcpConfigJson as h,buildPromptSections as g,buildSkillsSection as _,lowerFirst as v}from"./_shared.mjs";const y=[`## Flows`,``,"This project uses aikit's pluggable flow system. Check flow status with the `flow` MCP tool.","If a flow is active, follow the current step's skill instructions. Advance with `flow({ action: 'step', advance: 'next' })`.","Use `flow({ action: 'list' })` to see available flows and `flow({ action: 'start', name, topic })` to begin one."].join(`
2
+ `),b=[`## Flows`,``,"This project uses aikit's pluggable flow system. Check flow status with the `flow` MCP tool.","If a flow is active, follow the current step's skill instructions. Advance with `flow({ action: 'step', advance: 'next' })`.","Use `flow({ action: 'list' })` to see available flows and `flow({ action: 'start', name, topic })` to begin one."].join(`
3
+ `),x=[`## Flows`,``,"This project uses aikit's pluggable flow system. Use `flow({ action: 'status' })` to check if a flow is active.",`If dispatched as part of a flow, your work contributes to the current step. Do NOT advance or manage the flow — the Orchestrator handles flow lifecycle.`].join(`
4
+ `);function S(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-+|-+$/g,``).toLowerCase()}function C(e){return`"${String(e).replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function w(e){let t=(u[e]||[]).flatMap(e=>l[e]||[]),n=c.map(e=>`mcp__aikit__${e}`);return[...new Set([...t,...n])].sort((e,t)=>e.localeCompare(t))}function T(e,t){let n=[];return n.push(`# aikit ${e}`),n.push(``),t.description&&(n.push(`> ${t.description}`),n.push(``)),n.push(t.content.trim()),n.push(``),n.join(`
5
+ `)}function E(e,n){let r=t[e];return typeof r==`function`?r(n):r||``}function D(e){let t=[];e.extraBody&&t.push(e.extraBody),e.sharedBase&&s[e.sharedBase]&&t.push(s[e.sharedBase]);for(let n of e.sharedProtocols||[])s[n]&&t.push(s[n]);return t}function O(t){let n=[];for(let[r,i]of Object.entries(e)){let e=E(r,t),a=D(i);if(i.variants){for(let[t,o]of Object.entries(i.variants))n.push(m({name:`${r}-${t}`,title:i.title,description:o.description||i.description,body:e,skills:i.skills,additionalSections:[...a,o.bodyAddendum].filter(Boolean)}));continue}let o=[...a];r===`Orchestrator`&&o.push(y,b),n.push(m({name:r,title:i.title,description:i.description,body:e,skills:i.skills,additionalSections:o}))}return n.join(`
6
+ `)}function k(e,t,n,r){let i=w(t.toolRole),a=D(t),o=_(t.skills),s=e===`Orchestrator`?[y,b]:[x],c=[n,...a,t.bodyAddendum,o,...s].filter(Boolean).join(`
7
7
 
8
- `).trim(),l=t.identity?`You are the **${e}**${t.identity}`:`You are the **${e}**, ${_(t.description)}.`,u=[`---`,`name: ${x(e)}`,`description: ${S(t.description)}`,`allowedTools:`,...i.map(e=>` - ${e}`),`---`,``,`# ${e} - ${t.title||e}`,``,l];return c&&u.push(``,c),u.push(``),u.join(`
9
- `)}function k(t=d(e,a)){return[`# aikit — Claude Code Instructions`,``,"This project uses an MCP server (`aikit`) providing tools for search, analysis, memory, and validation.",``,`## MCP Server`,``,"Server name: `aikit`","Configured in `.mcp.json` (already done if scaffold was deployed).",``,`## Agents`,``,t,``,`## Agent Instructions`,``,D(t),`## Prompts`,``,h(o),``,`## Session Protocol`,``,f(n),``].join(`
10
- `)}function A(){let t=[],n=d(e,a);t.push({path:`.mcp.json`,content:`${m({serverName:i,mcpEntry:r,configKey:`mcpServers`})}\n`}),t.push({path:`CLAUDE.md`,content:k(n)});for(let[e,n]of Object.entries(o))t.push({path:`.claude/commands/aikit-${e}.md`,content:w(e,n)});for(let[r,i]of Object.entries(e)){let e=T(r,n);if(i.variants){for(let[a,o]of Object.entries(i.variants)){let s=`${r}-${a}`;t.push({path:`.claude/agents/${s}.md`,content:O(s,{...i,description:o.description||i.description,identity:o.identity,bodyAddendum:o.bodyAddendum},e,n)})}continue}t.push({path:`.claude/agents/${r}.md`,content:O(r,i,e,n)})}return t}export{v as CLAUDE_FLOWS_SECTION,y as CLAUDE_ORCHESTRATOR_FLOW_ROUTING_SECTION,A as generateClaudeCode};
8
+ `).trim(),l=t.identity?`You are the **${e}**${t.identity}`:`You are the **${e}**, ${v(t.description)}.`,u=[`---`,`name: ${S(e)}`,`description: ${C(t.description)}`,`allowedTools:`,...i.map(e=>` - ${e}`),`---`,``,`# ${e} - ${t.title||e}`,``,l];return c&&u.push(``,c),u.push(``),u.join(`
9
+ `)}function A(t=d(e,a),r=f(e)){return[`# aikit — Claude Code Instructions`,``,"This project uses an MCP server (`aikit`) providing tools for search, analysis, memory, and validation.",``,`## MCP Server`,``,"Server name: `aikit`","Configured in `.mcp.json` (already done if scaffold was deployed).",``,`## Agents`,``,t,``,`## Agent Instructions`,``,O(r),`## Prompts`,``,g(o),``,`## Session Protocol`,``,p(n),``].join(`
10
+ `)}function j(){let t=[],n=d(e,a),s=f(e);t.push({path:`.mcp.json`,content:`${h({serverName:i,mcpEntry:r,configKey:`mcpServers`})}\n`}),t.push({path:`CLAUDE.md`,content:A(n,s)});for(let[e,n]of Object.entries(o))t.push({path:`.claude/commands/aikit-${e}.md`,content:T(e,n)});for(let[r,i]of Object.entries(e)){let e=E(r,s);if(i.variants){for(let[a,o]of Object.entries(i.variants)){let s=`${r}-${a}`;t.push({path:`.claude/agents/${s}.md`,content:k(s,{...i,description:o.description||i.description,identity:o.identity,bodyAddendum:o.bodyAddendum},e,n)})}continue}t.push({path:`.claude/agents/${r}.md`,content:k(r,i,e,n)})}return t}export{y as CLAUDE_FLOWS_SECTION,b as CLAUDE_ORCHESTRATOR_FLOW_ROUTING_SECTION,j as generateClaudeCode};
@@ -1,3 +1,3 @@
1
- import{AGENTS as e}from"../definitions/agents.mjs";import{AGENT_BODIES as t}from"../definitions/bodies.mjs";import{HOOKS as n}from"../definitions/hooks.mjs";import{MCP_SERVER_ENTRY as r,SERVER_NAME as i}from"../definitions/mcp.mjs";import{PROMPTS as a}from"../definitions/prompts.mjs";import{PROTOCOLS as o}from"../definitions/protocols.mjs";import{buildAgentTable as s,buildHooksSection as c,buildInlineAgentSection as l,buildPromptSections as u}from"./_shared.mjs";function d(e,t){let n=t.args.map(e=>JSON.stringify(e)).join(`, `);return`[mcp_servers.${e}]\ncommand = ${JSON.stringify(t.command)}\nargs = [${n}]\n`}function f(e,n){let r=t[e];return typeof r==`function`?r(n):r||``}function p(e){let t=[];e.extraBody&&t.push(e.extraBody),e.sharedBase&&o[e.sharedBase]&&t.push(o[e.sharedBase]);for(let n of e.sharedProtocols||[])o[n]&&t.push(o[n]);return t}function m(t){let n=[];for(let[r,i]of Object.entries(e)){let e=f(r,t),a=p(i);if(i.variants){for(let[t,o]of Object.entries(i.variants))n.push(l({name:`${r}-${t}`,title:i.title,description:o.description||i.description,body:e,skills:i.skills,additionalSections:[...a,o.bodyAddendum].filter(Boolean)}));continue}n.push(l({name:r,title:i.title,description:i.description,body:e,skills:i.skills,additionalSections:a}))}return n.join(`
2
- `)}function h(){let t=s(e);return[`# aikit — Codex CLI Instructions`,``,"This project uses an MCP server (`aikit`) providing tools for search, analysis, memory, and validation.",``,`## MCP Server`,``,"Server name: `aikit`",``,`## Agents`,``,t,``,`## Agent Instructions`,``,m(t),`## Prompts`,``,u(a),``,`## Session Protocol`,``,c(n),``].join(`
3
- `)}function g(){return[{path:`.codex/config.toml`,content:d(i,r)},{path:`codex.md`,content:h()}]}export{g as generateCodex};
1
+ import{AGENTS as e}from"../definitions/agents.mjs";import{AGENT_BODIES as t}from"../definitions/bodies.mjs";import{HOOKS as n}from"../definitions/hooks.mjs";import{MCP_SERVER_ENTRY as r,SERVER_NAME as i}from"../definitions/mcp.mjs";import{PROMPTS as a}from"../definitions/prompts.mjs";import{PROTOCOLS as o}from"../definitions/protocols.mjs";import{buildAgentTable as s,buildCompactAgentTable as c,buildHooksSection as l,buildInlineAgentSection as u,buildPromptSections as d}from"./_shared.mjs";function f(e,t){let n=t.args.map(e=>JSON.stringify(e)).join(`, `);return`[mcp_servers.${e}]\ncommand = ${JSON.stringify(t.command)}\nargs = [${n}]\n`}function p(e,n){let r=t[e];return typeof r==`function`?r(n):r||``}function m(e){let t=[];e.extraBody&&t.push(e.extraBody),e.sharedBase&&o[e.sharedBase]&&t.push(o[e.sharedBase]);for(let n of e.sharedProtocols||[])o[n]&&t.push(o[n]);return t}function h(t){let n=[];for(let[r,i]of Object.entries(e)){let e=p(r,t),a=m(i);if(i.variants){for(let[t,o]of Object.entries(i.variants))n.push(u({name:`${r}-${t}`,title:i.title,description:o.description||i.description,body:e,skills:i.skills,additionalSections:[...a,o.bodyAddendum].filter(Boolean)}));continue}n.push(u({name:r,title:i.title,description:i.description,body:e,skills:i.skills,additionalSections:a}))}return n.join(`
2
+ `)}function g(){return[`# aikit — Codex CLI Instructions`,``,"This project uses an MCP server (`aikit`) providing tools for search, analysis, memory, and validation.",``,`## MCP Server`,``,"Server name: `aikit`",``,`## Agents`,``,s(e),``,`## Agent Instructions`,``,h(c(e)),`## Prompts`,``,d(a),``,`## Session Protocol`,``,l(n),``].join(`
3
+ `)}function _(){return[{path:`.codex/config.toml`,content:f(i,r)},{path:`codex.md`,content:g()}]}export{_ as generateCodex};
@@ -1,46 +1,46 @@
1
- import{AGENTS as e}from"../definitions/agents.mjs";import{AGENT_BODIES as t}from"../definitions/bodies.mjs";import{COPILOT_MODELS as n,VARIANT_GROUPS as r}from"../definitions/models.mjs";import{PROMPTS as i}from"../definitions/prompts.mjs";import{PROTOCOLS as a,TEMPLATES as o}from"../definitions/protocols.mjs";import{IDE_CAPABILITIES as s}from"../definitions/tools.mjs";const c={terminal:`execute/runInTerminal`,problems:`read/problems`,readFile:`read/readFile`,lastCommand:`read/terminalLastCommand`,subagent:`agent/runSubagent`,createFile:`edit/createFile`,editFiles:`edit/editFiles`,rename:`edit/rename`,createDirectory:`edit/createDirectory`,search:`search/changes, search/codebase, search/usages`,web:`web/fetch, web/githubRepo`,todo:`todo`,memory:`vscode/memory`,newWorkspace:`vscode/newWorkspace`,reviewPlan:`vscode/reviewPlan`,askQuestions:`vscode/askQuestions`,resolveMemoryFileUri:`vscode/resolveMemoryFileUri`,runCommand:`vscode/runCommand`,switchAgent:`vscode/switchAgent`,killTerminal:`execute/killTerminal`,createTask:`execute/createAndRunTask`,terminalSel:`read/terminalSelection`,fileSearch:`search/fileSearch`,listDir:`search/listDirectory`,textSearch:`search/textSearch`,searchSubagent:`search/searchSubagent`};function l(e){return`[${[...(s[e]||[]).map(e=>c[e]).filter(Boolean),`aikit/*`].join(`, `)}]`}function u(e){let t=n[e];return t?Array.isArray(t)?t[0]||`Auto (copilot)`:t:`Auto (copilot)`}const d=[`## Flows`,``,"This project uses aikit's pluggable flow system. Check flow status with the `flow` MCP tool.","If a flow is active, follow the current step's skill instructions. Advance with `flow({ action: 'step', advance: 'next' })`.","Use `flow({ action: 'list' })` to see available flows and `flow({ action: 'start', name, topic })` to begin one."].join(`
2
- `),f=[`## Flows`,``,"This project uses aikit's pluggable flow system. Use `flow({ action: 'status' })` to check if a flow is active.",`If dispatched as part of a flow, your work contributes to the current step. Do NOT advance or manage the flow — the Orchestrator handles flow lifecycle.`].join(`
3
- `);function p(){let t=[];for(let[i,a]of Object.entries(e))if(a.variants)for(let e of r[i]||[]){let r=`${i}-${e}`,o=n[r]||n[i],s=Array.isArray(o)?o[0]:o||`Unknown`,c=(a.variants[e]||{}).description||a.description;t.push(`| **${r}** | ${c} | ${s} | ${a.category} |`)}else{let e=n[i],r=Array.isArray(e)?e[0]:e||`Unknown`;t.push(`| **${i}** | ${a.description} | ${r} | ${a.category} |`)}return`| Agent | Purpose | Model | Category |\n|-------|---------|-------|----------|\n${t.join(`
4
- `)}`}function m(e,t,n){let i=`${e}-${t}`,o=n.variants[t]||{},s=u(i),c=o.description||n.description,d=o.identity||(t===r[e]?.[0]?`, the primary ${e} agent.`:`, a variant of ${e}. Same responsibilities, different model perspective.`),p=n.sharedBase&&a[n.sharedBase]?`\n\n${a[n.sharedBase]}`:``,m=n.extraBody?`\n\n${n.extraBody}`:``,h=o.bodyAddendum?`\n\n${o.bodyAddendum}`:``,g=n.skills?.length?`\n\n## Skills (load on demand)\n\n| Skill | When to load |\n|-------|--------------|\n${n.skills.map(([e,t])=>`| ${e} | ${t} |`).join(`
1
+ import{AGENTS as e}from"../definitions/agents.mjs";import{AGENT_BODIES as t}from"../definitions/bodies.mjs";import{COPILOT_MODELS as n,VARIANT_GROUPS as r}from"../definitions/models.mjs";import{PROMPTS as i}from"../definitions/prompts.mjs";import{PROTOCOLS as a,TEMPLATES as o}from"../definitions/protocols.mjs";import{IDE_CAPABILITIES as s}from"../definitions/tools.mjs";import{buildCompactAgentTable as c}from"./_shared.mjs";const l={terminal:`execute/runInTerminal`,problems:`read/problems`,readFile:`read/readFile`,lastCommand:`read/terminalLastCommand`,subagent:`agent/runSubagent`,createFile:`edit/createFile`,editFiles:`edit/editFiles`,rename:`edit/rename`,createDirectory:`edit/createDirectory`,search:`search/changes, search/codebase, search/usages`,web:`web/fetch, web/githubRepo`,todo:`todo`,memory:`vscode/memory`,newWorkspace:`vscode/newWorkspace`,reviewPlan:`vscode/reviewPlan`,askQuestions:`vscode/askQuestions`,resolveMemoryFileUri:`vscode/resolveMemoryFileUri`,runCommand:`vscode/runCommand`,switchAgent:`vscode/switchAgent`,killTerminal:`execute/killTerminal`,createTask:`execute/createAndRunTask`,terminalSel:`read/terminalSelection`,fileSearch:`search/fileSearch`,listDir:`search/listDirectory`,textSearch:`search/textSearch`,searchSubagent:`search/searchSubagent`};function u(e){return`[${[...(s[e]||[]).map(e=>l[e]).filter(Boolean),`aikit/*`].join(`, `)}]`}function d(e){let t=n[e];return t?Array.isArray(t)?t[0]||`Auto (copilot)`:t:`Auto (copilot)`}const f=[`## Flows`,``,"This project uses aikit's pluggable flow system. Check flow status with the `flow` MCP tool.","If a flow is active, follow the current step's skill instructions. Advance with `flow({ action: 'step', advance: 'next' })`.","Use `flow({ action: 'list' })` to see available flows and `flow({ action: 'start', name, topic })` to begin one."].join(`
2
+ `),p=[`## Flows`,``,"This project uses aikit's pluggable flow system. Use `flow({ action: 'status' })` to check if a flow is active.",`If dispatched as part of a flow, your work contributes to the current step. Do NOT advance or manage the flow — the Orchestrator handles flow lifecycle.`].join(`
3
+ `);function m(){let t=[];for(let[i,a]of Object.entries(e))if(a.variants)for(let e of r[i]||[]){let r=`${i}-${e}`,o=n[r]||n[i],s=Array.isArray(o)?o[0]:o||`Unknown`,c=(a.variants[e]||{}).description||a.description;t.push(`| **${r}** | ${c} | ${s} | ${a.category} |`)}else{let e=n[i],r=Array.isArray(e)?e[0]:e||`Unknown`;t.push(`| **${i}** | ${a.description} | ${r} | ${a.category} |`)}return`| Agent | Purpose | Model | Category |\n|-------|---------|-------|----------|\n${t.join(`
4
+ `)}`}function h(e,t,n){let i=`${e}-${t}`,o=n.variants[t]||{},s=d(i),c=o.description||n.description,l=o.identity||(t===r[e]?.[0]?`, the primary ${e} agent.`:`, a variant of ${e}. Same responsibilities, different model perspective.`),f=n.sharedBase&&a[n.sharedBase]?`\n\n${a[n.sharedBase]}`:``,m=n.extraBody?`\n\n${n.extraBody}`:``,h=o.bodyAddendum?`\n\n${o.bodyAddendum}`:``,g=n.skills?.length?`\n\n## Skills (load on demand)\n\n| Skill | When to load |\n|-------|--------------|\n${n.skills.map(([e,t])=>`| ${e} | ${t} |`).join(`
5
5
  `)}`:``,_=n.title||e;return`---
6
6
  description: '${c}'
7
- ${n.argumentHint?`argument-hint: "${n.argumentHint}"\n`:``}tools: ${l(n.toolRole)}
7
+ ${n.argumentHint?`argument-hint: "${n.argumentHint}"\n`:``}tools: ${u(n.toolRole)}
8
8
  model: ${s}
9
9
  ---
10
10
 
11
11
  # ${i} - ${_}
12
12
 
13
- You are **${i}**${d}${m}
14
- ${p}${h}${g}
13
+ You are **${i}**${l}${m}
14
+ ${f}${h}${g}
15
15
 
16
- ${f}
17
- `}function h(e,n){let r=u(e),i=typeof t[e]==`function`?t[e](p()):t[e]||``,o=n.sharedBase&&a[n.sharedBase]?`\n\n${a[n.sharedBase]}`:``,s=(n.sharedProtocols||[]).map(e=>a[e]?`\n\n${a[e]}`:``).join(``),c=n.title||e,m=n.skills?.length?`\n## Skills (load on demand)\n\n| Skill | When to load |\n|-------|--------------|\n${n.skills.map(([e,t])=>`| ${e} | ${t} |`).join(`
16
+ ${p}
17
+ `}function g(n,r){let i=d(n),o=typeof t[n]==`function`?t[n](c(e)):t[n]||``,s=r.sharedBase&&a[r.sharedBase]?`\n\n${a[r.sharedBase]}`:``,l=(r.sharedProtocols||[]).map(e=>a[e]?`\n\n${a[e]}`:``).join(``),m=r.title||n,h=r.skills?.length?`\n## Skills (load on demand)\n\n| Skill | When to load |\n|-------|--------------|\n${r.skills.map(([e,t])=>`| ${e} | ${t} |`).join(`
18
18
  `)}\n`:``;return`---
19
- description: '${n.description}'
20
- ${n.argumentHint?`argument-hint: "${n.argumentHint}"\n`:``}tools: ${l(n.toolRole)}
21
- model: ${r}
19
+ description: '${r.description}'
20
+ ${r.argumentHint?`argument-hint: "${r.argumentHint}"\n`:``}tools: ${u(r.toolRole)}
21
+ model: ${i}
22
22
  ---
23
23
 
24
- # ${e} - ${c}
24
+ # ${n} - ${m}
25
25
 
26
- You are the **${e}**, ${n.description.toLowerCase().replace(/^./,e=>e.toLowerCase())}
26
+ You are the **${n}**, ${r.description.toLowerCase().replace(/^./,e=>e.toLowerCase())}
27
27
 
28
- ${i}${o}${s}${m}
28
+ ${o}${s}${l}${h}
29
29
 
30
- ${e===`Orchestrator`?d:f}
31
- `}function g(e,t){return`---
30
+ ${n===`Orchestrator`?f:p}
31
+ `}function _(e,t){return`---
32
32
  description: "${t.description}"
33
33
  agent: "${t.agent}"
34
34
  ---
35
35
 
36
36
  ${t.content}
37
- `}function _(){return`# Agents
37
+ `}function v(){return`# Agents
38
38
 
39
39
  This directory contains AI agent definitions generated by \`@vpxa/aikit init\`.
40
40
 
41
41
  ## Agent Roster
42
42
 
43
- ${p()}
43
+ ${m()}
44
44
 
45
45
  ## Multi-Model Pattern
46
46
 
@@ -73,4 +73,4 @@ To regenerate after changing models or agent definitions:
73
73
  cd knowledge-base
74
74
  node scaffold/generate.mjs
75
75
  \`\`\`
76
- `}function v(){let t=[];for(let[n,i]of Object.entries(e))if(i.variants)for(let e of r[n]||[])t.push({path:`agents/${n}-${e}.agent.md`,content:m(n,e,i)});else t.push({path:`agents/${n}.agent.md`,content:h(n,i)});for(let[e,n]of Object.entries(a))t.push({path:`agents/_shared/${e}.md`,content:`${n}\n`});for(let[e,n]of Object.entries(o))t.push({path:`agents/templates/${e}.md`,content:`${n}\n`});t.push({path:`agents/README.md`,content:_()});for(let[e,n]of Object.entries(i))t.push({path:`prompts/aikit-${e}.prompt.md`,content:g(e,n)});return t}export{v as generateCopilot};
76
+ `}function y(){let t=[];for(let[n,i]of Object.entries(e))if(i.variants)for(let e of r[n]||[])t.push({path:`agents/${n}-${e}.agent.md`,content:h(n,e,i)});else t.push({path:`agents/${n}.agent.md`,content:g(n,i)});for(let[e,n]of Object.entries(a))t.push({path:`agents/_shared/${e}.md`,content:`${n}\n`});for(let[e,n]of Object.entries(o))t.push({path:`agents/templates/${e}.md`,content:`${n}\n`});t.push({path:`agents/README.md`,content:v()});for(let[e,n]of Object.entries(i))t.push({path:`prompts/aikit-${e}.prompt.md`,content:_(e,n)});return t}export{y as generateCopilot};
@@ -1,3 +1,3 @@
1
- import{AGENTS as e}from"../definitions/agents.mjs";import{AGENT_BODIES as t}from"../definitions/bodies.mjs";import{HOOKS as n}from"../definitions/hooks.mjs";import{MCP_SERVER_ENTRY as r,SERVER_NAME as i}from"../definitions/mcp.mjs";import{PROMPTS as a}from"../definitions/prompts.mjs";import{PROTOCOLS as o}from"../definitions/protocols.mjs";import{buildAgentTable as s,buildHooksSection as c,buildInlineAgentSection as l,buildMcpConfigJson as u,buildPromptSections as d}from"./_shared.mjs";function f(e,n){let r=t[e];return typeof r==`function`?r(n):r||``}function p(e){let t=[];e.extraBody&&t.push(e.extraBody),e.sharedBase&&o[e.sharedBase]&&t.push(o[e.sharedBase]);for(let n of e.sharedProtocols||[])o[n]&&t.push(o[n]);return t}function m(t){let n=[];for(let[r,i]of Object.entries(e)){let e=f(r,t),a=p(i);if(i.variants){for(let[t,o]of Object.entries(i.variants))n.push(l({name:`${r}-${t}`,title:i.title,description:o.description||i.description,body:e,skills:i.skills,additionalSections:[...a,o.bodyAddendum].filter(Boolean)}));continue}n.push(l({name:r,title:i.title,description:i.description,body:e,skills:i.skills,additionalSections:a}))}return n.join(`
2
- `)}function h(){let t=s(e);return[`# aikit — Gemini CLI Instructions`,``,"This project uses an MCP server (`aikit`) providing tools for search, analysis, memory, and validation.",``,`## MCP Server`,``,"Server name: `aikit`","Configure in `.gemini/settings.json` (already done if scaffold was deployed).",``,`## Agents`,``,t,``,`## Agent Instructions`,``,m(t),`## Prompts`,``,d(a),``,`## Session Protocol`,``,c(n),``].join(`
3
- `)}function g(){return[{path:`.gemini/settings.json`,content:`${u({serverName:i,mcpEntry:r,configKey:`mcpServers`})}\n`},{path:`GEMINI.md`,content:h()}]}export{g as generateGemini};
1
+ import{AGENTS as e}from"../definitions/agents.mjs";import{AGENT_BODIES as t}from"../definitions/bodies.mjs";import{HOOKS as n}from"../definitions/hooks.mjs";import{MCP_SERVER_ENTRY as r,SERVER_NAME as i}from"../definitions/mcp.mjs";import{PROMPTS as a}from"../definitions/prompts.mjs";import{PROTOCOLS as o}from"../definitions/protocols.mjs";import{buildAgentTable as s,buildCompactAgentTable as c,buildHooksSection as l,buildInlineAgentSection as u,buildMcpConfigJson as d,buildPromptSections as f}from"./_shared.mjs";function p(e,n){let r=t[e];return typeof r==`function`?r(n):r||``}function m(e){let t=[];e.extraBody&&t.push(e.extraBody),e.sharedBase&&o[e.sharedBase]&&t.push(o[e.sharedBase]);for(let n of e.sharedProtocols||[])o[n]&&t.push(o[n]);return t}function h(t){let n=[];for(let[r,i]of Object.entries(e)){let e=p(r,t),a=m(i);if(i.variants){for(let[t,o]of Object.entries(i.variants))n.push(u({name:`${r}-${t}`,title:i.title,description:o.description||i.description,body:e,skills:i.skills,additionalSections:[...a,o.bodyAddendum].filter(Boolean)}));continue}n.push(u({name:r,title:i.title,description:i.description,body:e,skills:i.skills,additionalSections:a}))}return n.join(`
2
+ `)}function g(){return[`# aikit — Gemini CLI Instructions`,``,"This project uses an MCP server (`aikit`) providing tools for search, analysis, memory, and validation.",``,`## MCP Server`,``,"Server name: `aikit`","Configure in `.gemini/settings.json` (already done if scaffold was deployed).",``,`## Agents`,``,s(e),``,`## Agent Instructions`,``,h(c(e)),`## Prompts`,``,f(a),``,`## Session Protocol`,``,l(n),``].join(`
3
+ `)}function _(){return[{path:`.gemini/settings.json`,content:`${d({serverName:i,mcpEntry:r,configKey:`mcpServers`})}\n`},{path:`GEMINI.md`,content:g()}]}export{_ as generateGemini};
@@ -1,4 +1,4 @@
1
- const e={Orchestrator:{title:`The Master Conductor`,description:`Master conductor that orchestrates the full development lifecycle: Planning → Implementation → Review → Recovery → Commit`,argumentHint:null,toolRole:`orchestrator`,sharedBase:null,sharedProtocols:[`decision-protocol`,`forge-protocol`],category:`orchestration`,skills:[]},Planner:{title:`The Strategic Architect`,description:`Autonomous planner that researches codebases and writes comprehensive TDD implementation plans`,argumentHint:null,toolRole:`planner`,sharedBase:`code-agent-base`,category:`orchestration`},Implementer:{title:`The Code Builder`,description:`Persistent implementation agent that writes code following TDD practices until all tasks are complete`,argumentHint:`Implementation task, feature, or phase from plan`,toolRole:`codeAgent`,sharedBase:`code-agent-base`,category:`implementation`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`typescript`,`When writing TypeScript code — type patterns, generics, utility types`]]},Frontend:{title:`The UI Specialist`,description:`UI/UX specialist for React, styling, responsive design, and frontend implementation`,argumentHint:`UI component, styling task, or frontend feature`,toolRole:`codeAgent`,sharedBase:`code-agent-base`,category:`implementation`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`react`,`When building React components — hooks, patterns, Server Components`],[`typescript`,`When writing TypeScript code — type patterns, generics, utility types`],[`frontend-design`,`When implementing UI/UX — design systems, accessibility, responsive patterns`]]},Refactor:{title:`The Code Sculptor`,description:`Code refactoring specialist that improves structure, readability, and maintainability`,argumentHint:`Code, component, or pattern to refactor`,toolRole:`refactor`,sharedBase:`code-agent-base`,category:`implementation`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`]]},Debugger:{title:`The Problem Solver`,description:`Expert debugger that diagnoses issues, traces errors, and provides solutions using AI Kit traces and compressed context before raw file reads`,argumentHint:`Error message, stack trace, or description of issue`,toolRole:`debugger`,sharedBase:`code-agent-base`,category:`diagnostics`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`typescript`,`When writing TypeScript code — type patterns, generics, utility types`]]},Security:{title:`The Vulnerability Hunter`,description:`Security specialist that analyzes code for vulnerabilities and compliance`,argumentHint:`Code, feature, or component to security review`,toolRole:`security`,sharedBase:`code-agent-base`,category:`diagnostics`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`typescript`,`When reviewing code — security patterns, type safety`]]},Documenter:{title:`The Knowledge Keeper`,description:`Documentation specialist that creates and maintains comprehensive project documentation`,argumentHint:`Component, API, feature, or area to document`,toolRole:`documenter`,sharedBase:`code-agent-base`,category:`documentation`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`present`,`When presenting documentation previews or architecture visuals to the user`],[`docs`,`When creating or updating project documentation — docs/ convention, architecture blueprints, Diátaxis framework`]]},Explorer:{title:`The Rapid Scout`,description:`Rapid codebase exploration to find files, usages, dependencies, and structural context`,argumentHint:`Find files, usages, and context related to: {topic or goal}`,toolRole:`explorer`,sharedBase:null,category:`exploration`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`]]},Researcher:{title:`The Context Gatherer`,description:`Deep analysis, architecture review, and multi-model decision protocol participant`,argumentHint:`Research question, problem statement, or subsystem to investigate`,toolRole:`researcher`,sharedBase:`researcher-base`,category:`research`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`lesson-learned`,`When analyzing past changes to extract engineering principles`],[`c4-architecture`,`When researching system architecture — produce C4 diagrams`],[`adr-skill`,`When the research involves a technical decision — draft an ADR`]],variants:{Alpha:{description:`Primary deep research agent — also serves as default Researcher`,identity:`, the primary deep research agent. During multi-model decision sessions, you provide deep reasoning and nuanced system design. Your thinking style is **Contrarian** — actively look for flaws, fatal assumptions, and hidden risks in every approach. The best ideas survive adversarial pressure.`,bodyAddendum:`## Required Output Section — \`## Depth Analysis\`
1
+ const e={Orchestrator:{title:`The Master Conductor`,description:`Master conductor that orchestrates the full development lifecycle: Planning → Implementation → Review → Recovery → Commit`,argumentHint:null,toolRole:`orchestrator`,sharedBase:null,sharedProtocols:[`decision-protocol`,`forge-protocol`],category:`orchestration`,skills:[]},Planner:{title:`The Strategic Architect`,description:`Autonomous planner that researches codebases and writes comprehensive TDD implementation plans`,compactRole:`TDD implementation plans`,argumentHint:null,toolRole:`planner`,sharedBase:`code-agent-base`,category:`orchestration`},Implementer:{title:`The Code Builder`,description:`Persistent implementation agent that writes code following TDD practices until all tasks are complete`,compactRole:`New features, wire up, build`,argumentHint:`Implementation task, feature, or phase from plan`,toolRole:`codeAgent`,sharedBase:`code-agent-base`,category:`implementation`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`typescript`,`When writing TypeScript code — type patterns, generics, utility types`]]},Frontend:{title:`The UI Specialist`,description:`UI/UX specialist for React, styling, responsive design, and frontend implementation`,compactRole:`UI/UX, React, styling, responsive`,argumentHint:`UI component, styling task, or frontend feature`,toolRole:`codeAgent`,sharedBase:`code-agent-base`,category:`implementation`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`react`,`When building React components — hooks, patterns, Server Components`],[`typescript`,`When writing TypeScript code — type patterns, generics, utility types`],[`frontend-design`,`When implementing UI/UX — design systems, accessibility, responsive patterns`]]},Refactor:{title:`The Code Sculptor`,description:`Code refactoring specialist that improves structure, readability, and maintainability`,compactRole:`Cleanup, simplify, DRY, extract`,argumentHint:`Code, component, or pattern to refactor`,toolRole:`refactor`,sharedBase:`code-agent-base`,category:`implementation`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`]]},Debugger:{title:`The Problem Solver`,description:`Expert debugger that diagnoses issues, traces errors, and provides solutions using AI Kit traces and compressed context before raw file reads`,compactRole:`Bug diagnosis, error tracing`,argumentHint:`Error message, stack trace, or description of issue`,toolRole:`debugger`,sharedBase:`code-agent-base`,category:`diagnostics`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`typescript`,`When writing TypeScript code — type patterns, generics, utility types`]]},Security:{title:`The Vulnerability Hunter`,description:`Security specialist that analyzes code for vulnerabilities and compliance`,compactRole:`Vulnerability analysis, auth hardening`,argumentHint:`Code, feature, or component to security review`,toolRole:`security`,sharedBase:`code-agent-base`,category:`diagnostics`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`typescript`,`When reviewing code — security patterns, type safety`]]},Documenter:{title:`The Knowledge Keeper`,description:`Documentation specialist that creates and maintains comprehensive project documentation`,compactRole:`Project documentation`,argumentHint:`Component, API, feature, or area to document`,toolRole:`documenter`,sharedBase:`code-agent-base`,category:`documentation`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`present`,`When presenting documentation previews or architecture visuals to the user`],[`docs`,`When creating or updating project documentation — docs/ convention, architecture blueprints, Diátaxis framework`]]},Explorer:{title:`The Rapid Scout`,description:`Rapid codebase exploration to find files, usages, dependencies, and structural context`,compactRole:`Rapid codebase navigation`,argumentHint:`Find files, usages, and context related to: {topic or goal}`,toolRole:`explorer`,sharedBase:null,category:`exploration`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`]]},Researcher:{title:`The Context Gatherer`,description:`Deep analysis, architecture review, and multi-model decision protocol participant`,compactRole:`Multi-model deep research`,argumentHint:`Research question, problem statement, or subsystem to investigate`,toolRole:`researcher`,sharedBase:`researcher-base`,category:`research`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`lesson-learned`,`When analyzing past changes to extract engineering principles`],[`c4-architecture`,`When researching system architecture — produce C4 diagrams`],[`adr-skill`,`When the research involves a technical decision — draft an ADR`]],variants:{Alpha:{description:`Primary deep research agent — also serves as default Researcher`,identity:`, the primary deep research agent. During multi-model decision sessions, you provide deep reasoning and nuanced system design. Your thinking style is **Contrarian** — actively look for flaws, fatal assumptions, and hidden risks in every approach. The best ideas survive adversarial pressure.`,bodyAddendum:`## Required Output Section — \`## Depth Analysis\`
2
2
 
3
3
  Your final report MUST contain a \`## Depth Analysis\` section with:
4
4
  - Deep-dive into ONE chosen subsystem (most structurally central to the question)
@@ -94,7 +94,7 @@ When you are invoked via \`runSubagent\` (i.e., as a subagent of another agent l
94
94
  - **Do NOT use the \`present\` tool** — your visual output is invisible to the user
95
95
  - Return ALL findings as plain structured text in your final response
96
96
  - Use markdown formatting (headers, tables, code blocks) for structure
97
- - The calling agent will re-present your findings to the user if needed`}}},"Code-Reviewer":{title:`The Quality Guardian`,description:`Code review specialist analyzing code for quality, security, performance, and maintainability`,argumentHint:`File path, PR, or code to review`,toolRole:`reviewer`,sharedBase:`code-reviewer-base`,category:`review`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`typescript`,`When reviewing TypeScript code — type patterns, best practices`]],variants:{Alpha:{description:`Primary code reviewer`,identity:`, the primary Code-Reviewer agent. Your lens is **compliance and red-teaming** — you hunt for correctness bugs, security holes, and contract violations that will break in production.`,bodyAddendum:`## Review Lens: Compliance & Red-Team
97
+ - The calling agent will re-present your findings to the user if needed`}}},"Code-Reviewer":{title:`The Quality Guardian`,description:`Code review specialist analyzing code for quality, security, performance, and maintainability`,compactRole:`Dual-perspective code review`,argumentHint:`File path, PR, or code to review`,toolRole:`reviewer`,sharedBase:`code-reviewer-base`,category:`review`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`typescript`,`When reviewing TypeScript code — type patterns, best practices`]],variants:{Alpha:{description:`Primary code reviewer`,identity:`, the primary Code-Reviewer agent. Your lens is **compliance and red-teaming** — you hunt for correctness bugs, security holes, and contract violations that will break in production.`,bodyAddendum:`## Review Lens: Compliance & Red-Team
98
98
 
99
99
  Your primary focus areas (in order of priority):
100
100
  1. **Correctness** — Logic errors, race conditions, null/undefined paths, off-by-one
@@ -112,7 +112,7 @@ Your primary focus areas (in order of priority):
112
112
  4. **Patterns** — Consistency with existing codebase conventions, idiomatic usage
113
113
 
114
114
  Your instinct: "Will a new team member understand this in 6 months?" Think like a mentor.
115
- Prefer actionable suggestions over vague concerns. Show the better version when possible.`}}},"Architect-Reviewer":{title:`The Structural Guardian`,description:`Reviews architecture for pattern adherence, SOLID compliance, dependency direction, and structural integrity`,argumentHint:`Files, PR, or subsystem to architecture-review`,toolRole:`reviewer`,sharedBase:`architect-reviewer-base`,category:`review`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`c4-architecture`,`When reviewing architectural diagrams or boundary changes`],[`adr-skill`,`When the review involves architecture decisions — reference or create ADRs`]],extraBody:`You are **not** the Code-Reviewer agent. Code-Reviewer handles correctness, testing, security, and code quality. You handle the big picture: service boundaries, dependency direction, pattern adherence, and structural health.`,variants:{Alpha:{description:`Primary architecture reviewer`,identity:`, the primary Architect-Reviewer agent. Your lens is **structural prosecution** — you challenge architectural choices, find boundary violations, and test whether the design survives growth.`,bodyAddendum:`## Review Lens: Structural Prosecutor
115
+ Prefer actionable suggestions over vague concerns. Show the better version when possible.`}}},"Architect-Reviewer":{title:`The Structural Guardian`,description:`Reviews architecture for pattern adherence, SOLID compliance, dependency direction, and structural integrity`,compactRole:`Architecture review`,argumentHint:`Files, PR, or subsystem to architecture-review`,toolRole:`reviewer`,sharedBase:`architect-reviewer-base`,category:`review`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`c4-architecture`,`When reviewing architectural diagrams or boundary changes`],[`adr-skill`,`When the review involves architecture decisions — reference or create ADRs`]],extraBody:`You are **not** the Code-Reviewer agent. Code-Reviewer handles correctness, testing, security, and code quality. You handle the big picture: service boundaries, dependency direction, pattern adherence, and structural health.`,variants:{Alpha:{description:`Primary architecture reviewer`,identity:`, the primary Architect-Reviewer agent. Your lens is **structural prosecution** — you challenge architectural choices, find boundary violations, and test whether the design survives growth.`,bodyAddendum:`## Review Lens: Structural Prosecutor
116
116
 
117
117
  Your primary focus areas:
118
118
  1. **Boundary violations** — Does this cross package/module boundaries it shouldn't?
@@ -156,12 +156,13 @@ Flows MUST be driven to completion. A flow left active forever blocks future wor
156
156
 
157
157
  ### Orchestrator Protocols (apply during ALL flow steps)
158
158
 
159
- **PRE-DISPATCH GATE — complete ALL before ANY \`runSubagent\` call:**
160
- 1. \`multi-agents-development\` skill loaded?
161
- 2. Task decomposition table produced?
162
- 3. Independence Check passed per pair?
163
- 4. Each task ≤ 3 files?
164
- 5. Parallel batches identified?
159
+ **PRE-DISPATCH GATE:**
160
+ - **Floor:** Skip gate — direct single-agent dispatch
161
+ - **Standard+:** Before ANY \`runSubagent\`:
162
+ 1. Task decomposition table produced?
163
+ 2. Independence Check per pair?
164
+ 3. Each task 3 files?
165
+ 4. Parallel batches identified?
165
166
 
166
167
  **Decomposition output format:**
167
168
 
@@ -192,56 +193,15 @@ Batch 2 (after batch 1):
192
193
  - Enforce delegation rules at all times — Orchestrator never implements code directly
193
194
  - Use the subagent prompt template for every dispatch so step-specific flow instructions are grounded in actual code context
194
195
 
195
- **Per-step review cycle:** Dispatch → Code Review (Alpha+Beta) → Arch Review (if boundary changes) → Security (if applicable) → \`evidence_map\` gate → **🛑 STOP — present results**
196
+ **Per-step review cycle (tier-gated):**
197
+ - **Floor:** No review — \`check\` + \`test_run\` only
198
+ - **Standard:** Dispatch → Code Review (Alpha only) → \`evidence_map\` gate → **🛑 STOP**
199
+ - **Critical:** Dispatch → Code Review (Alpha+Beta) → Arch Review → Security → \`evidence_map\` gate → **🛑 STOP**
196
200
  Reviewers add findings to the Orchestrator's existing \`evidence_map\` \`task_id\` and do NOT run the gate themselves.
197
201
 
198
- ### Flow MCP Tools
202
+ ### Multi-Root Workspace
199
203
 
200
- | Tool | Purpose |
201
- |------|---------|
202
- | \`flow\` | Manage flows — list, start, navigate steps, read instructions, inspect runs, and add/remove/update. Use the \`action\` parameter. |
203
-
204
- ### Multi-Root Workspace Support
205
-
206
- When the IDE workspace contains **multiple repository roots**, flows support cross-repo orchestration:
207
-
208
- **Detection:** \`flow({ action: 'list' })\` and \`flow({ action: 'status' })\` return \`allRoots\` — the list of all workspace roots. When \`allRoots.length > 1\`, the workspace is multi-root.
209
-
210
- **Single-repo task (default):** If the workspace has only one root, omit \`roots\`. In multi-root workspaces, **always pass \`roots\`** targeting the specific repo — omitting it creates \`.flows/\` at the workspace root, which is almost never the intended location.
211
-
212
- **Multi-repo task:** Pass \`roots\` to \`flow({ action: 'start', ... })\` listing ALL participating repositories:
213
- \`\`\`
214
- flow({
215
- action: 'start',
216
- name: 'aikit:advanced',
217
- topic: "cross-repo-auth",
218
- roots: ["E:/repos/api-gateway", "E:/repos/auth-service", "E:/repos/shared-types", "E:/repos/frontend"]
219
- })
220
- \`\`\`
221
- This creates \`.flows/cross-repo-auth/\` with synchronized \`meta.json\` in each listed root. Every \`flow\` step/reset action and state change is automatically replicated to all roots.
222
-
223
- **Decision criteria for multi-root flows:**
224
-
225
- | Signal | Action |
226
- |--------|--------|
227
- | Task touches files in 1 repo | Pass that repo as \`roots\` (in multi-root workspaces) |
228
- | Task touches files in 2+ repos | Pass those repos as \`roots\` |
229
- | Shared types/contracts change | Include all repos that consume them |
230
- | Unsure which repos are affected | Use \`blast_radius\` + \`graph\` first, then decide |
231
-
232
- **Template variables in step instructions:**
233
- - \`{{workspace_root}}\` — primary root (first in \`roots\` array)
234
- - \`{{all_roots}}\` — JSON array of all participating roots
235
- - \`{{artifacts_path}}\` — primary root's \`.flows/<slug>/.spec/\`
236
- - \`{{run_dir}}\` — primary root's \`.flows/<slug>/\`
237
-
238
- **Subagent dispatch in multi-root:** When dispatching subagents for a multi-root flow, always include the target root in the prompt:
239
- \`\`\`
240
- Scope: E:/repos/auth-service/src/auth.ts
241
- Root: E:/repos/auth-service
242
- Artifacts: E:/repos/auth-service/.flows/cross-repo-auth/.spec/
243
- \`\`\`
244
- Each subagent operates on ONE root. The Orchestrator coordinates across roots via batched dispatch.
204
+ When \`allRoots.length > 1\`: always pass \`roots\` to \`flow start\` targeting specific repo(s). Use \`blast_radius\`/\`graph\` to identify affected roots. Each subagent operates on ONE root — include target root + artifacts path in dispatch prompt. Template vars: \`{{workspace_root}}\`, \`{{all_roots}}\`, \`{{artifacts_path}}\`, \`{{run_dir}}\`.
245
205
 
246
206
  ## Emergency: STOP → ASSESS → CONTAIN → RECOVER → DOCUMENT
247
207
 
@@ -253,51 +213,55 @@ Each subagent operates on ONE root. The Orchestrator coordinates across roots vi
253
213
 
254
214
  **Tripwires**: 2x files modified → pause. Agent \`BLOCKED\` → diagnose, don't re-delegate unchanged. **Max 2 retries** per task.
255
215
 
256
- ## Tool Profiles
216
+ ## Context Budget
217
+
218
+ - **NEVER implement code yourself** — always delegate, no exceptions
219
+ - One-shot delegation preferred for isolated sub-tasks
257
220
 
258
- When dispatching subagents, consider setting a tool profile to reduce their token overhead:
221
+ ### Context Gathering for Subagent Prompts
259
222
 
260
- | Dispatch scenario | Recommended profile |
261
- |-------------------|-------------------|
262
- | Full implementation | \`full\` (default) |
263
- | Code review, analysis only | \`safe\` |
264
- | Research, investigation | \`research\` |
265
- | Simple fix, single file | \`minimal\` |
266
- | New agent onboarding | \`discovery\` |
223
+ Default to \`stratum_card({tier:'T1'})\` (~100 tok/file). Upgrade: \`compact\` (~300 tok/file) for semantic need, \`digest\` for multi-file synthesis, \`read_file\` only for exact edit lines.
267
224
 
268
- Include profile in subagent context: "Use tool profile: \`<profile>\`"
225
+ ### Between-Phase Compression (MANDATORY)
269
226
 
270
- For maximum token efficiency, instruct subagents to use the **meta-tool discovery pattern**: \`list_tools()\` → \`search_tools({ query })\` → \`describe_tool({ tool_name })\` instead of loading all tool descriptions upfront.
227
+ After each subagent batch returns:
228
+ 1. Extract per agent: **status + files + decisions** (2-3 sentences)
229
+ 2. \`stash({ key: "batch-N-summary", value: compressed })\`
230
+ 3. Next batch sees stash — NOT full subagent output
271
231
 
272
- ## Context Budget
232
+ Between phases: \`session_digest({ persist: true, focus: "<topic>" })\`. Carry forward ONLY: decisions, file paths, blockers.
273
233
 
274
- - **NEVER implement code yourself** — always delegate, no exceptions
275
- - Compress previous phase to **decisions + file paths** before next phase
276
- - \`digest\` between phases, \`stash\`/\`remember\` analysis results
277
- - Provide subagents \`scope_map\` + relevant files only not full history
278
- - One-shot delegation preferred for isolated sub-tasks
279
- - Estimate context per subagent: \`stratum_card({tier:'T1'})\` ~100 tokens/file, \`compact\` ~300 tokens/file, \`digest\` for multi-file compression
280
- - **Receipt consumption:** After \`evidence_map({ action: "gate" })\`, review all receipts. If any claim lacks a tool-verified receipt, add one before declaring YIELD.
234
+ ### Subagent Prompt Rules
235
+
236
+ - Shared context crafted ONCE for parallel dispatch — don't duplicate per-prompt
237
+ - \`scope_map\` + relevant files — never conversation history
238
+ - Tell subagents: "Return 200 words: status, files, decisions. Full detail only if BLOCKED."
239
+
240
+ ### Validation
241
+
242
+ - \`check({})\` + \`test_run({})\` ONCE after all batches — never per-batch, never via terminal
243
+ - **Receipt consumption:** After \`evidence_map({ action: "gate" })\`, check all receipts have tool-verified evidence.
281
244
 
282
245
  ## Output Rules
283
246
 
284
- - Structured data >3 sentences \`present({ format: "html" })\` (or \`format: "browser"\` in CLI mode)
247
+ - **Terse by default** status updates, phase transitions, and confirmations in 1-3 sentences. No preamble, no filler.
248
+ - Batch completion summary: bullet list of agent status + files + decisions. NOT prose paragraphs.
249
+ - Structured data >3 rows → \`present({ format: "html" })\` (or \`format: "browser"\` in CLI mode)
285
250
  - Charts, tables, dependency graphs → always \`present\`
286
251
  - Short confirmations and questions → normal chat
287
252
  - **CLI mode:** Always use \`format: "browser"\` — the \`html\` format's UIResource is invisible in terminal environments. The \`browser\` format auto-opens the system browser.
288
253
 
289
254
  ## Subagent Output Relay
290
255
 
291
- When subagents complete, their visual outputs (from \`present\`) are NOT visible to the user.
292
- **Prevention:** Always include "Do NOT use the \`present\` tool — return all findings as plain text" in every subagent dispatch prompt, including researcher dispatches for the Multi-Model Decision Protocol.
293
- **You MUST relay key findings:**
256
+ Subagent \`present\` calls are invisible to user. Always include "Do NOT use \`present\` return findings as structured text" in every dispatch.
294
257
 
295
- 1. After every subagent completes, extract key data from the returned text
296
- 2. If the subagent mentions charts, tables, or visual data → re-present using \`present({ format: "html" })\` (or \`format: "browser"\` in CLI mode)
297
- 3. If the subagent returns structured findings summarize and present to user
298
- 4. **Never assume the user saw subagent output** always relay or re-present
258
+ **After each subagent returns:**
259
+ 1. Extract: status + files + key decisions (2-3 sentences)
260
+ 2. \`stash({ key: "agent-<name>-result", value: compressed })\` full response exits conversation context
261
+ 3. Present COMPRESSED summary to user never echo verbatim subagent output
262
+ 4. If visual data needed → \`present\` the summary, not raw response
299
263
 
300
- **Rule: Every subagent batch completion MUST be followed by a user-visible summary or presentation.**
264
+ **Rule: Every batch completion user-visible compressed summary. Never echo full subagent responses.**
301
265
 
302
266
  ## Critical Rules
303
267
 
@@ -324,13 +288,10 @@ When subagents complete, their visual outputs (from \`present\`) are NOT visible
324
288
  - \`run_in_terminal\` for code generation (sed, echo >>, etc.)
325
289
  - \`vscode/switchAgent\` — **NEVER use this to delegate flow work**. Switching agents hands off control and breaks flow orchestration. ALL agent work goes through \`runSubagent\`. \`vscode/switchAgent\` is reserved for explicit user-requested agent switching only.
326
290
 
327
- ### Allowed Tools (Orchestrator uses these directly)
328
- - \`search\`, \`compact\`, \`digest\`, \`file_summary\`, \`scope_map\`, \`symbol\`, \`trace\`, \`graph\`
329
- - \`present\`, \`remember\`, \`stash\`, \`checkpoint\`, \`restore\`
330
- - \`check\`, \`test_run\`, \`blast_radius\`, \`reindex\`, \`produce_knowledge\`
331
- - \`forge_classify\`, \`forge_ground\`, \`evidence_map\`
291
+ ### Allowed Tools
332
292
  - \`runSubagent\` — your PRIMARY tool for getting work done
333
- - \`read_file\`ONLY to gather context for subagent prompts
293
+ - Read/analysis/memory/validation tools used directly to gather context and verify
294
+ - \`read_file\` — ONLY for exact lines before delegating edits
334
295
 
335
296
  ### Pre-Action Gate
336
297
  Before every tool call, verify:
@@ -341,43 +302,37 @@ Before every tool call, verify:
341
302
 
342
303
  ## Skills (load on demand)
343
304
 
344
- | Skill | When to load |
345
- |-------|--------------|
346
- | \`multi-agents-development\` | **Before any delegation** — task decomposition, dispatch templates, review pipeline, recovery patterns |
347
- | \`present\` | When presenting plans, findings, or visual content to the user — dashboards, tables, charts, timelines |
348
- | \`brainstorming\` | When ANY flow step (builtin or custom) involves design, brainstorming, or creative work — auto-detected by Orchestrator. Pairs with the Multi-Model Decision Protocol for technical decisions |
349
- | \`session-handoff\` | Context filling up, session ending, or major milestone |
350
- | \`lesson-learned\` | After completing work — extract engineering principles |
351
- | \`docs\` | During \`_docs-sync\` epilogue — living documentation convention, templates, change-to-doc mapping |
352
- | \`repo-access\` | **IMMEDIATELY** when YOU or any subagent get auth failures from \`web_fetch\`, \`http\`, or git commands (401, 403, 404, SSO redirect, login HTML, "Permission denied"). NEVER declare a repo "inaccessible" without first loading this skill and walking the Strategy Ladder |
353
- | \`browser-use\` | When \`repo-access\` Strategy Ladder is exhausted and auth requires browser interaction (SAML SSO, OAuth consent, 2FA). Also for web scraping, form filling, UI testing, or any task needing a real browser. Pairs with \`repo-access\` |
305
+ | Skill | Trigger |
306
+ |-------|---------|
307
+ | \`multi-agents-development\` | Before any delegation |
308
+ | \`present\` | Visual content for user |
309
+ | \`brainstorming\` | Design/decision flow steps |
310
+ | \`session-handoff\` | Context pressure > 70% or session end |
311
+ | \`lesson-learned\` | After completing work |
312
+ | \`docs\` | \`_docs-sync\` epilogue |
313
+ | \`repo-access\` | Auth failures (401/403/404/SSO) ALWAYS walk ladder before declaring inaccessible |
314
+ | \`browser-use\` | After repo-access ladder exhausted, or browser interaction needed |
354
315
 
355
316
  ## Repo Access — HARD RULE
356
317
 
357
- **If \`web_fetch\` or \`http\` returns 401, 403, 404, SSO redirect, login page HTML, or any auth-like failure for a repository or code URL:**
358
- 1. **STOP** — do NOT declare the repo "inaccessible" or "behind SSO"
359
- 2. **Load the \`repo-access\` skill** and follow its Strategy Ladder
360
- 3. **Walk all 5 steps** before concluding access is impossible
361
- 4. If Strategy Ladder is exhausted and auth requires browser interaction → **load \`browser-use\` skill** for browser-based auth recovery (SAML SSO, OAuth, 2FA flows)
362
- 5. **Include \`repo-access\` and \`browser-use\` in subagent prompts** when delegating tasks that touch the same repo
363
-
364
- This applies to YOU (the Orchestrator) when you use \`web_fetch\`/\`http\` directly, not just subagents.
318
+ On ANY auth failure (401/403/404/SSO/login HTML): STOP → load \`repo-access\` skill walk ALL 5 steps before declaring inaccessible. If exhausted → \`browser-use\`. Include both skills in subagent prompts for affected repos.
365
319
 
366
320
  **When dispatching subagents**, include relevant skill names in the prompt so subagents know which skills to load (e.g., "Load the \`react\` and \`typescript\` skills for this task").
367
321
 
368
322
  ## Session Protocol
369
323
 
370
- ### Start (do ALL)
324
+ ### Start
371
325
 
372
326
  \`\`\`
373
- flow({ action: 'status' }) # Check/resume active flow FIRST
374
- # If flow active → flow({ action: 'read', step }) → follow step instructions
375
- status({}) # Check AI Kit health + onboard state
376
- # If onboard not run → onboard({ path: "." }) # First-time codebase analysis
377
- flow({ action: 'list' }) # See available flows
378
- # Select flow based on task → flow({ action: 'start', name: "<name>", topic: "<task>" }) # Start flow creates .flows/{topic}/
379
- knowledge({ action: "list" }) # See stored knowledge
327
+ flow({ action: 'status' }) # Check for active flow
328
+ \`\`\`
329
+ **If active flow:** \`flow({ action: 'read' })\` follow step. Skip remaining start steps.
330
+ **If no active flow:**
331
+ \`\`\`
332
+ status({}) # AI Kit health + onboard
333
+ flow({ action: 'list' }) # Available flows
380
334
  search({ query: "SESSION CHECKPOINT", origin: "curated" }) # Resume prior work
335
+ # Select flow → flow({ action: 'start', name, topic })
381
336
  \`\`\`
382
337
 
383
338
  ### During
@@ -413,7 +368,7 @@ After any \`status()\` call, check the \`contextPressure\` value (0-100):
413
368
  This project uses aikit's pluggable flow system. Check flow status with the \`flow\` MCP tool.
414
369
  If a flow is active, follow the current step's instructions. Advance with \`flow({ action: 'step', advance: 'next' })\`.
415
370
  Use \`flow({ action: 'list' })\` to see available flows and \`flow({ action: 'start', name, topic })\` to begin one.
416
- `,Planner:`**Read \`AGENTS.md\`** in the workspace root for project conventions and AI Kit protocol.
371
+ `,Planner:`**\`AGENTS.md\` is already in your context** do NOT re-read it. Just load the \`aikit\` skill.
417
372
 
418
373
  Load the \`aikit\` skill for full tool documentation, workflow chains, and session protocol.
419
374
 
@@ -514,62 +469,7 @@ When subagents complete, their visual outputs (from \`present\`) are NOT visible
514
469
  | \`adr-skill\` | When the plan involves non-trivial technical decisions — create executable ADRs |
515
470
  | \`session-handoff\` | When context window is filling up, planning session ending, or major milestone completed |
516
471
  | \`repo-access\` | When the plan involves accessing private, enterprise, or self-hosted repositories |
517
- | \`browser-use\` | When the plan involves browser-based auth recovery, web scraping, or interacting with web applications that require login |`,Implementer:`**Read \`AGENTS.md\`** in the workspace root for project conventions and AI Kit protocol.
518
-
519
- Load the \`aikit\` skill for full tool documentation, workflow chains, and session protocol.
520
-
521
- ## Implementation Protocol
522
-
523
- 1. **Understand scope** — Read the phase objective, identify target files
524
- 2. **Write test first** (Red) — Create failing tests that define expected behavior
525
- 3. **Implement** (Green) — Write minimal code to make tests pass
526
- 4. **Refactor** — Clean up while keeping tests green
527
- 5. **Validate** — \`check\`, \`test_run\`, \`blast_radius\`
528
- 6. **Persist** — \`remember\` any decisions or patterns discovered
529
-
530
- ## Rules
531
-
532
- - **Test-first always** — No implementation without a failing test
533
- - **Minimal code** — Don't build what isn't asked for
534
- - **Follow existing patterns** — Search AI Kit for conventions before creating new ones (\`search("convention")\`, \`knowledge({ action: "list", category: "conventions" })\`)
535
- - **Never modify tests to make them pass** — Fix the implementation instead
536
- - **Run \`check\` after every change** — Catch errors early
537
- - **Loop-break** — If the same test still fails with the same error after 2 retries, STOP. Re-read the error from scratch, check your assumptions with \`trace\` or \`symbol\`, and try a fundamentally different approach. Do not attempt a 3rd retry in the same direction
538
- - **Think-first for complex tasks** — If a task involves 3+ files or non-obvious logic, outline your approach before writing code. Check existing patterns with \`search\` first. Design, then implement
539
-
540
- ## Pre-Edit Checklist (before modifying any file)
541
-
542
- 1. **Understand consumers** — \`graph({action:'find_nodes', name_pattern:'<target>'})\` → \`graph({action:'neighbors', node_id, direction:'incoming'})\`. See who calls/imports before changing a contract.
543
- 2. **Compress, don't raw-read** — \`file_summary\` then \`compact({path, query})\` for the specific area. Only \`read_file\` when you need exact lines for \`replace_string_in_file\`.
544
- 3. **Snapshot risky edits** — \`checkpoint({action:'save', label:'pre-<scope>'})\` before cross-cutting changes. \`checkpoint({action:'restore', ...})\` if \`check\`/\`test_run\` fails.
545
- 4. **Estimate blast radius** — \`blast_radius({changed_files:[...]})\` BEFORE editing when changing a public/shared symbol; re-run AFTER to confirm actual impact matches.
546
- 5. **TDD when tests exist** — write/extend the failing test first, then minimum code to pass.
547
-
548
- ## Post-Edit Checklist
549
-
550
- 1. \`check({})\` — typecheck + lint must pass clean
551
- 2. \`test_run({})\` — full suite or targeted pattern
552
- 3. If Orchestrator passed a \`task_id\`: \`evidence_map({action:'add', task_id, claim, status:'V', receipt:'file.ts#Lxx'})\` for each verified contract/acceptance claim. Do NOT run the gate — Orchestrator owns it.
553
-
554
- ## Structured Output (MANDATORY)
555
-
556
- Every implementation response MUST end with a structured status block:
557
-
558
- \`\`\`
559
- ## Status: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED
560
-
561
- ### Files Changed
562
- - path/to/file.ts — description of change
563
-
564
- ### Tests
565
- - path/to/test.ts — N tests added/modified, all passing
566
-
567
- ### Evidence
568
- - [claim]: [receipt/verification]
569
-
570
- ### Blockers (if any)
571
- - Description of blocker
572
- \`\`\``,Frontend:"**Read `AGENTS.md`** in the workspace root for project conventions and AI Kit protocol.\n\nLoad the `aikit` skill for full tool documentation, workflow chains, and session protocol.\n\n## Frontend Protocol\n\n0. **Check for DESIGN.md** — Look for `DESIGN.md` in the workspace root or `docs/` directory. If found, read it first — it defines the project's design system, tokens, colors, typography, spacing, and component conventions. Follow it as the authoritative design reference.\n1. **Search AI Kit** for existing component patterns and design tokens\n2. **Write component tests first** — Accessibility, rendering, interaction\n3. **Implement** — Follow existing component patterns, use design system tokens\n4. **Validate** — `check`, `test_run`, visual review\n5. **Persist** — `remember` new component patterns\n\n## Rules\n\n- **Accessibility first** — ARIA attributes, keyboard navigation, screen reader support\n- **Follow design system** — Use existing tokens, don't create one-off values\n- **Responsive by default** — Mobile-first, test all breakpoints\n- **Test-first** — Component tests before implementation\n\n## Frontend Exploration Mode\n\n| Need | Tool |\n|------|------|\n| Component dependency graph | `graph({action:'neighbors', node_id:'src/components/X.tsx', direction:'incoming'})` |\n| Stale / unused components | `dead_symbols({ path:'src/components' })` |\n| React / a11y / library API research | `web_search({ query })`, `web_fetch({ urls })` |\n| Component complexity hotspots | `measure({ path:'src/components' })` |\n| Verify a component's callers | `graph({action:'find_nodes', name_pattern})` → `neighbors` |\n\n## Visual Validation Protocol (post `test_run`)\n\n**Pre-flight (MANDATORY before any browser step):**\n1. Read `package.json` scripts — identify dev command (e.g. `dev`, `start`, `vite`)\n2. Determine default port (check script args, `vite.config.*`, or env)\n3. Check if dev server already running on port (attempt `http({ url:'http://localhost:<port>' })`)\n4. If NOT running, delegate to a helper or use `createAndRunTask` to start `npm run dev`\n in the background; wait for ready signal\n5. Capture the base URL\n\n**Validation:**\n6. `browser({ action: 'open', url, mode: 'ui' })` — render target component page\n7. `browser({ action: 'screenshot' })` + `browser({ action: 'read' })` — capture visual + DOM\n8. Keyboard-only navigation check: simulate Tab/Enter/Escape via `browser({ action: 'act', kind: 'type' })` —\n verify focus ring, activation, dismiss\n9. Compare against design tokens / Figma URL if supplied\n10. Fail fast if color contrast < 4.5:1 (WCAG AA) or focus indicator missing\n\nIf the pre-flight dev server cannot be started (e.g. sandbox), fall back to\n`compact` inspection of the component source + describe expected visual behavior.",Debugger:`**Read \`AGENTS.md\`** in the workspace root for project conventions and AI Kit protocol.
472
+ | \`browser-use\` | When the plan involves browser-based auth recovery, web scraping, or interacting with web applications that require login |`,Implementer:"**`AGENTS.md` is already in your context** — do NOT re-read it. Just load the `aikit` skill.\n\nLoad the `aikit` skill for full tool documentation, workflow chains, and session protocol.\n\n## Implementation Protocol\n\n1. **Understand scope** — Read the phase objective, identify target files\n2. **Write test first** (Red) — Create failing tests that define expected behavior\n3. **Implement** (Green) — Write minimal code to make tests pass\n4. **Refactor** — Clean up while keeping tests green\n5. **Validate** — `check`, `test_run`, `blast_radius`\n6. **Persist** — `remember` any decisions or patterns discovered\n\n## Rules\n\n- **Test-first always** — No implementation without a failing test\n- **Minimal code** — Don't build what isn't asked for\n- **Follow existing patterns** — Search AI Kit for conventions before creating new ones (`search(\"convention\")`, `knowledge({ action: \"list\", category: \"conventions\" })`)\n- **Never modify tests to make them pass** — Fix the implementation instead\n- **Run `check` after every change** — Catch errors early\n- **Loop-break** — If the same test still fails with the same error after 2 retries, STOP. Re-read the error from scratch, check your assumptions with `trace` or `symbol`, and try a fundamentally different approach. Do not attempt a 3rd retry in the same direction\n- **Think-first for complex tasks** — If a task involves 3+ files or non-obvious logic, outline your approach before writing code. Check existing patterns with `search` first. Design, then implement\n\n## Pre-Edit Checklist (before modifying any file)\n\n1. **Understand consumers** — `graph({action:'find_nodes', name_pattern:'<target>'})` → `graph({action:'neighbors', node_id, direction:'incoming'})`. See who calls/imports before changing a contract.\n2. **Compress, don't raw-read** — `file_summary` then `compact({path, query})` for the specific area. Only `read_file` when you need exact lines for `replace_string_in_file`.\n3. **Snapshot risky edits** — `checkpoint({action:'save', label:'pre-<scope>'})` before cross-cutting changes. `checkpoint({action:'restore', ...})` if `check`/`test_run` fails.\n4. **Estimate blast radius** — `blast_radius({changed_files:[...]})` BEFORE editing when changing a public/shared symbol; re-run AFTER to confirm actual impact matches.\n5. **TDD when tests exist** — write/extend the failing test first, then minimum code to pass.\n\n## Token Efficiency\n\n**Anti-patterns (NEVER do these):**\n- ❌ `read_file` after `compact`/`file_summary` already returned content — redundant\n- ❌ `read_file` in <50 line chunks — read 100+ lines at once\n- ❌ `run_in_terminal` for `grep`/`rg`/`Select-String` — use `search()` or `find()`\n- ❌ `run_in_terminal` for `git diff` — use `get_changed_files` or `blast_radius`\n- ❌ Re-reading `AGENTS.md`, skill files, or instruction files — already in context\n\n**Required patterns:**\n- `file_summary` → identify lines → `read_file`(exact edit range only)\n- `stash({ key: \"analysis-<topic>\", value: ... })` for intermediate results reused across turns\n- One `compact({path, query})` replaces multiple `read_file` calls for understanding\n\n## Post-Edit Checklist\n\n1. `check({})` — typecheck + lint must pass clean\n2. `test_run({})` — full suite or targeted pattern\n3. If Orchestrator passed a `task_id`: `evidence_map({action:'add', task_id, claim, status:'V', receipt:'file.ts#Lxx'})` for each verified contract/acceptance claim. Do NOT run the gate — Orchestrator owns it.\n\n## Structured Output (MANDATORY)\n\nEvery implementation response MUST end with a structured status block:\n\n```\n## Status: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED\n\n### Files Changed\n- path/to/file.ts — description of change\n\n### Tests\n- path/to/test.ts — N tests added/modified, all passing\n\n### Evidence\n- [claim]: [receipt/verification]\n\n### Blockers (if any)\n- Description of blocker\n```",Frontend:"**`AGENTS.md` is already in your context** — do NOT re-read it. Just load the `aikit` skill.\n\nLoad the `aikit` skill for full tool documentation, workflow chains, and session protocol.\n\n## Frontend Protocol\n\n0. **Check for DESIGN.md** — Look for `DESIGN.md` in the workspace root or `docs/` directory. If found, read it first — it defines the project's design system, tokens, colors, typography, spacing, and component conventions. Follow it as the authoritative design reference.\n1. **Search AI Kit** for existing component patterns and design tokens\n2. **Write component tests first** — Accessibility, rendering, interaction\n3. **Implement** — Follow existing component patterns, use design system tokens\n4. **Validate** — `check`, `test_run`, visual review\n5. **Persist** — `remember` new component patterns\n\n## Rules\n\n- **Accessibility first** — ARIA attributes, keyboard navigation, screen reader support\n- **Follow design system** — Use existing tokens, don't create one-off values\n- **Responsive by default** — Mobile-first, test all breakpoints\n- **Test-first** — Component tests before implementation\n\n## Frontend Exploration Mode\n\n| Need | Tool |\n|------|------|\n| Component dependency graph | `graph({action:'neighbors', node_id:'src/components/X.tsx', direction:'incoming'})` |\n| Stale / unused components | `dead_symbols({ path:'src/components' })` |\n| React / a11y / library API research | `web_search({ query })`, `web_fetch({ urls })` |\n| Component complexity hotspots | `measure({ path:'src/components' })` |\n| Verify a component's callers | `graph({action:'find_nodes', name_pattern})` → `neighbors` |\n\n## Visual Validation Protocol (post `test_run`)\n\n**Pre-flight (MANDATORY before any browser step):**\n1. Read `package.json` scripts — identify dev command (e.g. `dev`, `start`, `vite`)\n2. Determine default port (check script args, `vite.config.*`, or env)\n3. Check if dev server already running on port (attempt `http({ url:'http://localhost:<port>' })`)\n4. If NOT running, delegate to a helper or use `createAndRunTask` to start `npm run dev`\n in the background; wait for ready signal\n5. Capture the base URL\n\n**Validation:**\n6. `browser({ action: 'open', url, mode: 'ui' })` — render target component page\n7. `browser({ action: 'screenshot' })` + `browser({ action: 'read' })` — capture visual + DOM\n8. Keyboard-only navigation check: simulate Tab/Enter/Escape via `browser({ action: 'act', kind: 'type' })` —\n verify focus ring, activation, dismiss\n9. Compare against design tokens / Figma URL if supplied\n10. Fail fast if color contrast < 4.5:1 (WCAG AA) or focus indicator missing\n\nIf the pre-flight dev server cannot be started (e.g. sandbox), fall back to\n`compact` inspection of the component source + describe expected visual behavior.",Debugger:`**\`AGENTS.md\` is already in your context** — do NOT re-read it. Just load the \`aikit\` skill.
573
473
 
574
474
  Load the \`aikit\` skill for full tool documentation, workflow chains, and session protocol.
575
475
 
@@ -646,7 +546,7 @@ When debugging tool invocation issues, use the replay audit trail with traceId:
646
546
  - Replay log entries (\`.aikit-state/replay.jsonl\`)
647
547
  - In-memory telemetry (\`getToolTelemetry()\`)
648
548
  - Server middleware context (\`ctx.requestId\`)
649
- 4. Filter by traceId: search replay.jsonl for the specific UUID to trace the full invocation lifecycle`,Refactor:`**Read \`AGENTS.md\`** in the workspace root for project conventions and AI Kit protocol.
549
+ 4. Filter by traceId: search replay.jsonl for the specific UUID to trace the full invocation lifecycle`,Refactor:`**\`AGENTS.md\` is already in your context** do NOT re-read it. Just load the \`aikit\` skill.
650
550
 
651
551
  Load the \`aikit\` skill for full tool documentation, workflow chains, and session protocol.
652
552
 
@@ -705,7 +605,7 @@ For multi-approach uncertainty (A vs B), do NOT create lanes. Instead:
705
605
  | Skill | When to load |
706
606
  |-------|--------------|
707
607
  | \`lesson-learned\` | After completing a refactor — extract principles from the before/after diff |
708
- | \`typescript\` | When refactoring TypeScript code — type patterns, generics, utility types |`,Security:`**Read \`AGENTS.md\`** in the workspace root for project conventions and AI Kit protocol.
608
+ | \`typescript\` | When refactoring TypeScript code — type patterns, generics, utility types |`,Security:`**\`AGENTS.md\` is already in your context** do NOT re-read it. Just load the \`aikit\` skill.
709
609
 
710
610
  Load the \`aikit\` skill for full tool documentation, workflow chains, and session protocol.
711
611
 
@@ -757,7 +657,7 @@ Load the \`aikit\` skill for full tool documentation, workflow chains, and sessi
757
657
 
758
658
  ### Findings
759
659
  1. **[SEVERITY]** Title — Description, file:line, remediation
760
- \`\`\``,Documenter:`**Read \`AGENTS.md\`** in the workspace root for project conventions and AI Kit protocol.
660
+ \`\`\``,Documenter:`**\`AGENTS.md\` is already in your context** do NOT re-read it. Just load the \`aikit\` skill.
761
661
 
762
662
  Load the \`aikit\` skill for full tool documentation, workflow chains, and session protocol.
763
663
 
@@ -834,4 +734,4 @@ Rules adapted from *The Elements of Agent Style* (CC BY 4.0, Yue Zhao) and class
834
734
  | \`present\` | When presenting documentation previews, API tables, or architecture visuals to the user |
835
735
  | \`c4-architecture\` | When documenting system architecture — generate C4 Mermaid diagrams |
836
736
  | \`adr-skill\` | When documenting architecture decisions — create or update ADRs |
837
- | \`typescript\` | When documenting TypeScript APIs — type signatures, JSDoc patterns |`,Explorer:"**Read `AGENTS.md`** in the workspace root for project conventions and AI Kit protocol.\n\nLoad the `aikit` skill for full tool documentation, workflow chains, and session protocol.\n\n## MANDATORY FIRST ACTION\n\n1. Run `status({})` — if onboard shows ❌, run `onboard({ path: \".\" })` and wait for completion\n2. Note the **Onboard Directory** path from status output\n3. **Before exploring**, read relevant onboard artifacts using `compact({ path: \"<dir>/<file>\" })`:\n - `synthesis-guide.md` — project overview and architecture\n - `structure.md` — file tree and module purposes\n - `symbols.md` + `api-surface.md` — exported symbols\n - `dependencies.md` — import relationships\n - `code-map.md` — module graph\n4. Only use `find`, `symbol`, `trace`, `graph` for details NOT covered by artifacts\n\n## Flow Context Bootstrap\n\nWhen dispatched as a subagent within an active flow:\n\n1. **Withdraw context first** — before any search or file reads:\n ```\n knowledge({ action: 'withdraw', scope: 'flow', profile: 'researcher', budget: 6000 })\n ```\n This returns pre-analyzed context from prior agents.\n\n2. **Use returned context** — do NOT re-search or re-read files already covered\n3. **`read_file` ONLY** for exact lines needed for editing\n4. **Deposit new discoveries:**\n ```\n knowledge({ action: 'remember', scope: 'flow', title: '<discovery>', content: '<details>', category: 'context' })\n ```\n\n**Profile:** `researcher`\n\n## Exploration Protocol\n\n1. **AI Kit Recall** — `search` for existing analysis on this area\n2. **Discover** — Use `find`, `symbol`, `scope_map` to locate relevant files\n3. **Analyze** — Use `analyze({ aspect: \"structure\", ... })`, `analyze({ aspect: \"dependencies\", ... })`, `file_summary`\n4. **Compress** — Use `compact` for targeted file sections, `digest` when synthesizing 3+ sources, `stratum_card` for files you'll reference repeatedly\n5. **Map** — Build a picture of the subsystem: files, exports, dependencies, call chains\n6. **Report** — Structured findings with file paths and key observations\n\n## Exploration Modes\n\n| Goal | Tools |\n|------|-------|\n| Find files for a feature | `find`, `scope_map` |\n| Map a symbol's usage | `symbol`, `trace` |\n| Map module relationships | `graph({ action: 'neighbors' })` — import/export edges across packages |\n| Understand a package | `analyze({ aspect: \"structure\", ... })`, `analyze({ aspect: \"dependencies\", ... })`, `file_summary` |\n| Check impact of a change | `blast_radius` |\n\n## Output Format\n\n```markdown\n## Exploration: {topic}\n\n### Files Found\n- path/to/file.ts — purpose, key exports\n\n### Dependencies\n- package A → package B (via import)\n\n### Key Observations\n- Notable patterns, potential issues, architectural notes\n```\n\n## Rules\n\n- **Speed over depth** — Provide a useful map quickly, not an exhaustive analysis\n- **Read-only** — Never create, edit, or delete files\n- **Structured output** — Always return findings in the format above"};export{e as AGENT_BODIES};
737
+ | \`typescript\` | When documenting TypeScript APIs — type signatures, JSDoc patterns |`,Explorer:"**`AGENTS.md` is already in your context** do NOT re-read it. Just load the `aikit` skill.\n\nLoad the `aikit` skill for full tool documentation, workflow chains, and session protocol.\n\n## MANDATORY FIRST ACTION\n\n1. Run `status({})` — if onboard shows ❌, run `onboard({ path: \".\" })` and wait for completion\n2. Note the **Onboard Directory** path from status output\n3. **Before exploring**, read relevant onboard artifacts using `compact({ path: \"<dir>/<file>\" })`:\n - `synthesis-guide.md` — project overview and architecture\n - `structure.md` — file tree and module purposes\n - `symbols.md` + `api-surface.md` — exported symbols\n - `dependencies.md` — import relationships\n - `code-map.md` — module graph\n4. Only use `find`, `symbol`, `trace`, `graph` for details NOT covered by artifacts\n\n## Flow Context Bootstrap\n\nWhen dispatched as a subagent within an active flow:\n\n1. **Withdraw context first** — before any search or file reads:\n ```\n knowledge({ action: 'withdraw', scope: 'flow', profile: 'researcher', budget: 6000 })\n ```\n This returns pre-analyzed context from prior agents.\n\n2. **Use returned context** — do NOT re-search or re-read files already covered\n3. **`read_file` ONLY** for exact lines needed for editing\n4. **Deposit new discoveries:**\n ```\n knowledge({ action: 'remember', scope: 'flow', title: '<discovery>', content: '<details>', category: 'context' })\n ```\n\n**Profile:** `researcher`\n\n## Exploration Protocol\n\n1. **AI Kit Recall** — `search` for existing analysis on this area\n2. **Discover** — Use `find`, `symbol`, `scope_map` to locate relevant files\n3. **Analyze** — Use `analyze({ aspect: \"structure\", ... })`, `analyze({ aspect: \"dependencies\", ... })`, `file_summary`\n4. **Compress** — Use `compact` for targeted file sections, `digest` when synthesizing 3+ sources, `stratum_card` for files you'll reference repeatedly\n5. **Map** — Build a picture of the subsystem: files, exports, dependencies, call chains\n6. **Report** — Structured findings with file paths and key observations\n\n## Exploration Modes\n\n| Goal | Tools |\n|------|-------|\n| Find files for a feature | `find`, `scope_map` |\n| Map a symbol's usage | `symbol`, `trace` |\n| Map module relationships | `graph({ action: 'neighbors' })` — import/export edges across packages |\n| Understand a package | `analyze({ aspect: \"structure\", ... })`, `analyze({ aspect: \"dependencies\", ... })`, `file_summary` |\n| Check impact of a change | `blast_radius` |\n\n## Output Format\n\n```markdown\n## Exploration: {topic}\n\n### Files Found\n- path/to/file.ts — purpose, key exports\n\n### Dependencies\n- package A → package B (via import)\n\n### Key Observations\n- Notable patterns, potential issues, architectural notes\n```\n\n## Rules\n\n- **Speed over depth** — Provide a useful map quickly, not an exhaustive analysis\n- **Read-only** — Never create, edit, or delete files\n- **Structured output** — Always return findings in the format above"};export{e as AGENT_BODIES};
@@ -271,6 +271,20 @@ Auto-knowledge captures tool responses as shared context between agents. **Befor
271
271
 
272
272
  **\`read_file\` is ONLY acceptable when you need exact line content FOR EDITING (before \`replace_string_in_file\`).**
273
273
 
274
+ ## compact() Failure Recovery
275
+
276
+ If \`compact()\` returns <200 bytes or empty content, the file is NOT indexed. Follow this fallback:
277
+
278
+ 1. **Do NOT retry** compact on the same file — it will fail again
279
+ 2. **Use \`read_file\`** with a LARGE range (e.g., \`startLine: 1, endLine: 9999\`) — NEVER chunk into small ranges
280
+ 3. **Use \`stash()\`** to cache findings from unindexed files — context pressure causes re-reads
281
+ 4. **Check \`status()\`** to see which paths are indexed before calling compact
282
+
283
+ **Anti-patterns to avoid:**
284
+ - Retrying compact 3x on same unindexed file (wastes 3 tool calls)
285
+ - Falling back to read_file in small chunks (10-50 lines) — each chunk costs ~3K prompt tokens in overhead
286
+ - Re-reading the same file later because you forgot the content — use stash() to cache
287
+
274
288
  ---
275
289
 
276
290
  ## Context Efficiency (MANDATORY)
@@ -810,7 +824,9 @@ The Orchestrator uses **multi-model decision analysis** to resolve non-trivial t
810
824
 
811
825
  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
826
 
813
- **IMPORTANT: Include this instruction in every researcher dispatch prompt: "You are running as a subagent. Do NOT use the \`present\` tool — return all analysis as plain text."**
827
+ **IMPORTANT: Include these instructions in every researcher dispatch prompt:**
828
+ - "You are running as a subagent. Do NOT use the \`present\` tool — return all analysis as plain text."
829
+ - "Keep your analysis to ≤ 500 words. Structure: (1) Recommendation, (2) Key evidence, (3) Critical risks. No preamble."
814
830
 
815
831
  | Variant | Thinking Style | Lens |
816
832
  |---------|---------------|------|
@@ -821,7 +837,10 @@ Dispatch ALL available Researcher variants **in parallel** via \`runSubagent\`
821
837
 
822
838
  ### Phase 2 — Peer Review (parallel)
823
839
 
824
- After all researchers return, **anonymize** their responses as Perspective A / B / C / D (strip agent names). Then dispatch a **second parallel batch** of 4 review sub-agents via \`runSubagent\`:
840
+ After all researchers return:
841
+ 1. **Compress** each response to its core argument (≤ 200 words) — \`stash\` full responses if needed later
842
+ 2. **Anonymize** as Perspective A / B / C / D (strip agent names)
843
+ 3. Dispatch **second parallel batch** of review sub-agents with compressed versions via \`runSubagent\`:
825
844
 
826
845
  **Peer Review Prompt Template:**
827
846
  \`\`\`
@@ -888,7 +907,7 @@ Trigger the decision protocol when there is an **unresolved non-trivial technica
888
907
 
889
908
  - **\`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
909
  - **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**, minimum 4 variants
910
+ - Always launch in **parallel** 4 variants for Critical, 2 (Alpha + Delta) for Standard per tier gate
892
911
  - Use exact case-sensitive agent names — never rename or alias
893
912
  - **Anonymize** researcher outputs before peer review (A/B/C/D, not agent names)
894
913
  - Peer review is a SEPARATE parallel batch — never skip it
@@ -897,12 +916,16 @@ Trigger the decision protocol when there is an **unresolved non-trivial technica
897
916
  - **Produce an ADR** after every decision resolution
898
917
  - \`knowledge({ action: "remember", ... })\` the decision for future recall
899
918
 
900
- ## Shortcut: Floor-Tier Decisions
919
+ ## Tier Shortcuts
920
+
921
+ **Standard tier** (default for multi-file tasks):
922
+ - Phase 1: 2 researchers only (Alpha + Delta) — skip Beta + Gamma
923
+ - Skip Phase 2 (peer review) — synthesize directly from 2 research outputs
924
+ - Verdict format required but can be concise
925
+ - ADR optional (\`knowledge({ action: "remember", ... })\` at minimum)
901
926
 
902
- For decisions classified as **Floor tier** (blast_radius ≤ 2, single concern):
903
- - Skip Phase 2 (peer review)synthesis directly from Phase 1
904
- - Verdict format still required but can be abbreviated
905
- - ADR is optional (use \`knowledge({ action: "remember", ... })\` at minimum)
927
+ **Floor tier** (blast_radius ≤ 2, single concern):
928
+ - Skip the Decision Protocol entirelydecide inline or with 1 researcher max
906
929
  `,"forge-protocol":`# FORGE Protocol — Quality Overlay
907
930
 
908
931
  > Follow the FORGE (Fact-Oriented Reasoning with Graduated Evidence) protocol for all code generation and modification tasks.
@@ -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
 
@@ -1511,6 +1511,32 @@ metadata:
1511
1511
 
1512
1512
  # C4 Architecture Documentation
1513
1513
 
1514
+ ## Quick Reference
1515
+
1516
+ **Output formats:** Mermaid (markdown) for simple diagrams | HTML viewer for interactive diagrams (>5 components)
1517
+
1518
+ **HTML viewer - data injection API:**
1519
+ - Copy template: \`cp assets/c4-viewer.html docs/architecture/interactive/{name}.html\`
1520
+ - Create data JSON matching this shape:
1521
+ \`\`\`json
1522
+ {
1523
+ "title": "System Name",
1524
+ "elements": [
1525
+ { "id": "unique-id", "label": "Display Name", "type": "system|container|component|person|database|queue|external",
1526
+ "technology": "optional", "description": "optional", "tags": ["optional"], "parentId": "optional-parent-id" }
1527
+ ],
1528
+ "relationships": [
1529
+ { "sourceId": "from-id", "targetId": "to-id", "label": "optional", "technology": "optional" }
1530
+ ]
1531
+ }
1532
+ \`\`\`
1533
+ - Inject data: \`node scripts/inject-viewer.mjs --template assets/c4-viewer.html --data {data.json} --out {output.html}\`
1534
+ - The script replaces content of \`<script type="application/json" id="diagram-data">\` in the template
1535
+
1536
+ **NEVER \`read_file\` on \`assets/c4-viewer.html\`** - it's a 1.8MB minified React/ReactFlow bundle. Use the injection API above.
1537
+
1538
+ **Full schema:** [references/c4.schema.json](references/c4.schema.json) | **Design patterns:** [references/advanced-patterns.md](references/advanced-patterns.md) | **Common mistakes:** [references/common-mistakes.md](references/common-mistakes.md)
1539
+
1514
1540
  Generate software architecture documentation using C4 model diagrams in Mermaid syntax.
1515
1541
 
1516
1542
  ## Workflow
@@ -1979,6 +2005,8 @@ Write architecture documentation to \`docs/architecture/\` with naming conventio
1979
2005
 
1980
2006
  AI Kit ships a pre-built \`c4-viewer.html\` that handles ALL rendering, layout (ELK.js), styling, and interaction. The LLM's only job is to produce valid JSON matching [references/c4.schema.json](references/c4.schema.json). **NEVER generate HTML for architecture diagrams** — inject JSON into the shipped viewer.
1981
2007
 
2008
+ > **WARNING**: NEVER \`read_file\` on \`assets/c4-viewer.html\` - it is a 1.8MB minified bundle. The injection API below is all you need.
2009
+
1982
2010
  ### Usage
1983
2011
 
1984
2012
  1. Generate JSON matching [references/c4.schema.json](references/c4.schema.json)
@@ -2041,7 +2069,24 @@ present({
2041
2069
  }
2042
2070
  \`\`\`
2043
2071
 
2044
- The viewer expects a JSON object matching [references/c4.schema.json](references/c4.schema.json).
2072
+ The viewer expects this JSON shape (full schema: [references/c4.schema.json](references/c4.schema.json)):
2073
+
2074
+ | Field | Type | Required | Description |
2075
+ |-------|------|----------|-------------|
2076
+ | \`title\` | string | Yes | Diagram title |
2077
+ | \`elements[]\` | array | Yes | C4 elements (systems, containers, components, people) |
2078
+ | \`elements[].id\` | string | Yes | Unique identifier |
2079
+ | \`elements[].label\` | string | Yes | Display name |
2080
+ | \`elements[].type\` | string | Yes | \`system|container|component|person|database|queue|external\` |
2081
+ | \`elements[].technology\` | string | No | Technology stack |
2082
+ | \`elements[].description\` | string | No | Brief description |
2083
+ | \`elements[].tags\` | string[] | No | Categorization tags |
2084
+ | \`elements[].parentId\` | string | No | Nesting - references another element's id |
2085
+ | \`relationships[]\` | array | Yes | Connections between elements |
2086
+ | \`relationships[].sourceId\` | string | Yes | Source element id |
2087
+ | \`relationships[].targetId\` | string | Yes | Target element id |
2088
+ | \`relationships[].label\` | string | No | Relationship description |
2089
+ | \`relationships[].technology\` | string | No | Protocol/technology used |
2045
2090
 
2046
2091
  **Node types:** person, system, container, component, database, queue, external, boundary, deploymentNode
2047
2092
 
@@ -2142,6 +2142,38 @@ metadata:
2142
2142
 
2143
2143
  Manage the \`docs/\` folder as a single source of truth for project documentation. This skill runs during the mandatory \`_docs-sync\` epilogue step of every flow, ensuring documentation stays in sync with code changes.
2144
2144
 
2145
+ ## Quick Reference
2146
+
2147
+ **Purpose:** Manage \`docs/\` folder as living documentation. Runs during \`_docs-sync\` epilogue of every flow.
2148
+
2149
+ **When triggered:** Automatically after every flow completion (epilogue step). Also manually for fresh generation.
2150
+
2151
+ **Four scenarios:**
2152
+ 1. **Fresh Generation** — no \`docs/\` exists → full 7-phase pipeline
2153
+ 2. **Update Mode** — \`docs/\` exists with standard structure → incremental update
2154
+ 3. **Migration Mode** — \`docs/\` exists with non-standard structure → migrate first
2155
+ 4. **Epilogue Sync** — during flow \`_docs-sync\` step → combines with 1-3
2156
+
2157
+ **Tour viewer — data injection API:**
2158
+ - Copy template: \`cp assets/tour-viewer.html docs/{name}-tour.html\`
2159
+ - Create tour JSON matching this shape:
2160
+ \`\`\`json
2161
+ {
2162
+ "title": "Tour Title",
2163
+ "steps": [
2164
+ { "title": "Step Name", "file": "src/path.ts", "line": 42, "description": "What to notice here", "highlights": ["symbol1"] }
2165
+ ]
2166
+ }
2167
+ \`\`\`
2168
+ - Inject data: \`node scripts/inject-viewer.mjs --template assets/tour-viewer.html --data {data.json} --out {output.html}\`
2169
+ - The script replaces content of \`<script type="application/json" id="diagram-data">\` in the template
2170
+
2171
+ **NEVER \`read_file\` on \`assets/tour-viewer.html\`** — it's a large minified React bundle. Use the injection API above.
2172
+
2173
+ **Full tour schema:** [references/tour.schema.json](references/tour.schema.json) | **Code tour patterns:** [references/code-tour-patterns.md](references/code-tour-patterns.md) | **Staleness config:** [references/staleness-config.md](references/staleness-config.md)
2174
+
2175
+ **Diátaxis framework:** Tutorials (learning+doing) · How-to (working+doing) · Reference (working+understanding) · Explanation (learning+understanding). See [references/diataxis-reference.md](references/diataxis-reference.md).
2176
+
2145
2177
  ## Principles
2146
2178
 
2147
2179
  1. **Living, not legacy** — Documentation is updated as code changes, never as a separate "docs sprint"
@@ -2612,6 +2644,8 @@ This phase uses the **c4-architecture skill** to produce interactive, data-drive
2612
2644
 
2613
2645
  Tour generation Phase 4c produces interactive tour viewers. Use the docs skill's \`assets/tour-viewer.html\` template:
2614
2646
 
2647
+ > **WARNING**: NEVER \`read_file\` on \`assets/tour-viewer.html\` — it is a large minified bundle. Use the injection script above.
2648
+
2615
2649
  \`\`\`bash
2616
2650
  node scripts/inject-viewer.mjs --template assets/tour-viewer.html --data <tour-data.json> --out docs/tours/interactive/<tour-name>.html
2617
2651
  \`\`\`
@@ -14,6 +14,26 @@ metadata:
14
14
 
15
15
  > Comprehensive frontend design system — visual design thinking, typography, color, layout, motion, accessibility, performance, and anti-pattern detection. Synthesized from Anthropic's frontend-design skill, Vercel Web Interface Guidelines, and Impeccable design patterns.
16
16
 
17
+ ## Quick Reference
18
+
19
+ **Purpose:** Comprehensive design guidance — typography, color, layout, motion, accessibility, performance, anti-pattern detection.
20
+
21
+ **Mandatory** for the Frontend agent on every task. Also for any UI, styling, responsive, or design work.
22
+
23
+ **Context checklist** (infer from codebase if not specified):
24
+ Design system? | Brand guidelines? | Accessibility level (AA default)? | Breakpoints? | Motion budget? | Dark mode? | Target platforms?
25
+
26
+ **Design cycle:** Understand → Explore → Evaluate → Refine
27
+
28
+ **Key principles:**
29
+ - Typography: system font stack, modular scale, max 2 families
30
+ - Color: semantic tokens (\`--color-success\`, not \`--green\`), 4.5:1+ contrast
31
+ - Layout: CSS Grid for 2D, Flexbox for 1D, \`min()\`/\`clamp()\` for fluid sizing
32
+ - Motion: \`prefers-reduced-motion\`, \`will-change\` sparingly, 200-300ms for UI
33
+ - Accessibility: semantic HTML first, ARIA only when needed, focus visible, skip links
34
+
35
+ **Anti-patterns to catch:** z-index wars, magic numbers, \`!important\` chains, px-only sizing, color-only status indicators.
36
+
17
37
  ## When to Use
18
38
 
19
39
  **MANDATORY** for the Frontend agent on every task. Also use when:
@@ -13,6 +13,37 @@ argument-hint: "Content to present — data, analysis results, status report, co
13
13
 
14
14
  # Present Tool — Rich Interactive Dashboards
15
15
 
16
+ ## Quick Reference
17
+
18
+ **Two formats:**
19
+ - \`html\` — in-chat UIResource (display-only: tables, charts, reports). DEFAULT choice.
20
+ - \`browser\` — local URL in system browser (when you need user interaction back, or in CLI mode).
21
+
22
+ **Content blocks** (pass as \`content\` array of \`{ type, title?, value }\`):
23
+ | Type | Value shape | Use for |
24
+ |------|-------------|---------|
25
+ | \`markdown\` | string | Prose, headings, code — **never tables** |
26
+ | \`table\` | \`Record[]\` or \`{headers,rows}\` | **All tabular data** (NEVER put tables in markdown blocks) |
27
+ | \`chart\` | \`{chartType,data,xKey,yKeys}\` | Bar, line, area, pie, radar, scatter |
28
+ | \`metrics\` | \`[{label,value,trend?,status?}]\` | KPI cards |
29
+ | \`cards\` | \`[{title,body?,badge?,status?}]\` | Info cards |
30
+ | \`mermaid\` | string | Diagrams |
31
+ | \`tree\` | \`{name,children?}\` | Hierarchical data |
32
+ | \`timeline\` | \`[{title,description?,timestamp?,status?}]\` | Event sequences |
33
+ | \`checklist\` | \`[{label,checked}]\` | Todo/check lists |
34
+ | \`code\` | string | Code blocks |
35
+
36
+ **Actions** (interactive buttons/selects, mainly for \`browser\` mode):
37
+ \`\`\`json
38
+ { "actions": [{ "type": "button", "id": "approve", "label": "Approve", "variant": "primary" }] }
39
+ \`\`\`
40
+
41
+ **Anti-patterns:**
42
+ - ❌ Tables inside \`markdown\` blocks → renders as raw pipe text
43
+ - ❌ \`html\` format in CLI mode → invisible (use \`browser\`)
44
+ - ❌ Unicode escapes in \`title\` param (\`\\u2014\`) → literal text (use actual — character)
45
+ - ❌ Chart.js format (\`{labels,datasets}\`) → use \`{chartType,data,xKey,yKeys}\`
46
+
16
47
  The \`present\` tool renders structured content as a professional dark-themed dashboard. It supports two output modes:
17
48
 
18
49
  - **\`html\`** — Renders an embedded UIResource for MCP-UI hosts (in-chat). Best for display-only content.
@@ -1313,6 +1313,26 @@ metadata:
1313
1313
 
1314
1314
  Creates comprehensive handoff documents that enable fresh AI agents to seamlessly continue work with zero ambiguity. Solves the long-running agent context exhaustion problem.
1315
1315
 
1316
+ ## Quick Reference
1317
+
1318
+ **Purpose:** Create handoff documents for seamless AI session transfers. Solves context exhaustion — fresh agents continue with zero ambiguity.
1319
+
1320
+ **Two modes:**
1321
+ - **CREATE** — Save current state when: user requests, context filling up, milestone completed, session ending
1322
+ - **RESUME** — Load prior state when: user says "continue", "resume", or references existing handoff
1323
+
1324
+ **Dual storage** (every handoff creates both):
1325
+ 1. **Full file** → \`.aikit-state/handoffs/{flow-slug}/<timestamp>-<slug>.md\` (browsable, gitignored)
1326
+ 2. **Compact entry** → \`knowledge({ action: "remember", scope: "flow", category: "session", title: "Session Handoff: <slug>" })\` (~1-2K chars, for \`withdraw\`)
1327
+
1328
+ **CREATE workflow:** Gather state → Fill template (metadata, state summary, codebase understanding, work completed, pending work, resume context) → Save dual format → Present summary
1329
+
1330
+ **RESUME workflow:** \`withdraw({ scope: "flow", profile: "implementer" })\` → Read compact entry → If need full context, read file from \`.aikit-state/handoffs/\` → Verify state → Continue work
1331
+
1332
+ **Template sections:** Session Metadata | Current State | Codebase Understanding | Work Completed | Pending Work | Resume Context | Environment State | Related Resources
1333
+
1334
+ **Proactive trigger:** After 5+ file edits, complex debugging, or major decisions → suggest handoff.
1335
+
1316
1336
  ## Mode Selection
1317
1337
 
1318
1338
  Determine which mode applies: