@vpxa/aikit 0.1.15 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/packages/cli/dist/commands/init/user.js +1 -1
- package/packages/server/dist/output-schemas.d.ts +1 -0
- package/packages/server/dist/output-schemas.js +1 -1
- package/packages/server/dist/structured-content-guard.d.ts +4 -2
- package/packages/server/dist/structured-content-guard.js +1 -1
- package/scaffold/definitions/agents.mjs +12 -5
- package/scaffold/definitions/bodies.mjs +9 -3
- package/scaffold/definitions/protocols.mjs +37 -10
- package/scaffold/general/agents/Architect-Reviewer-Alpha.agent.md +3 -2
- package/scaffold/general/agents/Architect-Reviewer-Beta.agent.md +3 -2
- package/scaffold/general/agents/Documenter.agent.md +8 -0
- package/scaffold/general/agents/Orchestrator.agent.md +4 -2
- package/scaffold/general/agents/Planner.agent.md +4 -1
- package/scaffold/general/agents/Refactor.agent.md +6 -0
- package/scaffold/general/agents/Researcher-Alpha.agent.md +4 -3
- package/scaffold/general/agents/Researcher-Beta.agent.md +4 -3
- package/scaffold/general/agents/Researcher-Delta.agent.md +4 -3
- package/scaffold/general/agents/Researcher-Gamma.agent.md +4 -3
- package/scaffold/general/agents/_shared/code-agent-base.md +31 -6
- package/scaffold/general/agents/_shared/researcher-base.md +6 -4
- package/scaffold/general/skills/aikit/SKILL.md +16 -9
- package/scaffold/general/skills/present/SKILL.md +4 -1
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{FLOW_DIRS as e,MCP_SERVER_ENTRY as t,SERVER_NAME as n,SKILL_NAMES as r,VSCODE_SETTINGS as i}from"./constants.js";import{buildAgentsMd as a,buildCopilotInstructions as o}from"./templates.js";import{smartCopySubdir as s}from"./scaffold.js";import{existsSync as c,mkdirSync as l,readFileSync as u,unlinkSync as d,writeFileSync as f}from"node:fs";import{dirname as p,resolve as m}from"node:path";import{fileURLToPath as h}from"node:url";import{getGlobalDataDir as g,saveRegistry as _}from"../../../../core/dist/index.js";import{homedir as v}from"node:os";function y(){let e=v(),t=process.platform,n=[],r=m(e,`.copilot`),i=m(r,`instructions`),a=m(e,`.claude`),o=m(e,`.cursor`),s=m(e,`.windsurf`);if(t===`win32`){let t=process.env.APPDATA??m(e,`AppData`,`Roaming`);n.push({ide:`VS Code`,configDir:m(t,`Code`,`User`),mcpConfigPath:m(t,`Code`,`User`,`mcp.json`),globalScaffoldRoot:r,instructionsRoot:i},{ide:`VS Code Insiders`,configDir:m(t,`Code - Insiders`,`User`),mcpConfigPath:m(t,`Code - Insiders`,`User`,`mcp.json`),globalScaffoldRoot:r,instructionsRoot:i},{ide:`VSCodium`,configDir:m(t,`VSCodium`,`User`),mcpConfigPath:m(t,`VSCodium`,`User`,`mcp.json`),globalScaffoldRoot:r,instructionsRoot:i},{ide:`Cursor`,configDir:m(t,`Cursor`,`User`),mcpConfigPath:m(t,`Cursor`,`User`,`mcp.json`),globalScaffoldRoot:o,instructionsRoot:null},{ide:`Cursor Nightly`,configDir:m(t,`Cursor Nightly`,`User`),mcpConfigPath:m(t,`Cursor Nightly`,`User`,`mcp.json`),globalScaffoldRoot:o,instructionsRoot:null},{ide:`Windsurf`,configDir:m(t,`Windsurf`,`User`),mcpConfigPath:m(t,`Windsurf`,`User`,`mcp.json`),globalScaffoldRoot:s,instructionsRoot:null})}else if(t===`darwin`){let t=m(e,`Library`,`Application Support`);n.push({ide:`VS Code`,configDir:m(t,`Code`,`User`),mcpConfigPath:m(t,`Code`,`User`,`mcp.json`),globalScaffoldRoot:r,instructionsRoot:i},{ide:`VS Code Insiders`,configDir:m(t,`Code - Insiders`,`User`),mcpConfigPath:m(t,`Code - Insiders`,`User`,`mcp.json`),globalScaffoldRoot:r,instructionsRoot:i},{ide:`VSCodium`,configDir:m(t,`VSCodium`,`User`),mcpConfigPath:m(t,`VSCodium`,`User`,`mcp.json`),globalScaffoldRoot:r,instructionsRoot:i},{ide:`Cursor`,configDir:m(t,`Cursor`,`User`),mcpConfigPath:m(t,`Cursor`,`User`,`mcp.json`),globalScaffoldRoot:o,instructionsRoot:null},{ide:`Cursor Nightly`,configDir:m(t,`Cursor Nightly`,`User`),mcpConfigPath:m(t,`Cursor Nightly`,`User`,`mcp.json`),globalScaffoldRoot:o,instructionsRoot:null},{ide:`Windsurf`,configDir:m(t,`Windsurf`,`User`),mcpConfigPath:m(t,`Windsurf`,`User`,`mcp.json`),globalScaffoldRoot:s,instructionsRoot:null})}else{let t=process.env.XDG_CONFIG_HOME??m(e,`.config`);n.push({ide:`VS Code`,configDir:m(t,`Code`,`User`),mcpConfigPath:m(t,`Code`,`User`,`mcp.json`),globalScaffoldRoot:r,instructionsRoot:i},{ide:`VS Code Insiders`,configDir:m(t,`Code - Insiders`,`User`),mcpConfigPath:m(t,`Code - Insiders`,`User`,`mcp.json`),globalScaffoldRoot:r,instructionsRoot:i},{ide:`VSCodium`,configDir:m(t,`VSCodium`,`User`),mcpConfigPath:m(t,`VSCodium`,`User`,`mcp.json`),globalScaffoldRoot:r,instructionsRoot:i},{ide:`Cursor`,configDir:m(t,`Cursor`,`User`),mcpConfigPath:m(t,`Cursor`,`User`,`mcp.json`),globalScaffoldRoot:o,instructionsRoot:null},{ide:`Cursor Nightly`,configDir:m(t,`Cursor Nightly`,`User`),mcpConfigPath:m(t,`Cursor Nightly`,`User`,`mcp.json`),globalScaffoldRoot:o,instructionsRoot:null},{ide:`Windsurf`,configDir:m(t,`Windsurf`,`User`),mcpConfigPath:m(t,`Windsurf`,`User`,`mcp.json`),globalScaffoldRoot:s,instructionsRoot:null})}return n.push({ide:`Claude Code`,configDir:m(e,`.claude`),mcpConfigPath:m(e,`.claude`,`mcp.json`),globalScaffoldRoot:a,instructionsRoot:null}),n.filter(e=>c(e.configDir))}function b(e,n,r=!1){let{mcpConfigPath:i,configDir:a}=e,o={...t},s={};if(c(i)){try{let e=u(i,`utf-8`);s=JSON.parse(e)}catch{let e=`${i}.bak`;f(e,u(i,`utf-8`),`utf-8`),console.log(` Backed up invalid ${i} to ${e}`),s={}}if((s.servers??s.mcpServers??{})[n]&&!r){console.log(` ${e.ide}: ${n} already configured (use --force to update)`);return}}let d=new Set([`VS Code`,`VS Code Insiders`,`VSCodium`,`Windsurf`]).has(e.ide)?`servers`:`mcpServers`,p=s[d]??{};p[n]=o,s[d]=p,l(a,{recursive:!0}),f(i,`${JSON.stringify(s,null,2)}\n`,`utf-8`),console.log(` ${e.ide}: configured ${n} in ${i}`)}const x=new Set([`VS Code`,`VS Code Insiders`,`VSCodium`]);function S(e,t=!1){if(!x.has(e.ide))return;let n=m(e.configDir,`settings.json`),r={};if(c(n))try{let e=u(n,`utf-8`);r=JSON.parse(e)}catch{console.log(` ${e.ide}: skipped settings.json (invalid JSON)`);return}let a=!1;for(let[e,n]of Object.entries(i))if(typeof n==`object`&&n){let t=typeof r[e]==`object`&&r[e]!==null?r[e]:{},i={...t,...n};JSON.stringify(i)!==JSON.stringify(t)&&(r[e]=i,a=!0)}else (t||!(e in r))&&(r[e]=n,a=!0);a&&(f(n,`${JSON.stringify(r,null,2)}\n`,`utf-8`),console.log(` ${e.ide}: updated settings.json`))}function C(t,n,i,u,d=!1){let p=new Set;for(let e of n)e.globalScaffoldRoot&&p.add(e.globalScaffoldRoot);if(p.size===0){console.log(` No IDEs with global scaffold support detected.`);return}let h=m(t,`scaffold`,`general`);for(let n of p){s(h,n,`agents`,u,d),s(h,n,`prompts`,u,d);let i=0;for(let e of r)c(m(h,`skills`,e))&&(s(h,n,`skills/${e}`,u,d),i++);for(let r of e){let e=m(t,`scaffold`,`flows`,r);c(m(e,`skills`))&&s(e,m(n,`flows`,r),`skills`,u,d)}console.log(` ${n}: scaffold updated (${i} skills)`)}let g=new Set,_=o(`aikit`,i),v=a(`aikit`,i);for(let e of n){if(!e.globalScaffoldRoot)continue;let t=e.globalScaffoldRoot;if(e.ide===`Claude Code`){let e=m(t,`CLAUDE.md`);f(e,`${_}\n---\n\n${v}`,`utf-8`),g.add(e)}else if(e.ide===`VS Code`||e.ide===`VS Code Insiders`||e.ide===`VSCodium`){let n=e.instructionsRoot??t;l(n,{recursive:!0});let r=m(n,`copilot-instructions.md`);g.has(r)||(f(r,`---\napplyTo: "**"\n---\n\n${_}\n---\n\n${v}`,`utf-8`),g.add(r))}else if(e.ide===`Cursor`||e.ide===`Cursor Nightly`){let e=m(t,`rules`);l(e,{recursive:!0});let n=m(e,`aikit.mdc`);g.has(n)||(f(n,`${_}\n---\n\n${v}`,`utf-8`),g.add(n))}else if(e.ide===`Windsurf`){let e=m(t,`rules`);l(e,{recursive:!0});let n=m(e,`aikit.md`);g.has(n)||(f(n,`${_}\n---\n\n${v}`,`utf-8`),g.add(n))}}g.size>0&&console.log(` Instruction files: ${[...g].join(`, `)}`)}function w(e){let t=[];for(let n of e){if(!n.globalScaffoldRoot)continue;let e=n.globalScaffoldRoot;if(n.ide===`VS Code`||n.ide===`VS Code Insiders`||n.ide===`VSCodium`){let r=n.instructionsRoot??e;t.push(m(r,`kb.instructions.md`)),t.push(m(r,`aikit.instructions.md`))}else n.ide===`Cursor`||n.ide===`Cursor Nightly`?t.push(m(e,`rules`,`kb.mdc`)):n.ide===`Windsurf`&&t.push(m(e,`rules`,`kb.md`))}for(let e of t)c(e)&&(d(e),console.log(` Removed legacy file: ${e}`))}async function T(e){let t=n,r=m(p(h(import.meta.url)),`..`,`..`,`..`,`..`,`..`,`package.json`),i=JSON.parse(u(r,`utf-8`)).version;console.log(`Initializing @vpxa/aikit v${i}...\n`);let a=g();l(a,{recursive:!0}),console.log(` Global data store: ${a}`),_({version:1,workspaces:{}}),console.log(` Created registry.json`);let o=y();if(o.length===0)console.log(`
|
|
1
|
+
import{FLOW_DIRS as e,MCP_SERVER_ENTRY as t,SERVER_NAME as n,SKILL_NAMES as r,VSCODE_SETTINGS as i}from"./constants.js";import{buildAgentsMd as a,buildCopilotInstructions as o}from"./templates.js";import{smartCopySubdir as s}from"./scaffold.js";import{existsSync as c,mkdirSync as l,readFileSync as u,unlinkSync as d,writeFileSync as f}from"node:fs";import{dirname as p,resolve as m}from"node:path";import{fileURLToPath as h}from"node:url";import{getGlobalDataDir as g,saveRegistry as _}from"../../../../core/dist/index.js";import{homedir as v}from"node:os";function y(){let e=v(),t=process.platform,n=[],r=m(e,`.copilot`),i=m(r,`instructions`),a=m(e,`.claude`),o=m(e,`.cursor`),s=m(e,`.windsurf`);if(t===`win32`){let t=process.env.APPDATA??m(e,`AppData`,`Roaming`);n.push({ide:`VS Code`,configDir:m(t,`Code`,`User`),mcpConfigPath:m(t,`Code`,`User`,`mcp.json`),globalScaffoldRoot:r,instructionsRoot:i},{ide:`VS Code Insiders`,configDir:m(t,`Code - Insiders`,`User`),mcpConfigPath:m(t,`Code - Insiders`,`User`,`mcp.json`),globalScaffoldRoot:r,instructionsRoot:i},{ide:`VSCodium`,configDir:m(t,`VSCodium`,`User`),mcpConfigPath:m(t,`VSCodium`,`User`,`mcp.json`),globalScaffoldRoot:r,instructionsRoot:i},{ide:`Cursor`,configDir:m(t,`Cursor`,`User`),mcpConfigPath:m(t,`Cursor`,`User`,`mcp.json`),globalScaffoldRoot:o,instructionsRoot:null},{ide:`Cursor Nightly`,configDir:m(t,`Cursor Nightly`,`User`),mcpConfigPath:m(t,`Cursor Nightly`,`User`,`mcp.json`),globalScaffoldRoot:o,instructionsRoot:null},{ide:`Windsurf`,configDir:m(t,`Windsurf`,`User`),mcpConfigPath:m(t,`Windsurf`,`User`,`mcp.json`),globalScaffoldRoot:s,instructionsRoot:null})}else if(t===`darwin`){let t=m(e,`Library`,`Application Support`);n.push({ide:`VS Code`,configDir:m(t,`Code`,`User`),mcpConfigPath:m(t,`Code`,`User`,`mcp.json`),globalScaffoldRoot:r,instructionsRoot:i},{ide:`VS Code Insiders`,configDir:m(t,`Code - Insiders`,`User`),mcpConfigPath:m(t,`Code - Insiders`,`User`,`mcp.json`),globalScaffoldRoot:r,instructionsRoot:i},{ide:`VSCodium`,configDir:m(t,`VSCodium`,`User`),mcpConfigPath:m(t,`VSCodium`,`User`,`mcp.json`),globalScaffoldRoot:r,instructionsRoot:i},{ide:`Cursor`,configDir:m(t,`Cursor`,`User`),mcpConfigPath:m(t,`Cursor`,`User`,`mcp.json`),globalScaffoldRoot:o,instructionsRoot:null},{ide:`Cursor Nightly`,configDir:m(t,`Cursor Nightly`,`User`),mcpConfigPath:m(t,`Cursor Nightly`,`User`,`mcp.json`),globalScaffoldRoot:o,instructionsRoot:null},{ide:`Windsurf`,configDir:m(t,`Windsurf`,`User`),mcpConfigPath:m(t,`Windsurf`,`User`,`mcp.json`),globalScaffoldRoot:s,instructionsRoot:null})}else{let t=process.env.XDG_CONFIG_HOME??m(e,`.config`);n.push({ide:`VS Code`,configDir:m(t,`Code`,`User`),mcpConfigPath:m(t,`Code`,`User`,`mcp.json`),globalScaffoldRoot:r,instructionsRoot:i},{ide:`VS Code Insiders`,configDir:m(t,`Code - Insiders`,`User`),mcpConfigPath:m(t,`Code - Insiders`,`User`,`mcp.json`),globalScaffoldRoot:r,instructionsRoot:i},{ide:`VSCodium`,configDir:m(t,`VSCodium`,`User`),mcpConfigPath:m(t,`VSCodium`,`User`,`mcp.json`),globalScaffoldRoot:r,instructionsRoot:i},{ide:`Cursor`,configDir:m(t,`Cursor`,`User`),mcpConfigPath:m(t,`Cursor`,`User`,`mcp.json`),globalScaffoldRoot:o,instructionsRoot:null},{ide:`Cursor Nightly`,configDir:m(t,`Cursor Nightly`,`User`),mcpConfigPath:m(t,`Cursor Nightly`,`User`,`mcp.json`),globalScaffoldRoot:o,instructionsRoot:null},{ide:`Windsurf`,configDir:m(t,`Windsurf`,`User`),mcpConfigPath:m(t,`Windsurf`,`User`,`mcp.json`),globalScaffoldRoot:s,instructionsRoot:null})}return n.push({ide:`Claude Code`,configDir:m(e,`.claude`),mcpConfigPath:m(e,`.claude`,`mcp.json`),globalScaffoldRoot:a,instructionsRoot:null}),n.push({ide:`Copilot CLI`,configDir:r,mcpConfigPath:m(r,`mcp-config.json`),globalScaffoldRoot:null,instructionsRoot:null}),n.filter(e=>c(e.configDir))}function b(e,n,r=!1){let{mcpConfigPath:i,configDir:a}=e,o={...t},s={};if(c(i)){try{let e=u(i,`utf-8`);s=JSON.parse(e)}catch{let e=`${i}.bak`;f(e,u(i,`utf-8`),`utf-8`),console.log(` Backed up invalid ${i} to ${e}`),s={}}if((s.servers??s.mcpServers??{})[n]&&!r){console.log(` ${e.ide}: ${n} already configured (use --force to update)`);return}}let d=new Set([`VS Code`,`VS Code Insiders`,`VSCodium`,`Windsurf`]).has(e.ide)?`servers`:`mcpServers`,p=s[d]??{};e.ide===`Copilot CLI`?p[n]={...o,tools:[`*`]}:p[n]=o,s[d]=p,l(a,{recursive:!0}),f(i,`${JSON.stringify(s,null,2)}\n`,`utf-8`),console.log(` ${e.ide}: configured ${n} in ${i}`)}const x=new Set([`VS Code`,`VS Code Insiders`,`VSCodium`]);function S(e,t=!1){if(!x.has(e.ide))return;let n=m(e.configDir,`settings.json`),r={};if(c(n))try{let e=u(n,`utf-8`);r=JSON.parse(e)}catch{console.log(` ${e.ide}: skipped settings.json (invalid JSON)`);return}let a=!1;for(let[e,n]of Object.entries(i))if(typeof n==`object`&&n){let t=typeof r[e]==`object`&&r[e]!==null?r[e]:{},i={...t,...n};JSON.stringify(i)!==JSON.stringify(t)&&(r[e]=i,a=!0)}else (t||!(e in r))&&(r[e]=n,a=!0);a&&(f(n,`${JSON.stringify(r,null,2)}\n`,`utf-8`),console.log(` ${e.ide}: updated settings.json`))}function C(t,n,i,u,d=!1){let p=new Set;for(let e of n)e.globalScaffoldRoot&&p.add(e.globalScaffoldRoot);if(p.size===0){console.log(` No IDEs with global scaffold support detected.`);return}let h=m(t,`scaffold`,`general`);for(let n of p){s(h,n,`agents`,u,d),s(h,n,`prompts`,u,d);let i=0;for(let e of r)c(m(h,`skills`,e))&&(s(h,n,`skills/${e}`,u,d),i++);for(let r of e){let e=m(t,`scaffold`,`flows`,r);c(m(e,`skills`))&&s(e,m(n,`flows`,r),`skills`,u,d)}console.log(` ${n}: scaffold updated (${i} skills)`)}let g=new Set,_=o(`aikit`,i),v=a(`aikit`,i);for(let e of n){if(!e.globalScaffoldRoot)continue;let t=e.globalScaffoldRoot;if(e.ide===`Claude Code`){let e=m(t,`CLAUDE.md`);f(e,`${_}\n---\n\n${v}`,`utf-8`),g.add(e)}else if(e.ide===`VS Code`||e.ide===`VS Code Insiders`||e.ide===`VSCodium`){let n=e.instructionsRoot??t;l(n,{recursive:!0});let r=m(n,`copilot-instructions.md`);g.has(r)||(f(r,`---\napplyTo: "**"\n---\n\n${_}\n---\n\n${v}`,`utf-8`),g.add(r))}else if(e.ide===`Cursor`||e.ide===`Cursor Nightly`){let e=m(t,`rules`);l(e,{recursive:!0});let n=m(e,`aikit.mdc`);g.has(n)||(f(n,`${_}\n---\n\n${v}`,`utf-8`),g.add(n))}else if(e.ide===`Windsurf`){let e=m(t,`rules`);l(e,{recursive:!0});let n=m(e,`aikit.md`);g.has(n)||(f(n,`${_}\n---\n\n${v}`,`utf-8`),g.add(n))}}g.size>0&&console.log(` Instruction files: ${[...g].join(`, `)}`)}function w(e){let t=[];for(let n of e){if(!n.globalScaffoldRoot)continue;let e=n.globalScaffoldRoot;if(n.ide===`VS Code`||n.ide===`VS Code Insiders`||n.ide===`VSCodium`){let r=n.instructionsRoot??e;t.push(m(r,`kb.instructions.md`)),t.push(m(r,`aikit.instructions.md`))}else n.ide===`Cursor`||n.ide===`Cursor Nightly`?t.push(m(e,`rules`,`kb.mdc`)):n.ide===`Windsurf`&&t.push(m(e,`rules`,`kb.md`))}for(let e of t)c(e)&&(d(e),console.log(` Removed legacy file: ${e}`))}async function T(e){let t=n,r=m(p(h(import.meta.url)),`..`,`..`,`..`,`..`,`..`,`package.json`),i=JSON.parse(u(r,`utf-8`)).version;console.log(`Initializing @vpxa/aikit v${i}...\n`);let a=g();l(a,{recursive:!0}),console.log(` Global data store: ${a}`),_({version:1,workspaces:{}}),console.log(` Created registry.json`);let o=y();if(o.length===0)console.log(`
|
|
2
2
|
No supported IDEs detected. You can manually add the MCP server config.`);else{console.log(`\n Detected ${o.length} IDE(s):`);for(let n of o)b(n,t,e.force),S(n,e.force)}let s=m(p(h(import.meta.url)),`..`,`..`,`..`,`..`,`..`);console.log(`
|
|
3
3
|
Installing scaffold files:`),C(s,o,t,i,e.force),w(o),console.log(`
|
|
4
4
|
User-level AI Kit installation complete!`),console.log(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as e}from"zod";const t=e.object({totalRecords:e.number(),totalFiles:e.number(),lastIndexedAt:e.string().nullable(),onboarded:e.boolean(),onboardDir:e.string(),contentTypes:e.record(e.string(),e.number()),wasmAvailable:e.boolean(),graphStats:e.object({nodes:e.number(),edges:e.number()}).nullable(),curatedCount:e.number(),serverVersion:e.string(),scaffoldVersion:e.string().nullable(),workspaceScaffoldVersion:e.string().nullable(),upgradeAvailable:e.boolean()}),n=e.object({entries:e.array(e.object({path:e.string(),title:e.string(),category:e.string(),tags:e.array(e.string()),version:e.number(),preview:e.string()})),totalCount:e.number()}),r=e.object({ok:e.boolean(),checks:e.array(e.object({name:e.string(),ok:e.boolean(),message:e.string().optional()}))}),i=e.object({summary:e.object({totalFiles:e.number(),totalLines:e.number(),totalCodeLines:e.number(),totalFunctions:e.number(),avgComplexity:e.number(),maxComplexity:e.object({value:e.number(),file:e.string()})}),files:e.array(e.object({path:e.string(),lines:e.number(),code:e.number(),complexity:e.number(),functions:e.number()}))}),a=e.object({platform:e.string(),arch:e.string(),nodeVersion:e.string(),cwd:e.string(),cpus:e.number(),memoryFreeGb:e.number(),memoryTotalGb:e.number()}),o=e.object({iso:e.string(),unix:e.number(),timezone:e.string(),formatted:e.string()}),s=e.object({passed:e.boolean(),errorCount:e.number(),warningCount:e.number(),topErrors:e.array(e.string())}),c=e.object({passed:e.boolean(),tsc:s,biome:s}),l=e.object({name:e.string(),definedIn:e.object({path:e.string(),line:e.number(),kind:e.string(),signature:e.string().optional()}).nullable(),importedBy:e.array(e.object({path:e.string(),line:e.number(),importStatement:e.string()})),referencedIn:e.array(e.object({path:e.string(),line:e.number(),context:e.string(),scope:e.string().optional()})),graphContext:e.object({definingModule:e.string().optional(),importedByModules:e.array(e.string()),siblingSymbols:e.array(e.string())}).nullable()}),u=e.object({sourcePath:e.string(),contentType:e.string(),score:e.number(),headingPath:e.string().optional(),startLine:e.number().optional(),endLine:e.number().optional(),origin:e.string().optional(),category:e.string().optional(),tags:e.array(e.string()).optional()}),d=e.object({results:e.array(u),totalResults:e.number(),searchMode:e.string(),query:e.string()}),f=e.object({path:e.string(),line:e.number().optional(),matchType:e.string(),preview:e.string()}),p=e.object({matches:e.array(f),totalMatches:e.number(),pattern:e.string(),truncated:e.boolean()}),m=e.object({path:e.string(),relevance:e.number(),estimatedTokens:e.number(),focusLines:e.array(e.string()).optional()}),h=e.object({files:e.array(m),totalFiles:e.number(),totalEstimatedTokens:e.number(),task:e.string()}),g=e.object({path:e.string(),impact:e.string(),reason:e.string()}),_=e.object({changedFiles:e.array(e.string()),affectedFiles:e.array(g),totalAffected:e.number(),riskLevel:e.string()}),v=e.object({name:e.string(),passed:e.boolean(),message:e.string().optional(),severity:e.string().optional()}),y=e.object({passed:e.boolean(),score:e.number(),checks:e.array(v),summary:e.string()}),b=e.object({id:e.string(),name:e.string(),type:e.string(),sourcePath:e.string().optional()}),x=e.object({fromId:e.string(),toId:e.string(),type:e.string()}),S=e.object({nodes:e.array(b),edges:e.array(x),totalNodes:e.number(),totalEdges:e.number(),query:e.string()}),C=e.object({symbols:e.array(e.object({name:e.string(),path:e.string(),line:e.number().optional(),kind:e.string()})),totalDead:e.number()}),w=e.object({files:e.number(),packages:e.number(),languages:e.record(e.string(),e.number()),tree:e.string()}),T=e.object({path:e.string(),language:e.string(),lines:e.number(),imports:e.number(),exports:e.number(),functions:e.number(),classes:e.number()}),E=e.object({gitRoot:e.string(),branch:e.string(),commitCount:e.number(),hasUncommitted:e.boolean(),recentCommits:e.array(e.object({hash:e.string(),message:e.string(),author:e.string()}))}),D=e.object({originalChars:e.number(),compressedChars:e.number(),ratio:e.number(),segmentsKept:e.number(),segmentsTotal:e.number()});export{w as AnalyzeStructureOutputSchema,y as AuditOutputSchema,_ as BlastRadiusOutputSchema,c as CheckOutputSchema,D as CompactOutputSchema,C as DeadSymbolsOutputSchema,a as EnvOutputSchema,T as FileSummaryOutputSchema,p as FindOutputSchema,E as GitContextOutputSchema,S as GraphOutputSchema,r as HealthOutputSchema,n as ListOutputSchema,i as MeasureOutputSchema,h as ScopeMapOutputSchema,d as SearchOutputSchema,t as StatusOutputSchema,l as SymbolOutputSchema,o as TimeOutputSchema};
|
|
1
|
+
import{z as e}from"zod";const t=e.object({totalRecords:e.number(),totalFiles:e.number(),lastIndexedAt:e.string().nullable(),onboarded:e.boolean(),onboardDir:e.string(),contentTypes:e.record(e.string(),e.number()),wasmAvailable:e.boolean(),graphStats:e.object({nodes:e.number(),edges:e.number()}).nullable(),curatedCount:e.number(),serverVersion:e.string(),scaffoldVersion:e.string().nullable(),workspaceScaffoldVersion:e.string().nullable(),upgradeAvailable:e.boolean()}),n=e.object({entries:e.array(e.object({path:e.string(),title:e.string(),category:e.string(),tags:e.array(e.string()),version:e.number(),preview:e.string()})),totalCount:e.number()}),r=e.object({ok:e.boolean(),checks:e.array(e.object({name:e.string(),ok:e.boolean(),message:e.string().optional()}))}),i=e.object({summary:e.object({totalFiles:e.number(),totalLines:e.number(),totalCodeLines:e.number(),totalFunctions:e.number(),avgComplexity:e.number(),maxComplexity:e.object({value:e.number(),file:e.string()})}),files:e.array(e.object({path:e.string(),lines:e.number(),code:e.number(),complexity:e.number(),functions:e.number()}))}),a=e.object({platform:e.string(),arch:e.string(),nodeVersion:e.string(),cwd:e.string(),cpus:e.number(),memoryFreeGb:e.number(),memoryTotalGb:e.number()}),o=e.object({iso:e.string(),unix:e.number(),timezone:e.string(),formatted:e.string()}),s=e.object({passed:e.boolean(),errorCount:e.number(),warningCount:e.number(),topErrors:e.array(e.string())}),c=e.object({passed:e.boolean(),tsc:s,biome:s}),l=e.object({name:e.string(),definedIn:e.object({path:e.string(),line:e.number(),kind:e.string(),signature:e.string().optional()}).nullable(),importedBy:e.array(e.object({path:e.string(),line:e.number(),importStatement:e.string()})),referencedIn:e.array(e.object({path:e.string(),line:e.number(),context:e.string(),scope:e.string().optional()})),graphContext:e.object({definingModule:e.string().optional(),importedByModules:e.array(e.string()),siblingSymbols:e.array(e.string())}).nullable()}),u=e.object({sourcePath:e.string(),contentType:e.string(),score:e.number(),headingPath:e.string().optional(),startLine:e.number().optional(),endLine:e.number().optional(),origin:e.string().optional(),category:e.string().optional(),tags:e.array(e.string()).optional()}),d=e.object({results:e.array(u),totalResults:e.number(),searchMode:e.string(),query:e.string()}),f=e.object({path:e.string(),line:e.number().optional(),matchType:e.string(),preview:e.string()}),p=e.object({matches:e.array(f),totalMatches:e.number(),pattern:e.string(),truncated:e.boolean()}),m=e.object({path:e.string(),relevance:e.number(),estimatedTokens:e.number(),focusLines:e.array(e.string()).optional()}),h=e.object({files:e.array(m),totalFiles:e.number(),totalEstimatedTokens:e.number(),task:e.string()}),g=e.object({path:e.string(),impact:e.string(),reason:e.string()}),_=e.object({changedFiles:e.array(e.string()),affectedFiles:e.array(g),totalAffected:e.number(),riskLevel:e.string()}),v=e.object({name:e.string(),passed:e.boolean(),message:e.string().optional(),severity:e.string().optional()}),y=e.object({passed:e.boolean(),score:e.number(),checks:e.array(v),summary:e.string()}),b=e.object({id:e.string(),name:e.string(),type:e.string(),sourcePath:e.string().optional()}),x=e.object({fromId:e.string(),toId:e.string(),type:e.string()}),S=e.object({nodes:e.array(b),edges:e.array(x),totalNodes:e.number(),totalEdges:e.number(),query:e.string()}),C=e.object({symbols:e.array(e.object({name:e.string(),path:e.string(),line:e.number().optional(),kind:e.string()})),totalDead:e.number()}),w=e.object({files:e.number(),packages:e.number(),languages:e.record(e.string(),e.number()),tree:e.string()}),T=e.object({path:e.string(),language:e.string(),lines:e.number(),imports:e.number(),exports:e.number(),functions:e.number(),classes:e.number()}),E=e.object({gitRoot:e.string(),branch:e.string(),commitCount:e.number(),hasUncommitted:e.boolean(),recentCommits:e.array(e.object({hash:e.string(),message:e.string(),author:e.string(),date:e.string()}))}),D=e.object({originalChars:e.number(),compressedChars:e.number(),ratio:e.number(),segmentsKept:e.number(),segmentsTotal:e.number()});export{w as AnalyzeStructureOutputSchema,y as AuditOutputSchema,_ as BlastRadiusOutputSchema,c as CheckOutputSchema,D as CompactOutputSchema,C as DeadSymbolsOutputSchema,a as EnvOutputSchema,T as FileSummaryOutputSchema,p as FindOutputSchema,E as GitContextOutputSchema,S as GraphOutputSchema,r as HealthOutputSchema,n as ListOutputSchema,i as MeasureOutputSchema,h as ScopeMapOutputSchema,d as SearchOutputSchema,t as StatusOutputSchema,l as SymbolOutputSchema,o as TimeOutputSchema};
|
|
@@ -14,8 +14,10 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
14
14
|
*
|
|
15
15
|
* UPDATE: The SDK uses passthrough-style validation which DOES reject
|
|
16
16
|
* unknown keys on strict schemas. Instead, we build a "zero-value"
|
|
17
|
-
* object from the registered outputSchema (
|
|
18
|
-
* passes validation.
|
|
17
|
+
* object from the registered outputSchema (Zod or JSON-Schema) so it
|
|
18
|
+
* always passes validation. Zod schemas expose `.shape` and `.type`
|
|
19
|
+
* differently from JSON-Schema's `.properties` and `.type` — the
|
|
20
|
+
* `buildZeroValue` function handles both formats.
|
|
19
21
|
*/
|
|
20
22
|
/**
|
|
21
23
|
* Wrap `server.registerTool` so that every handler result is guaranteed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e){let n=e.registerTool.bind(e);e.registerTool=(e,r,i)=>r?.outputSchema==null?n(e,r,i):n(e,r,async(e,n)=>{let a=await i(e,n);return a.structuredContent??=t(r.outputSchema),a})}function t(e){if(!e)return{};if(e.anyOf){let n=e.anyOf.find(e=>e.type!==`null`);return n?t(n):null}switch(e.type){case`object`:{let n={};if(
|
|
1
|
+
function e(e){let n=e.registerTool.bind(e);e.registerTool=(e,r,i)=>r?.outputSchema==null?n(e,r,i):n(e,r,async(e,n)=>{let a=await i(e,n);return a.structuredContent??=t(r.outputSchema),a})}function t(e){if(!e)return{};if(e.anyOf){let n=e.anyOf.find(e=>e.type!==`null`);return n?t(n):null}switch(e.type){case`object`:{let n={},r=e.properties??e.shape;if(r)for(let[e,i]of Object.entries(r))n[e]=t(i);return n}case`array`:return[];case`string`:return``;case`number`:case`integer`:return 0;case`boolean`:return!1;case`nullable`:return null;case`optional`:return;case`record`:return{};default:return{}}}export{e as installStructuredContentGuard};
|
|
@@ -75,6 +75,7 @@ export const AGENTS = {
|
|
|
75
75
|
toolRole: 'refactor',
|
|
76
76
|
sharedBase: 'code-agent-base',
|
|
77
77
|
category: 'implementation',
|
|
78
|
+
skills: [['aikit', '**Always** — AI Kit tool signatures, search, analysis']],
|
|
78
79
|
},
|
|
79
80
|
|
|
80
81
|
// ─── Diagnostics ──────────────────────────────────────────────────────
|
|
@@ -115,6 +116,10 @@ export const AGENTS = {
|
|
|
115
116
|
toolRole: 'documenter',
|
|
116
117
|
sharedBase: null,
|
|
117
118
|
category: 'documentation',
|
|
119
|
+
skills: [
|
|
120
|
+
['aikit', '**Always** — AI Kit tool signatures, search, analysis'],
|
|
121
|
+
['present', 'When presenting documentation previews or architecture visuals to the user'],
|
|
122
|
+
],
|
|
118
123
|
},
|
|
119
124
|
|
|
120
125
|
Explorer: {
|
|
@@ -139,9 +144,10 @@ export const AGENTS = {
|
|
|
139
144
|
sharedBase: 'researcher-base',
|
|
140
145
|
category: 'research',
|
|
141
146
|
skills: [
|
|
142
|
-
['
|
|
143
|
-
['
|
|
144
|
-
['
|
|
147
|
+
['aikit', '**Always** — AI Kit tool signatures, search, analysis'],
|
|
148
|
+
['lesson-learned', 'When analyzing past changes to extract engineering principles'],
|
|
149
|
+
['c4-architecture', 'When researching system architecture \u2014 produce C4 diagrams'],
|
|
150
|
+
['adr-skill', 'When the research involves a technical decision \u2014 draft an ADR'],
|
|
145
151
|
],
|
|
146
152
|
variants: {
|
|
147
153
|
Alpha: {
|
|
@@ -195,9 +201,10 @@ export const AGENTS = {
|
|
|
195
201
|
sharedBase: 'architect-reviewer-base',
|
|
196
202
|
category: 'review',
|
|
197
203
|
skills: [
|
|
198
|
-
['
|
|
204
|
+
['aikit', '**Always** — AI Kit tool signatures, search, analysis'],
|
|
205
|
+
['c4-architecture', 'When reviewing architectural diagrams or boundary changes'],
|
|
199
206
|
[
|
|
200
|
-
'
|
|
207
|
+
'adr-skill',
|
|
201
208
|
'When the review involves architecture decisions \u2014 reference or create ADRs',
|
|
202
209
|
],
|
|
203
210
|
],
|
|
@@ -107,9 +107,10 @@ Batch 2 (after batch 1):
|
|
|
107
107
|
|
|
108
108
|
## Output Rules
|
|
109
109
|
|
|
110
|
-
- Structured data >3 sentences → \`present({ format: "html" })\`
|
|
110
|
+
- Structured data >3 sentences → \`present({ format: "html" })\` (or \`format: "browser"\` in CLI mode)
|
|
111
111
|
- Charts, tables, dependency graphs → always \`present\`
|
|
112
112
|
- Short confirmations and questions → normal chat
|
|
113
|
+
- **CLI mode:** Always use \`format: "browser"\` — the \`html\` format's UIResource is invisible in terminal environments. The \`browser\` format auto-opens the system browser.
|
|
113
114
|
|
|
114
115
|
## Subagent Output Relay
|
|
115
116
|
|
|
@@ -117,7 +118,7 @@ When subagents complete, their visual outputs (from \`present\`) are NOT visible
|
|
|
117
118
|
**You MUST relay key findings:**
|
|
118
119
|
|
|
119
120
|
1. After every subagent completes, extract key data from the returned text
|
|
120
|
-
2. If the subagent mentions charts, tables, or visual data → re-present using \`present({ format: "html" })\`
|
|
121
|
+
2. If the subagent mentions charts, tables, or visual data → re-present using \`present({ format: "html" })\` (or \`format: "browser"\` in CLI mode)
|
|
121
122
|
3. If the subagent returns structured findings → summarize and present to user
|
|
122
123
|
4. **Never assume the user saw subagent output** — always relay or re-present
|
|
123
124
|
|
|
@@ -166,6 +167,7 @@ Before every tool call, verify:
|
|
|
166
167
|
| Skill | When to load |
|
|
167
168
|
|-------|--------------|
|
|
168
169
|
| \`multi-agents-development\` | **Before any delegation** — task decomposition, dispatch templates, review pipeline, recovery patterns |
|
|
170
|
+
| \`present\` | When presenting plans, findings, or visual content to the user — dashboards, tables, charts, timelines |
|
|
169
171
|
| \`brainstorming\` | Before creative/design work (Phase 0) |
|
|
170
172
|
| \`session-handoff\` | Context filling up, session ending, or major milestone |
|
|
171
173
|
| \`lesson-learned\` | After completing work — extract engineering principles |
|
|
@@ -232,12 +234,14 @@ When subagents complete, their visual outputs (from \`present\`) are NOT visible
|
|
|
232
234
|
**You MUST relay key findings:**
|
|
233
235
|
|
|
234
236
|
1. After every subagent completes, extract key data from the returned text
|
|
235
|
-
2. If the subagent mentions charts, tables, or visual data → re-present using \`present({ format: "html" })\`
|
|
237
|
+
2. If the subagent mentions charts, tables, or visual data → re-present using \`present({ format: "html" })\` (or \`format: "browser"\` in CLI mode)
|
|
236
238
|
3. If the subagent returns structured findings → summarize and present to user
|
|
237
239
|
4. **Never assume the user saw subagent output** — always relay or re-present
|
|
238
240
|
|
|
239
241
|
**Rule: Every subagent batch completion MUST be followed by a user-visible summary or presentation.**
|
|
240
242
|
|
|
243
|
+
> **CLI mode:** Always use \`format: "browser"\` instead of \`format: "html"\` — the UIResource is invisible in terminal. The browser format auto-opens the system browser.
|
|
244
|
+
|
|
241
245
|
## Output Format
|
|
242
246
|
|
|
243
247
|
\`\`\`markdown
|
|
@@ -273,6 +277,7 @@ When subagents complete, their visual outputs (from \`present\`) are NOT visible
|
|
|
273
277
|
| Skill | When to load |
|
|
274
278
|
|-------|--------------|
|
|
275
279
|
| \`brainstorming\` | Before planning any new feature, component, or behavior change — use Visual Companion for architecture mockups |
|
|
280
|
+
| \`present\` | When presenting plans, dependency graphs, or complexity estimates to the user |
|
|
276
281
|
| \`requirements-clarity\` | When requirements are vague or complex (>2 days) — score 0-100 before committing to a plan |
|
|
277
282
|
| \`c4-architecture\` | When the plan involves architectural changes — generate C4 diagrams |
|
|
278
283
|
| \`adr-skill\` | When the plan involves non-trivial technical decisions — create executable ADRs |
|
|
@@ -456,6 +461,7 @@ When subagents complete, their visual outputs (from \`present\`) are NOT visible
|
|
|
456
461
|
|
|
457
462
|
| Skill | When to load |
|
|
458
463
|
|-------|--------------|
|
|
464
|
+
| \`present\` | When presenting documentation previews, API tables, or architecture visuals to the user |
|
|
459
465
|
| \`c4-architecture\` | When documenting system architecture — generate C4 Mermaid diagrams |
|
|
460
466
|
| \`adr-skill\` | When documenting architecture decisions — create or update ADRs |
|
|
461
467
|
| \`typescript\` | When documenting TypeScript APIs — type signatures, JSDoc patterns |`,
|
|
@@ -91,9 +91,11 @@ Your agent file lists domain-specific skills in the **Skills** section. Load the
|
|
|
91
91
|
|
|
92
92
|
1. Check if the current task matches a listed skill trigger
|
|
93
93
|
2. If yes → load the skill file before starting implementation
|
|
94
|
-
3. The
|
|
94
|
+
3. The following skills are **foundational** — always loaded, do not re-load:
|
|
95
|
+
- **\`aikit\`** — AI Kit MCP tool reference, search strategies, compression workflows, session protocol. **Required for all tool usage.**
|
|
96
|
+
- **\`present\`** — Rich content rendering (dashboards, tables, charts, timelines). **Required when producing visual output for the user.**
|
|
95
97
|
|
|
96
|
-
> If no skills are listed for your agent, rely on AI Kit tools and onboard artifacts.
|
|
98
|
+
> If no additional skills are listed for your agent, rely on AI Kit tools and onboard artifacts.
|
|
97
99
|
|
|
98
100
|
---
|
|
99
101
|
|
|
@@ -135,12 +137,32 @@ list() // see all stored knowledge entries
|
|
|
135
137
|
| \`symbol({ name })\` | Find symbol definition + references |
|
|
136
138
|
| \`trace({ symbol, direction })\` | Follow call graph forward/backward |
|
|
137
139
|
| \`compact({ path, query })\` | Read specific section of a file |
|
|
138
|
-
| \`read_file\` | **
|
|
140
|
+
| \`read_file\` | **ONLY** when you need exact lines for a pending edit |
|
|
139
141
|
|
|
140
142
|
### Step 4: Tool Discovery
|
|
141
143
|
|
|
142
144
|
If unsure which AI Kit tool to use → run \`guide({ topic: "what you need" })\` for recommendations.
|
|
143
145
|
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## PROHIBITED: Native File Reading Tools
|
|
149
|
+
|
|
150
|
+
**\`read_file\` / \`read_file_raw\` MUST NOT be used to understand code.** They waste tokens and miss structural information that AI Kit tools provide.
|
|
151
|
+
|
|
152
|
+
| ❌ NEVER do this | ✅ Do this instead | Why |
|
|
153
|
+
|---|---|---|
|
|
154
|
+
| \`read_file\` to understand a file | \`file_summary({ path })\` | Structure, exports, imports, call edges — **10x fewer tokens** |
|
|
155
|
+
| \`read_file\` to find specific code | \`compact({ path, query })\` | Server-side read + semantic extract — **5-20x reduction** |
|
|
156
|
+
| Multiple \`read_file\` calls | \`digest({ sources })\` | Compresses multiple files into token-budgeted summary |
|
|
157
|
+
| \`grep_search\` / \`textSearch\` | \`search({ query })\` | Hybrid search across all indexed + curated content |
|
|
158
|
+
| \`grep_search\` for a symbol | \`symbol({ name })\` | Definition + references with scope context |
|
|
159
|
+
| Manual code tracing | \`trace({ start, direction })\` | AST call-graph traversal |
|
|
160
|
+
| Line counting / \`wc\` | \`measure({ path })\` | Lines, functions, cognitive complexity |
|
|
161
|
+
| \`fetch_webpage\` | \`web_fetch({ urls })\` | Readability extract + token budget |
|
|
162
|
+
| Web research / browsing | \`web_search({ queries })\` | Structured web results without browser |
|
|
163
|
+
|
|
164
|
+
**The ONLY acceptable use of \`read_file\`:** Reading exact lines immediately before an edit operation (e.g., to verify the \`old_str\` for a replacement). Even then, use \`file_summary\` first to identify which lines to read.
|
|
165
|
+
|
|
144
166
|
## FORGE Protocol (Quality Gate)
|
|
145
167
|
|
|
146
168
|
**Quick reference:**
|
|
@@ -239,10 +261,11 @@ For outdated AI Kit entries → \`update(path, content, reason)\`
|
|
|
239
261
|
|
|
240
262
|
## Context Efficiency
|
|
241
263
|
|
|
242
|
-
|
|
243
|
-
- **\`
|
|
264
|
+
**NEVER use \`read_file\` to understand code.** Use the AI Kit compression tools:
|
|
265
|
+
- **\`file_summary({ path })\`** — Structure, exports, imports (~50 tokens vs ~1000+ for read_file)
|
|
266
|
+
- **\`compact({ path, query })\`** — Extract relevant sections from a single file (5-20x token reduction)
|
|
244
267
|
- **\`digest({ sources })\`** — Compress 3+ files into a single token-budgeted summary
|
|
245
|
-
- **\`stratum_card({
|
|
268
|
+
- **\`stratum_card({ files, query })\`** — Generate a reusable T1/T2 context card for files you'll reference repeatedly
|
|
246
269
|
|
|
247
270
|
**Session phases** — structure your work to minimize context bloat:
|
|
248
271
|
|
|
@@ -298,12 +321,14 @@ When you need user input or need to explain something before asking:
|
|
|
298
321
|
| Simple explanation + question | **Elicitation** | Text-only explanation, then ask via elicitation fields |
|
|
299
322
|
| Rich content explanation + question | **\`present\` (mode: html)** + **Elicitation** | Use \`present({ format: "html" })\` for rich visual explanation (tables, charts, diagrams), then use elicitation for user input |
|
|
300
323
|
| Complex visual explanation | **\`present\` (mode: browser)** | Use \`present({ format: "browser" })\` for full HTML dashboard. Confirmation/selection can be handled via browser actions, but for other user input fall back to elicitation |
|
|
324
|
+
| **CLI mode** (any rich content) | **\`present\` (mode: browser)** | In CLI/terminal mode, **always use \`format: "browser"\`**. The \`html\` format's UIResource is invisible in terminal — only markdown fallback text renders. The \`browser\` format auto-opens the system browser. |
|
|
301
325
|
|
|
302
326
|
**Rules:**
|
|
303
327
|
- **Never dump long tables or complex visuals as plain text** — use \`present\` to render them properly
|
|
304
328
|
- **Confirmation selections** (yes/no, pick from list) can be handled inside browser mode via actions
|
|
305
329
|
- **Free-form text input** always goes through elicitation, even when using \`present\` for the explanation
|
|
306
330
|
- **Prefer the simplest method** that adequately conveys the information
|
|
331
|
+
- **CLI mode override:** When running in terminal (not VS Code chat), always use \`format: "browser"\` for any rich content
|
|
307
332
|
|
|
308
333
|
---
|
|
309
334
|
|
|
@@ -422,10 +447,12 @@ When invoked for a decision analysis, you receive a specific question. You MUST:
|
|
|
422
447
|
|
|
423
448
|
## Context Efficiency
|
|
424
449
|
|
|
425
|
-
- **
|
|
426
|
-
-
|
|
427
|
-
-
|
|
428
|
-
-
|
|
450
|
+
- **NEVER use \`read_file\` to understand code** — use AI Kit compression tools instead
|
|
451
|
+
- **\`file_summary\`** for structure (exports, imports, call edges — 10x fewer tokens)
|
|
452
|
+
- **\`compact\`** for specific sections (5-20x token reduction vs read_file)
|
|
453
|
+
- **\`digest\`** when synthesizing from 3+ sources
|
|
454
|
+
- **\`stratum_card\`** for files you'll reference repeatedly
|
|
455
|
+
- **\`read_file\` is ONLY acceptable** when you need exact lines for a pending edit operation
|
|
429
456
|
`,
|
|
430
457
|
|
|
431
458
|
'code-reviewer-base': `# Code-Reviewer — Shared Base Instructions
|
|
@@ -17,8 +17,9 @@ You are **not** the Code-Reviewer agent. Code-Reviewer handles correctness, test
|
|
|
17
17
|
|
|
18
18
|
| Skill | When to load |
|
|
19
19
|
|-------|--------------|
|
|
20
|
-
|
|
|
21
|
-
|
|
|
20
|
+
| aikit | **Always** — AI Kit tool signatures, search, analysis |
|
|
21
|
+
| c4-architecture | When reviewing architectural diagrams or boundary changes |
|
|
22
|
+
| adr-skill | When the review involves architecture decisions — reference or create ADRs |
|
|
22
23
|
|
|
23
24
|
## Flows
|
|
24
25
|
|
|
@@ -17,8 +17,9 @@ You are **not** the Code-Reviewer agent. Code-Reviewer handles correctness, test
|
|
|
17
17
|
|
|
18
18
|
| Skill | When to load |
|
|
19
19
|
|-------|--------------|
|
|
20
|
-
|
|
|
21
|
-
|
|
|
20
|
+
| aikit | **Always** — AI Kit tool signatures, search, analysis |
|
|
21
|
+
| c4-architecture | When reviewing architectural diagrams or boundary changes |
|
|
22
|
+
| adr-skill | When the review involves architecture decisions — reference or create ADRs |
|
|
22
23
|
|
|
23
24
|
## Flows
|
|
24
25
|
|
|
@@ -49,9 +49,17 @@ You are the **Documenter**, documentation specialist that creates and maintains
|
|
|
49
49
|
|
|
50
50
|
| Skill | When to load |
|
|
51
51
|
|-------|--------------|
|
|
52
|
+
| `present` | When presenting documentation previews, API tables, or architecture visuals to the user |
|
|
52
53
|
| `c4-architecture` | When documenting system architecture — generate C4 Mermaid diagrams |
|
|
53
54
|
| `adr-skill` | When documenting architecture decisions — create or update ADRs |
|
|
54
55
|
| `typescript` | When documenting TypeScript APIs — type signatures, JSDoc patterns |
|
|
56
|
+
## Skills (load on demand)
|
|
57
|
+
|
|
58
|
+
| Skill | When to load |
|
|
59
|
+
|-------|--------------|
|
|
60
|
+
| aikit | **Always** — AI Kit tool signatures, search, analysis |
|
|
61
|
+
| present | When presenting documentation previews or architecture visuals to the user |
|
|
62
|
+
|
|
55
63
|
|
|
56
64
|
## Flows
|
|
57
65
|
|
|
@@ -124,9 +124,10 @@ Batch 2 (after batch 1):
|
|
|
124
124
|
|
|
125
125
|
## Output Rules
|
|
126
126
|
|
|
127
|
-
- Structured data >3 sentences → `present({ format: "html" })`
|
|
127
|
+
- Structured data >3 sentences → `present({ format: "html" })` (or `format: "browser"` in CLI mode)
|
|
128
128
|
- Charts, tables, dependency graphs → always `present`
|
|
129
129
|
- Short confirmations and questions → normal chat
|
|
130
|
+
- **CLI mode:** Always use `format: "browser"` — the `html` format's UIResource is invisible in terminal environments. The `browser` format auto-opens the system browser.
|
|
130
131
|
|
|
131
132
|
## Subagent Output Relay
|
|
132
133
|
|
|
@@ -134,7 +135,7 @@ When subagents complete, their visual outputs (from `present`) are NOT visible t
|
|
|
134
135
|
**You MUST relay key findings:**
|
|
135
136
|
|
|
136
137
|
1. After every subagent completes, extract key data from the returned text
|
|
137
|
-
2. If the subagent mentions charts, tables, or visual data → re-present using `present({ format: "html" })`
|
|
138
|
+
2. If the subagent mentions charts, tables, or visual data → re-present using `present({ format: "html" })` (or `format: "browser"` in CLI mode)
|
|
138
139
|
3. If the subagent returns structured findings → summarize and present to user
|
|
139
140
|
4. **Never assume the user saw subagent output** — always relay or re-present
|
|
140
141
|
|
|
@@ -183,6 +184,7 @@ Before every tool call, verify:
|
|
|
183
184
|
| Skill | When to load |
|
|
184
185
|
|-------|--------------|
|
|
185
186
|
| `multi-agents-development` | **Before any delegation** — task decomposition, dispatch templates, review pipeline, recovery patterns |
|
|
187
|
+
| `present` | When presenting plans, findings, or visual content to the user — dashboards, tables, charts, timelines |
|
|
186
188
|
| `brainstorming` | Before creative/design work (Phase 0) |
|
|
187
189
|
| `session-handoff` | Context filling up, session ending, or major milestone |
|
|
188
190
|
| `lesson-learned` | After completing work — extract engineering principles |
|
|
@@ -44,12 +44,14 @@ When subagents complete, their visual outputs (from `present`) are NOT visible t
|
|
|
44
44
|
**You MUST relay key findings:**
|
|
45
45
|
|
|
46
46
|
1. After every subagent completes, extract key data from the returned text
|
|
47
|
-
2. If the subagent mentions charts, tables, or visual data → re-present using `present({ format: "html" })`
|
|
47
|
+
2. If the subagent mentions charts, tables, or visual data → re-present using `present({ format: "html" })` (or `format: "browser"` in CLI mode)
|
|
48
48
|
3. If the subagent returns structured findings → summarize and present to user
|
|
49
49
|
4. **Never assume the user saw subagent output** — always relay or re-present
|
|
50
50
|
|
|
51
51
|
**Rule: Every subagent batch completion MUST be followed by a user-visible summary or presentation.**
|
|
52
52
|
|
|
53
|
+
> **CLI mode:** Always use `format: "browser"` instead of `format: "html"` — the UIResource is invisible in terminal. The browser format auto-opens the system browser.
|
|
54
|
+
|
|
53
55
|
## Output Format
|
|
54
56
|
|
|
55
57
|
```markdown
|
|
@@ -85,6 +87,7 @@ When subagents complete, their visual outputs (from `present`) are NOT visible t
|
|
|
85
87
|
| Skill | When to load |
|
|
86
88
|
|-------|--------------|
|
|
87
89
|
| `brainstorming` | Before planning any new feature, component, or behavior change — use Visual Companion for architecture mockups |
|
|
90
|
+
| `present` | When presenting plans, dependency graphs, or complexity estimates to the user |
|
|
88
91
|
| `requirements-clarity` | When requirements are vague or complex (>2 days) — score 0-100 before committing to a plan |
|
|
89
92
|
| `c4-architecture` | When the plan involves architectural changes — generate C4 diagrams |
|
|
90
93
|
| `adr-skill` | When the plan involves non-trivial technical decisions — create executable ADRs |
|
|
@@ -35,6 +35,12 @@ You are the **Refactor**, code refactoring specialist that improves structure, r
|
|
|
35
35
|
|-------|--------------|
|
|
36
36
|
| `lesson-learned` | After completing a refactor — extract principles from the before/after diff |
|
|
37
37
|
| `typescript` | When refactoring TypeScript code — type patterns, generics, utility types |
|
|
38
|
+
## Skills (load on demand)
|
|
39
|
+
|
|
40
|
+
| Skill | When to load |
|
|
41
|
+
|-------|--------------|
|
|
42
|
+
| aikit | **Always** — AI Kit tool signatures, search, analysis |
|
|
43
|
+
|
|
38
44
|
|
|
39
45
|
## Flows
|
|
40
46
|
|
|
@@ -15,9 +15,10 @@ You are **Researcher-Alpha**, the primary deep research agent. During multi-mode
|
|
|
15
15
|
|
|
16
16
|
| Skill | When to load |
|
|
17
17
|
|-------|--------------|
|
|
18
|
-
|
|
|
19
|
-
|
|
|
20
|
-
|
|
|
18
|
+
| aikit | **Always** — AI Kit tool signatures, search, analysis |
|
|
19
|
+
| lesson-learned | When analyzing past changes to extract engineering principles |
|
|
20
|
+
| c4-architecture | When researching system architecture — produce C4 diagrams |
|
|
21
|
+
| adr-skill | When the research involves a technical decision — draft an ADR |
|
|
21
22
|
|
|
22
23
|
## Flows
|
|
23
24
|
|
|
@@ -15,9 +15,10 @@ You are **Researcher-Beta**, a variant of the Researcher agent optimized for **p
|
|
|
15
15
|
|
|
16
16
|
| Skill | When to load |
|
|
17
17
|
|-------|--------------|
|
|
18
|
-
|
|
|
19
|
-
|
|
|
20
|
-
|
|
|
18
|
+
| aikit | **Always** — AI Kit tool signatures, search, analysis |
|
|
19
|
+
| lesson-learned | When analyzing past changes to extract engineering principles |
|
|
20
|
+
| c4-architecture | When researching system architecture — produce C4 diagrams |
|
|
21
|
+
| adr-skill | When the research involves a technical decision — draft an ADR |
|
|
21
22
|
|
|
22
23
|
## Flows
|
|
23
24
|
|
|
@@ -15,9 +15,10 @@ You are **Researcher-Delta**, a variant of the Researcher agent optimized for **
|
|
|
15
15
|
|
|
16
16
|
| Skill | When to load |
|
|
17
17
|
|-------|--------------|
|
|
18
|
-
|
|
|
19
|
-
|
|
|
20
|
-
|
|
|
18
|
+
| aikit | **Always** — AI Kit tool signatures, search, analysis |
|
|
19
|
+
| lesson-learned | When analyzing past changes to extract engineering principles |
|
|
20
|
+
| c4-architecture | When researching system architecture — produce C4 diagrams |
|
|
21
|
+
| adr-skill | When the research involves a technical decision — draft an ADR |
|
|
21
22
|
|
|
22
23
|
## Flows
|
|
23
24
|
|
|
@@ -15,9 +15,10 @@ You are **Researcher-Gamma**, a variant of the Researcher agent optimized for **
|
|
|
15
15
|
|
|
16
16
|
| Skill | When to load |
|
|
17
17
|
|-------|--------------|
|
|
18
|
-
|
|
|
19
|
-
|
|
|
20
|
-
|
|
|
18
|
+
| aikit | **Always** — AI Kit tool signatures, search, analysis |
|
|
19
|
+
| lesson-learned | When analyzing past changes to extract engineering principles |
|
|
20
|
+
| c4-architecture | When researching system architecture — produce C4 diagrams |
|
|
21
|
+
| adr-skill | When the research involves a technical decision — draft an ADR |
|
|
21
22
|
|
|
22
23
|
## Flows
|
|
23
24
|
|
|
@@ -83,9 +83,11 @@ Your agent file lists domain-specific skills in the **Skills** section. Load the
|
|
|
83
83
|
|
|
84
84
|
1. Check if the current task matches a listed skill trigger
|
|
85
85
|
2. If yes → load the skill file before starting implementation
|
|
86
|
-
3. The
|
|
86
|
+
3. The following skills are **foundational** — always loaded, do not re-load:
|
|
87
|
+
- **`aikit`** — AI Kit MCP tool reference, search strategies, compression workflows, session protocol. **Required for all tool usage.**
|
|
88
|
+
- **`present`** — Rich content rendering (dashboards, tables, charts, timelines). **Required when producing visual output for the user.**
|
|
87
89
|
|
|
88
|
-
> If no skills are listed for your agent, rely on AI Kit tools and onboard artifacts.
|
|
90
|
+
> If no additional skills are listed for your agent, rely on AI Kit tools and onboard artifacts.
|
|
89
91
|
|
|
90
92
|
---
|
|
91
93
|
|
|
@@ -127,12 +129,32 @@ list() // see all stored knowledge entries
|
|
|
127
129
|
| `symbol({ name })` | Find symbol definition + references |
|
|
128
130
|
| `trace({ symbol, direction })` | Follow call graph forward/backward |
|
|
129
131
|
| `compact({ path, query })` | Read specific section of a file |
|
|
130
|
-
| `read_file` | **
|
|
132
|
+
| `read_file` | **ONLY** when you need exact lines for a pending edit |
|
|
131
133
|
|
|
132
134
|
### Step 4: Tool Discovery
|
|
133
135
|
|
|
134
136
|
If unsure which AI Kit tool to use → run `guide({ topic: "what you need" })` for recommendations.
|
|
135
137
|
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## PROHIBITED: Native File Reading Tools
|
|
141
|
+
|
|
142
|
+
**`read_file` / `read_file_raw` MUST NOT be used to understand code.** They waste tokens and miss structural information that AI Kit tools provide.
|
|
143
|
+
|
|
144
|
+
| ❌ NEVER do this | ✅ Do this instead | Why |
|
|
145
|
+
|---|---|---|
|
|
146
|
+
| `read_file` to understand a file | `file_summary({ path })` | Structure, exports, imports, call edges — **10x fewer tokens** |
|
|
147
|
+
| `read_file` to find specific code | `compact({ path, query })` | Server-side read + semantic extract — **5-20x reduction** |
|
|
148
|
+
| Multiple `read_file` calls | `digest({ sources })` | Compresses multiple files into token-budgeted summary |
|
|
149
|
+
| `grep_search` / `textSearch` | `search({ query })` | Hybrid search across all indexed + curated content |
|
|
150
|
+
| `grep_search` for a symbol | `symbol({ name })` | Definition + references with scope context |
|
|
151
|
+
| Manual code tracing | `trace({ start, direction })` | AST call-graph traversal |
|
|
152
|
+
| Line counting / `wc` | `measure({ path })` | Lines, functions, cognitive complexity |
|
|
153
|
+
| `fetch_webpage` | `web_fetch({ urls })` | Readability extract + token budget |
|
|
154
|
+
| Web research / browsing | `web_search({ queries })` | Structured web results without browser |
|
|
155
|
+
|
|
156
|
+
**The ONLY acceptable use of `read_file`:** Reading exact lines immediately before an edit operation (e.g., to verify the `old_str` for a replacement). Even then, use `file_summary` first to identify which lines to read.
|
|
157
|
+
|
|
136
158
|
## FORGE Protocol (Quality Gate)
|
|
137
159
|
|
|
138
160
|
**Quick reference:**
|
|
@@ -231,10 +253,11 @@ For outdated AI Kit entries → `update(path, content, reason)`
|
|
|
231
253
|
|
|
232
254
|
## Context Efficiency
|
|
233
255
|
|
|
234
|
-
|
|
235
|
-
- **`
|
|
256
|
+
**NEVER use `read_file` to understand code.** Use the AI Kit compression tools:
|
|
257
|
+
- **`file_summary({ path })`** — Structure, exports, imports (~50 tokens vs ~1000+ for read_file)
|
|
258
|
+
- **`compact({ path, query })`** — Extract relevant sections from a single file (5-20x token reduction)
|
|
236
259
|
- **`digest({ sources })`** — Compress 3+ files into a single token-budgeted summary
|
|
237
|
-
- **`stratum_card({
|
|
260
|
+
- **`stratum_card({ files, query })`** — Generate a reusable T1/T2 context card for files you'll reference repeatedly
|
|
238
261
|
|
|
239
262
|
**Session phases** — structure your work to minimize context bloat:
|
|
240
263
|
|
|
@@ -290,12 +313,14 @@ When you need user input or need to explain something before asking:
|
|
|
290
313
|
| Simple explanation + question | **Elicitation** | Text-only explanation, then ask via elicitation fields |
|
|
291
314
|
| Rich content explanation + question | **`present` (mode: html)** + **Elicitation** | Use `present({ format: "html" })` for rich visual explanation (tables, charts, diagrams), then use elicitation for user input |
|
|
292
315
|
| Complex visual explanation | **`present` (mode: browser)** | Use `present({ format: "browser" })` for full HTML dashboard. Confirmation/selection can be handled via browser actions, but for other user input fall back to elicitation |
|
|
316
|
+
| **CLI mode** (any rich content) | **`present` (mode: browser)** | In CLI/terminal mode, **always use `format: "browser"`**. The `html` format's UIResource is invisible in terminal — only markdown fallback text renders. The `browser` format auto-opens the system browser. |
|
|
293
317
|
|
|
294
318
|
**Rules:**
|
|
295
319
|
- **Never dump long tables or complex visuals as plain text** — use `present` to render them properly
|
|
296
320
|
- **Confirmation selections** (yes/no, pick from list) can be handled inside browser mode via actions
|
|
297
321
|
- **Free-form text input** always goes through elicitation, even when using `present` for the explanation
|
|
298
322
|
- **Prefer the simplest method** that adequately conveys the information
|
|
323
|
+
- **CLI mode override:** When running in terminal (not VS Code chat), always use `format: "browser"` for any rich content
|
|
299
324
|
|
|
300
325
|
---
|
|
301
326
|
|
|
@@ -94,8 +94,10 @@ When invoked for a decision analysis, you receive a specific question. You MUST:
|
|
|
94
94
|
|
|
95
95
|
## Context Efficiency
|
|
96
96
|
|
|
97
|
-
- **
|
|
98
|
-
-
|
|
99
|
-
-
|
|
100
|
-
-
|
|
97
|
+
- **NEVER use `read_file` to understand code** — use AI Kit compression tools instead
|
|
98
|
+
- **`file_summary`** for structure (exports, imports, call edges — 10x fewer tokens)
|
|
99
|
+
- **`compact`** for specific sections (5-20x token reduction vs read_file)
|
|
100
|
+
- **`digest`** when synthesizing from 3+ sources
|
|
101
|
+
- **`stratum_card`** for files you'll reference repeatedly
|
|
102
|
+
- **`read_file` is ONLY acceptable** when you need exact lines for a pending edit operation
|
|
101
103
|
|
|
@@ -195,7 +195,7 @@ Lane actions: `create` (copy files to lane), `list`, `status` (modified/added/de
|
|
|
195
195
|
### Presentation (1)
|
|
196
196
|
| Tool | CLI | Purpose |
|
|
197
197
|
|------|-----|---------|
|
|
198
|
-
| `present` | — | Rich dashboards, charts, tables, timelines. Use `format: "browser"` then `openBrowserPage` to display |
|
|
198
|
+
| `present` | — | Rich dashboards, charts, tables, timelines. Use `format: "browser"` then `openBrowserPage` to display. **In CLI mode (no VS Code chat), always use `format: "browser"`** — `html` UIResource is invisible in terminal. |
|
|
199
199
|
|
|
200
200
|
### Brainstorming (1)
|
|
201
201
|
| Tool | CLI | Purpose |
|
|
@@ -278,12 +278,18 @@ install: []
|
|
|
278
278
|
|
|
279
279
|
## CRITICAL: Use AI Kit Tools Instead of Native IDE Tools
|
|
280
280
|
|
|
281
|
-
AI Kit tools provide **10x richer output** than native IDE tools — with AST-analyzed call graphs, scope context, import classification, and cognitive complexity. **
|
|
281
|
+
AI Kit tools provide **10x richer output** than native IDE tools — with AST-analyzed call graphs, scope context, import classification, and cognitive complexity. **You MUST use AI Kit tools instead of native read/search tools.**
|
|
282
|
+
|
|
283
|
+
### ⛔ PROHIBITED: Native File Reading
|
|
284
|
+
|
|
285
|
+
**`read_file` / `read_file_raw` MUST NOT be used to understand code.** They waste tokens and miss structural information.
|
|
286
|
+
|
|
287
|
+
The **ONLY** acceptable use of `read_file`: getting exact lines immediately before an edit (to verify the `old_str` for replacement). Even then, use `file_summary` first to identify which lines to read.
|
|
282
288
|
|
|
283
289
|
### Tool Replacement Table
|
|
284
290
|
|
|
285
|
-
|
|
|
286
|
-
|
|
291
|
+
| ❌ NEVER do this | ✅ Use AI Kit Tool | Why |
|
|
292
|
+
|---|---|---|
|
|
287
293
|
| `read_file` (full file) | `file_summary` | Exports, imports, call edges — **10x fewer tokens** |
|
|
288
294
|
| `read_file` (specific section) | `compact({ path, query })` | Server-side read + extract — **5-20x reduction** |
|
|
289
295
|
| `grep_search` / `textSearch` | `search` | Semantic + keyword hybrid across all indexed content |
|
|
@@ -301,11 +307,12 @@ AI Kit tools provide **10x richer output** than native IDE tools — with AST-an
|
|
|
301
307
|
|
|
302
308
|
```
|
|
303
309
|
Need to understand a file?
|
|
304
|
-
├─ Just structure?
|
|
305
|
-
├─ Specific section?
|
|
306
|
-
├─ Multiple files?
|
|
307
|
-
├─ Repeated reference?
|
|
308
|
-
|
|
310
|
+
├─ Just structure? → file_summary (exports, imports, call edges — ~50 tokens)
|
|
311
|
+
├─ Specific section? → compact({ path, query }) — 5-20x reduction
|
|
312
|
+
├─ Multiple files? → digest (multi-source compression — token-budgeted)
|
|
313
|
+
├─ Repeated reference? → stratum_card (T1/T2 card — 10-100x reduction)
|
|
314
|
+
├─ Need exact lines to EDIT? → read_file (the ONLY acceptable use)
|
|
315
|
+
└─ "I want to read the whole file" → ⛔ STOP. Use file_summary or compact instead.
|
|
309
316
|
```
|
|
310
317
|
|
|
311
318
|
### What AI Kit Tools Return (AST-Enhanced)
|
|
@@ -19,9 +19,12 @@ The `present` tool renders structured content as a professional dark-themed dash
|
|
|
19
19
|
| Need user input back (confirmations, selections, form data) | **`browser`** | Browser supports blocking actions that return data |
|
|
20
20
|
| Rich visual dashboards without interaction | **`html`** | Prefer in-chat when no response is needed |
|
|
21
21
|
| User explicitly asks for browser | **`browser`** | Respect explicit preference |
|
|
22
|
+
| **Running in CLI mode** (no VS Code chat panel) | **`browser`** | `html` UIResource is invisible in CLI — only plain markdown renders. Use `browser` so the system browser opens automatically with full rich visualization. |
|
|
22
23
|
|
|
23
24
|
**Rule: If no user interaction is needed, use `format: "html"`. If you need user interaction, use `format: "browser"`.**
|
|
24
25
|
|
|
26
|
+
> **⚠️ CLI Mode Override:** When running in CLI mode (terminal, not VS Code chat), **always use `format: "browser"`** regardless of whether interaction is needed. The `html` format relies on UIResource rendering in VS Code's MCP Apps panel — in CLI, only the markdown fallback text is shown, losing all rich visualizations (charts, tables, dashboards). The `browser` format starts a local HTTP server and auto-opens the system browser after 8 seconds, which works reliably in CLI.
|
|
27
|
+
|
|
25
28
|
---
|
|
26
29
|
|
|
27
30
|
## Browser Workflow (IMPORTANT — read carefully)
|
|
@@ -152,7 +155,7 @@ The dashboard uses a professional dark theme:
|
|
|
152
155
|
|
|
153
156
|
## Best Practices
|
|
154
157
|
|
|
155
|
-
1. **Use `browser` format** for data-rich content — charts, tables, dashboards
|
|
158
|
+
1. **Use `browser` format** for data-rich content — charts, tables, dashboards. **Always use `browser` in CLI mode** (the `html` UIResource doesn't render in terminal environments).
|
|
156
159
|
2. **Combine block types** — metrics + charts + tables in one page
|
|
157
160
|
3. **Add titles** to every block for clear section headings
|
|
158
161
|
4. **Use actions** when you need user decisions — the tool returns the selection
|