@vpxa/aikit 0.1.151 → 0.1.153
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/packages/blocks-core/dist/index.d.ts +471 -0
- package/packages/blocks-core/dist/index.js +863 -0
- package/packages/chunker/dist/index.d.ts +12 -0
- package/packages/chunker/dist/index.js +4 -4
- package/packages/cli/dist/index.js +15 -15
- package/packages/cli/dist/{init-Dk0WDziB.js → init-O57V8aOH.js} +1 -1
- package/packages/cli/dist/{scaffold-BB6OrTuA.js → scaffold-DwQDdiCJ.js} +1 -1
- package/packages/cli/dist/{templates-D4t_3cJs.js → templates-VOIHbNnT.js} +1 -1
- package/packages/present/dist/index.html +818 -3629
- package/packages/server/dist/index.js +1 -1
- package/packages/server/dist/server-Bs6Rib4s.js +398 -0
- package/packages/store/dist/index.js +12 -12
- package/scaffold/dist/adapters/_shared.mjs +2 -1
- package/scaffold/dist/adapters/claude-code.mjs +10 -9
- package/scaffold/dist/adapters/codex.mjs +3 -3
- package/scaffold/dist/adapters/copilot.mjs +20 -20
- package/scaffold/dist/adapters/gemini.mjs +9 -3
- package/scaffold/dist/definitions/agents.mjs +16 -120
- package/scaffold/dist/definitions/bodies.mjs +214 -254
- package/scaffold/dist/definitions/protocols.mjs +110 -206
- package/scaffold/dist/definitions/skills/adr-skill.mjs +27 -0
- package/scaffold/dist/definitions/skills/brainstorming.mjs +14 -0
- package/scaffold/dist/definitions/skills/browser-use.mjs +1 -1
- package/scaffold/dist/definitions/skills/c4-architecture.mjs +46 -1
- package/scaffold/dist/definitions/skills/docs.mjs +34 -0
- package/scaffold/dist/definitions/skills/frontend-design.mjs +20 -0
- package/scaffold/dist/definitions/skills/present.mjs +31 -0
- package/scaffold/dist/definitions/skills/session-handoff.mjs +20 -0
- package/packages/server/dist/server-D67lImHa.js +0 -540
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as e}from"node:module";import{existsSync as t,mkdirSync as n,readFileSync as r,renameSync as i,unlinkSync as a,writeFileSync as o}from"node:fs";import{dirname as s,join as c}from"node:path";import{AIKIT_PATHS as l,EMBEDDING_DEFAULTS as u,SEARCH_DEFAULTS as d,STORE_DEFAULTS as f,createLogger as p,serializeError as m,sourceTypeContentTypes as h}from"../../core/dist/index.js";var g=
|
|
1
|
+
import{createRequire as e}from"node:module";import{existsSync as t,mkdirSync as n,readFileSync as r,renameSync as i,unlinkSync as a,writeFileSync as o}from"node:fs";import{dirname as s,join as c}from"node:path";import{AIKIT_PATHS as l,EMBEDDING_DEFAULTS as u,SEARCH_DEFAULTS as d,STORE_DEFAULTS as f,createLogger as p,serializeError as m,sourceTypeContentTypes as h}from"../../core/dist/index.js";var g=e(import.meta.url);const _=p(`sqlite-adapter`),v=e(import.meta.url);var y=class{type=`better-sqlite3`;vectorCapable=!1;db=null;stmtCache=new Map;async open(e){let t;try{t=v(`better-sqlite3`)}catch(e){throw Error(`better-sqlite3 native binding unavailable: ${e instanceof Error?e.message:String(e)}`)}this.db=new t(e),this.db.pragma(`journal_mode = WAL`),this.db.pragma(`foreign_keys = ON`),this.db.pragma(`synchronous = NORMAL`);try{v(`sqlite-vec`).load(this.db),this.vectorCapable=!0,_.info(`sqlite-vec extension loaded`)}catch(e){this.vectorCapable=!1,_.warn(`sqlite-vec extension failed to load; vector search disabled`,m(e))}}exec(e){this.getDb().exec(e)}pragma(e){this.getDb().pragma(e)}queryAll(e,t=[]){let n=this.prepareCached(e);return t.length>0?n.all(...t):n.all()}run(e,t=[]){let n=this.prepareCached(e);t.length>0?n.run(...t):n.run()}flush(){}close(){this.db&&=(this.stmtCache.clear(),this.db.close(),null)}getDb(){if(!this.db)throw Error(`BetterSqlite3Adapter: database not opened`);return this.db}prepareCached(e){let t=this.stmtCache.get(e);if(t)return t;let n=this.getDb().prepare(e);return this.stmtCache.set(e,n),n}};function b(e){return v.resolve(`sql.js/dist/${e}`)}var x=class{type=`sql.js`;vectorCapable=!1;db=null;dbPath=``;dirty=!1;inTransaction=!1;async open(e){this.dbPath=e;let n=(await import(`sql.js`)).default,i=await n({locateFile:e=>b(e)});if(t(e)){let t=r(e);this.db=new i.Database(t)}else this.db=new i.Database}exec(e){let t=e.trimStart().toUpperCase();this.getDb().run(e),t.startsWith(`BEGIN`)?this.inTransaction=!0:(t.startsWith(`COMMIT`)||t.startsWith(`ROLLBACK`))&&(this.inTransaction=!1),this.dirty=!0}pragma(e){this.getDb().exec(`PRAGMA ${e}`)}queryAll(e,t=[]){let n=this.getDb().prepare(e);try{t.length>0&&n.bind(t);let e=[];for(;n.step();)e.push(n.getAsObject());return e}finally{n.free()}}run(e,t=[]){let n=this.getDb(),r=e.trimStart().toUpperCase(),i=!this.inTransaction&&(r.startsWith(`INSERT`)||r.startsWith(`UPDATE`));i&&n.run(`SAVEPOINT fk_check`);try{if(t.length>0){let r=n.prepare(e);try{r.bind(t),r.step()}finally{r.free()}}else n.run(e);if(i){if(n.exec(`PRAGMA foreign_key_check`).length>0)throw n.run(`ROLLBACK TO fk_check`),n.run(`RELEASE fk_check`),Error(`FOREIGN KEY constraint failed`);n.run(`RELEASE fk_check`)}}catch(e){if(i)try{n.run(`ROLLBACK TO fk_check`),n.run(`RELEASE fk_check`)}catch{}throw e}this.dirty=!0}flush(){if(!this.dirty||!this.db)return;let e=this.db.export(),r=`${this.dbPath}.tmp`,a=s(this.dbPath);a&&!t(a)&&n(a,{recursive:!0}),o(r,Buffer.from(e)),i(r,this.dbPath),this.dirty=!1}close(){if(this.db){let e=this.db,t;try{this.flush()}catch(e){t=e;try{a(`${this.dbPath}.tmp`)}catch{}}try{e.close()}finally{this.db=null}if(t)throw t}}getDb(){if(!this.db)throw Error(`SqlJsAdapter: database not opened`);return this.db}};async function S(){try{let{execSync:e}=await import(`node:child_process`),{createRequire:t}=await import(`node:module`),n=t(import.meta.url).resolve(`better-sqlite3/package.json`).replace(/[\\/]package\.json$/,``).replace(/[\\/]node_modules[\\/]better-sqlite3$/,``);return _.info(`Attempting native module rebuild for better-sqlite3`,{cwd:n}),e(`npm rebuild better-sqlite3`,{cwd:n,stdio:`pipe`,timeout:6e4}),_.info(`Native module rebuild completed successfully`),!0}catch(e){return _.warn(`Native module rebuild failed — continuing with sql.js fallback`,m(e)),!1}}let C=!1;async function w(e){let t=new y;try{return await t.open(e),t}catch(t){let n=t instanceof Error?t.message:String(t);if(/NODE_MODULE_VERSION/.test(n)&&await S()){let t=new y;try{return await t.open(e),_.info(`better-sqlite3 recovered after native module rebuild`),t}catch{}}C||(C=!0,_.warn(`[aikit] better-sqlite3 unavailable — falling back to sql.js (vector search disabled). Reinstall with prebuild support or rebuild from source to enable vector search.`,m(t)))}let n=new x;try{return await n.open(e),n}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`[aikit] SQLite adapter "sql.js" failed to load: ${t}`)}}async function T(e){let t=new x;return await t.open(e),t}var E=class{adapter=null;reopenPromise=null;dbPath;externalAdapter;constructor(e={}){if(e.adapter)this.adapter=e.adapter,this.externalAdapter=!0,this.dbPath=``;else{let t=e.path??l.data;this.dbPath=c(t,`graph.db`),this.externalAdapter=!1}}async initialize(){if(this.externalAdapter){let e=this.getAdapter();this.createTables(e),this.migrateSchema(e),e.flush();return}let e=s(this.dbPath);t(e)||n(e,{recursive:!0}),this.adapter=await w(this.dbPath),this.configureAdapter(this.adapter),this.createTables(this.adapter),this.migrateSchema(this.adapter),this.adapter.flush()}configureAdapter(e){e.pragma(`journal_mode = WAL`),e.pragma(`foreign_keys = ON`)}createTables(e){e.exec(`
|
|
2
2
|
CREATE TABLE IF NOT EXISTS nodes (
|
|
3
3
|
id TEXT PRIMARY KEY,
|
|
4
4
|
type TEXT NOT NULL,
|
|
@@ -39,7 +39,7 @@ import{createRequire as e}from"node:module";import{existsSync as t,mkdirSync as
|
|
|
39
39
|
FOREIGN KEY (process_id) REFERENCES processes(id) ON DELETE CASCADE,
|
|
40
40
|
FOREIGN KEY (node_id) REFERENCES nodes(id) ON DELETE CASCADE
|
|
41
41
|
)
|
|
42
|
-
`),e.exec(`CREATE INDEX IF NOT EXISTS idx_process_steps_node ON process_steps(node_id)`)}migrateSchema(e){for(let t of[`ALTER TABLE edges ADD COLUMN confidence REAL DEFAULT 1.0`,`ALTER TABLE nodes ADD COLUMN community TEXT`])try{e.exec(t)}catch{}e.exec(`CREATE INDEX IF NOT EXISTS idx_nodes_community ON nodes(community)`)}getAdapter(){if(!this.adapter)throw Error(`SqliteGraphStore not initialized — call initialize() first`);return this.adapter}async ensureOpen(){if(this.adapter)return;if(this.externalAdapter)throw Error(`SqliteGraphStore: external adapter has been closed by its owner; cannot reopen`);if(this.reopenPromise)return this.reopenPromise;let e=this.reopenAdapter();this.reopenPromise=e;try{await e}finally{this.reopenPromise===e&&(this.reopenPromise=null)}}async reopenAdapter(){let e=await
|
|
42
|
+
`),e.exec(`CREATE INDEX IF NOT EXISTS idx_process_steps_node ON process_steps(node_id)`)}migrateSchema(e){for(let t of[`ALTER TABLE edges ADD COLUMN confidence REAL DEFAULT 1.0`,`ALTER TABLE nodes ADD COLUMN community TEXT`])try{e.exec(t)}catch{}e.exec(`CREATE INDEX IF NOT EXISTS idx_nodes_community ON nodes(community)`)}getAdapter(){if(!this.adapter)throw Error(`SqliteGraphStore not initialized — call initialize() first`);return this.adapter}async ensureOpen(){if(this.adapter)return;if(this.externalAdapter)throw Error(`SqliteGraphStore: external adapter has been closed by its owner; cannot reopen`);if(this.reopenPromise)return this.reopenPromise;let e=this.reopenAdapter();this.reopenPromise=e;try{await e}finally{this.reopenPromise===e&&(this.reopenPromise=null)}}async reopenAdapter(){let e=await w(this.dbPath);this.configureAdapter(e),this.adapter=e}query(e,t=[]){return this.getAdapter().queryAll(e,t)}run(e,t=[]){this.getAdapter().run(e,t)}async upsertNode(e){await this.ensureOpen(),this.run(`INSERT INTO nodes (id, type, name, properties, source_record_id, source_path, created_at, community)
|
|
43
43
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
44
44
|
ON CONFLICT(id) DO UPDATE SET
|
|
45
45
|
type = excluded.type, name = excluded.name, properties = excluded.properties,
|
|
@@ -57,19 +57,19 @@ import{createRequire as e}from"node:module";import{existsSync as t,mkdirSync as
|
|
|
57
57
|
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
58
58
|
ON CONFLICT(id) DO UPDATE SET
|
|
59
59
|
from_id = excluded.from_id, to_id = excluded.to_id,
|
|
60
|
-
type = excluded.type, weight = excluded.weight, confidence = excluded.confidence, properties = excluded.properties`,[t.id,t.fromId,t.toId,t.type,t.weight??1,t.confidence??1,JSON.stringify(t.properties??{})]);t.exec(`COMMIT`),t.flush()}catch(e){throw t.exec(`ROLLBACK`),e}finally{t.pragma(`foreign_keys = ON`)}}async getNode(e){await this.ensureOpen();let t=this.query(`SELECT * FROM nodes WHERE id = ?`,[e]);return t.length>0?
|
|
60
|
+
type = excluded.type, weight = excluded.weight, confidence = excluded.confidence, properties = excluded.properties`,[t.id,t.fromId,t.toId,t.type,t.weight??1,t.confidence??1,JSON.stringify(t.properties??{})]);t.exec(`COMMIT`),t.flush()}catch(e){throw t.exec(`ROLLBACK`),e}finally{t.pragma(`foreign_keys = ON`)}}async getNode(e){await this.ensureOpen();let t=this.query(`SELECT * FROM nodes WHERE id = ?`,[e]);return t.length>0?O(t[0]):null}async getNeighbors(e,t){await this.ensureOpen();let n=t?.direction??`both`,r=t?.edgeType,i=t?.limit??50,a=[],o=[],s=new Set;if(n===`outgoing`||n===`both`){let t=`
|
|
61
61
|
SELECT e.id AS edge_id, e.from_id, e.to_id, e.type AS edge_type, e.weight,
|
|
62
62
|
e.confidence AS edge_confidence, e.properties AS edge_props,
|
|
63
63
|
n.id AS node_id, n.type AS node_type, n.name AS node_name, n.properties AS node_props,
|
|
64
64
|
n.source_record_id AS node_src_rec, n.source_path AS node_src_path,
|
|
65
65
|
n.created_at AS node_created, n.community AS node_community
|
|
66
|
-
FROM edges e JOIN nodes n ON e.to_id = n.id WHERE e.from_id = ?`,n=[e];r&&(t+=` AND e.type = ?`,n.push(r)),t+=` LIMIT ?`,n.push(i);let c=this.query(t,n);for(let e of c)o.push(
|
|
66
|
+
FROM edges e JOIN nodes n ON e.to_id = n.id WHERE e.from_id = ?`,n=[e];r&&(t+=` AND e.type = ?`,n.push(r)),t+=` LIMIT ?`,n.push(i);let c=this.query(t,n);for(let e of c)o.push(A(e)),s.has(e.node_id)||(s.add(e.node_id),a.push(j(e)))}if(n===`incoming`||n===`both`){let t=`
|
|
67
67
|
SELECT e.id AS edge_id, e.from_id, e.to_id, e.type AS edge_type, e.weight,
|
|
68
68
|
e.confidence AS edge_confidence, e.properties AS edge_props,
|
|
69
69
|
n.id AS node_id, n.type AS node_type, n.name AS node_name, n.properties AS node_props,
|
|
70
70
|
n.source_record_id AS node_src_rec, n.source_path AS node_src_path,
|
|
71
71
|
n.created_at AS node_created, n.community AS node_community
|
|
72
|
-
FROM edges e JOIN nodes n ON e.from_id = n.id WHERE e.to_id = ?`,n=[e];r&&(t+=` AND e.type = ?`,n.push(r)),t+=` LIMIT ?`,n.push(i);let c=this.query(t,n);for(let e of c)o.push(
|
|
72
|
+
FROM edges e JOIN nodes n ON e.from_id = n.id WHERE e.to_id = ?`,n=[e];r&&(t+=` AND e.type = ?`,n.push(r)),t+=` LIMIT ?`,n.push(i);let c=this.query(t,n);for(let e of c)o.push(A(e)),s.has(e.node_id)||(s.add(e.node_id),a.push(j(e)))}return{nodes:a,edges:o}}async traverse(e,t){await this.ensureOpen();let n=t?.maxDepth??2,r=t?.direction??`both`,i=t?.edgeType,a=t?.limit??50,o=new Map,s=new Map,c=new Set,l=[{nodeId:e,depth:0}];for(;l.length>0&&o.size<a;){let e=l.shift();if(!e||c.has(e.nodeId)||e.depth>n)continue;c.add(e.nodeId);let t=await this.getNeighbors(e.nodeId,{direction:r,edgeType:i,limit:a-o.size});for(let r of t.nodes)o.has(r.id)||(o.set(r.id,r),e.depth+1<n&&l.push({nodeId:r.id,depth:e.depth+1}));for(let e of t.edges)s.set(e.id,e)}return{nodes:[...o.values()],edges:[...s.values()]}}async findNodes(e){await this.ensureOpen();let t=[],n=[];e.type&&(t.push(`type = ?`),n.push(e.type)),e.namePattern&&(t.push(`name LIKE ?`),n.push(`%${e.namePattern}%`)),e.sourcePath&&(t.push(`source_path = ?`),n.push(e.sourcePath));let r=t.length>0?`WHERE ${t.join(` AND `)}`:``,i=e.limit??100;return this.query(`SELECT * FROM nodes ${r} LIMIT ?`,[...n,i]).map(e=>O(e))}async findEdges(e){await this.ensureOpen();let t=[],n=[];e.type&&(t.push(`type = ?`),n.push(e.type)),e.fromId&&(t.push(`from_id = ?`),n.push(e.fromId)),e.toId&&(t.push(`to_id = ?`),n.push(e.toId));let r=t.length>0?`WHERE ${t.join(` AND `)}`:``,i=e.limit??100;return this.query(`SELECT * FROM edges ${r} LIMIT ?`,[...n,i]).map(e=>k(e))}async deleteNode(e){await this.ensureOpen();let t=this.getAdapter();t.exec(`BEGIN TRANSACTION`);try{this.run(`DELETE FROM edges WHERE from_id = ? OR to_id = ?`,[e,e]),this.run(`DELETE FROM nodes WHERE id = ?`,[e]),t.exec(`COMMIT`),t.flush()}catch(e){throw t.exec(`ROLLBACK`),e}}async deleteBySourcePath(e){await this.ensureOpen();let t=this.query(`SELECT id FROM nodes WHERE source_path = ?`,[e]);if(t.length===0)return 0;let n=this.getAdapter();n.exec(`BEGIN TRANSACTION`);try{for(let e of t)this.run(`DELETE FROM edges WHERE from_id = ? OR to_id = ?`,[e.id,e.id]);this.run(`DELETE FROM nodes WHERE source_path = ?`,[e]),n.exec(`COMMIT`),n.flush()}catch(e){throw n.exec(`ROLLBACK`),e}return t.length}async clear(){await this.ensureOpen();let e=this.getAdapter();e.exec(`BEGIN TRANSACTION`);try{this.run(`DELETE FROM process_steps`),this.run(`DELETE FROM processes`),this.run(`DELETE FROM edges`),this.run(`DELETE FROM nodes`),e.exec(`COMMIT`)}catch(t){throw e.exec(`ROLLBACK`),t}e.flush()}async getStats(){await this.ensureOpen();let e=this.query(`SELECT COUNT(*) as count FROM nodes`)[0]?.count??0,t=this.query(`SELECT COUNT(*) as count FROM edges`)[0]?.count??0,n=this.query(`SELECT type, COUNT(*) as count FROM nodes GROUP BY type`),r={};for(let e of n)r[e.type]=e.count;let i=this.query(`SELECT type, COUNT(*) as count FROM edges GROUP BY type`),a={};for(let e of i)a[e.type]=e.count;return{nodeCount:e,edgeCount:t,nodeTypes:r,edgeTypes:a}}async validate(){await this.ensureOpen();let e=await this.getStats(),t=this.query(`SELECT e.id AS edgeId,
|
|
73
73
|
CASE
|
|
74
74
|
WHEN n1.id IS NULL THEN e.from_id
|
|
75
75
|
WHEN n2.id IS NULL THEN e.to_id
|
|
@@ -87,7 +87,7 @@ import{createRequire as e}from"node:module";import{existsSync as t,mkdirSync as
|
|
|
87
87
|
VALUES (?, ?, ?, '{}', ?)`,[a,e,t,o]);for(let e=0;e<n.length;e++)this.run(`INSERT INTO process_steps (process_id, node_id, step_order) VALUES (?, ?, ?)`,[a,n[e],e]);s.exec(`COMMIT`),s.flush()}catch(e){throw s.exec(`ROLLBACK`),e}return{id:a,entryNodeId:e,label:t,properties:{},steps:n,createdAt:o}}async getProcesses(e){await this.ensureOpen();let t;t=e?this.query(`SELECT DISTINCT p.id, p.entry_node_id, p.label, p.properties, p.created_at
|
|
88
88
|
FROM processes p
|
|
89
89
|
JOIN process_steps ps ON p.id = ps.process_id
|
|
90
|
-
WHERE ps.node_id = ?`,[e]):this.query(`SELECT * FROM processes`);let n=[];for(let e of t){let t=this.query(`SELECT node_id FROM process_steps WHERE process_id = ? ORDER BY step_order`,[e.id]);n.push({id:e.id,entryNodeId:e.entry_node_id,label:e.label,properties:
|
|
90
|
+
WHERE ps.node_id = ?`,[e]):this.query(`SELECT * FROM processes`);let n=[];for(let e of t){let t=this.query(`SELECT node_id FROM process_steps WHERE process_id = ? ORDER BY step_order`,[e.id]);n.push({id:e.id,entryNodeId:e.entry_node_id,label:e.label,properties:D(e.properties),steps:t.map(e=>e.node_id),createdAt:e.created_at})}return n}async deleteProcess(e){await this.ensureOpen();let t=this.getAdapter();t.exec(`BEGIN TRANSACTION`);try{this.run(`DELETE FROM process_steps WHERE process_id = ?`,[e]),this.run(`DELETE FROM processes WHERE id = ?`,[e]),t.exec(`COMMIT`),t.flush()}catch(e){throw t.exec(`ROLLBACK`),e}}async depthGroupedTraversal(e,t=3,n){await this.ensureOpen();let r=n?.direction??`both`,i=n?.edgeType,a=n?.limit??100,o={},s=new Set;s.add(e);let c=[e];for(let e=1;e<=t;e++){let t=[],n=[];for(let e of c){let o=await this.getNeighbors(e,{direction:r,edgeType:i,limit:a});for(let e of o.nodes)s.has(e.id)||(s.add(e.id),t.push(e.id),n.push(e))}if(n.length>0&&(o[e]=n),c=t,c.length===0||s.size>=a)break}return o}async getCohesionScore(e){await this.ensureOpen();let t=this.query(`SELECT id FROM nodes WHERE community = ?`,[e]);if(t.length===0)return 0;let n=new Set(t.map(e=>e.id)),r=t.map(()=>`?`).join(`,`),i=t.map(e=>e.id),a=this.query(`SELECT from_id, to_id FROM edges WHERE from_id IN (${r}) OR to_id IN (${r})`,[...i,...i]);if(a.length===0)return 0;let o=0;for(let e of a)n.has(e.from_id)&&n.has(e.to_id)&&o++;return o/a.length}async getSymbol360(e){let t=await this.getNode(e);if(!t)throw Error(`Node '${e}' not found`);let n=await this.findEdges({toId:e}),r=await this.findEdges({fromId:e}),i=await this.getProcesses(e);return{node:t,incoming:n,outgoing:r,community:t.community??null,processes:i}}releaseMemory(){if(this.adapter)try{this.adapter.exec(`PRAGMA shrink_memory`),this.adapter.exec(`PRAGMA wal_checkpoint(TRUNCATE)`)}catch{}}async close(){this.adapter&&=(this.externalAdapter||this.adapter.close(),null)}};function D(e){if(!e)return{};try{return JSON.parse(e)}catch{return{}}}function O(e){return{id:e.id,type:e.type,name:e.name,properties:D(e.properties),sourceRecordId:e.source_record_id??void 0,sourcePath:e.source_path??void 0,createdAt:e.created_at,community:e.community??void 0}}function k(e){return{id:e.id,fromId:e.from_id,toId:e.to_id,type:e.type,weight:e.weight??1,confidence:e.confidence??1,properties:D(e.properties)}}function A(e){return{id:e.edge_id,fromId:e.from_id,toId:e.to_id,type:e.edge_type,weight:e.weight??1,confidence:e.edge_confidence??1,properties:D(e.edge_props??`{}`)}}function j(e){return{id:e.node_id,type:e.node_type,name:e.node_name,properties:D(e.node_props??`{}`),sourceRecordId:e.node_src_rec??void 0,sourcePath:e.node_src_path??void 0,createdAt:e.node_created,community:e.node_community??void 0}}function M(e){let t=0;for(let n=0;n<e.length;n++){let r=e[n]<0?-e[n]:e[n];r>t&&(t=r)}let n=new Int8Array(e.length);if(t===0)return Buffer.from(n.buffer,n.byteOffset,n.byteLength);let r=127/t;for(let t=0;t<e.length;t++){let i=Math.round(e[t]*r);n[t]=i<-127?-127:i>127?127:i}return Buffer.from(n.buffer,n.byteOffset,n.byteLength)}const N=/^[\w.\-/ ]+$/,P=p(`sqlite-vec-store`);function F(e){if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function I(e,t){if(!N.test(e))throw Error(`Invalid ${t} filter value: contains disallowed characters`);return e}var L=class{adapter=null;externalAdapter;dbPath;embeddingDim;coarseDim;vectorEnabled=!1;ftsEnabled=!1;warnedVectorDisabled=!1;_draining=!1;_priorityQueue=[];_normalQueue=[];_onCloseHooks=[];constructor(e={}){this.embeddingDim=e.embeddingDim??u.dimensions,this.coarseDim=Math.min(128,this.embeddingDim),e.adapter?(this.adapter=e.adapter,this.externalAdapter=!0,this.dbPath=``):(this.dbPath=e.path??`${f.path}/aikit.db`,this.externalAdapter=!1)}async initialize(){if(!this.adapter){let e=s(this.dbPath);t(e)||n(e,{recursive:!0}),this.adapter=await w(this.dbPath)}this.vectorEnabled=this.adapter.vectorCapable,this.createKnowledgeTable(),this.createFtsTable(),this.vectorEnabled?this.ensureVecTable():this.warnedVectorDisabled||(this.warnedVectorDisabled=!0,P.warn(`SqliteVecStore: vector search disabled (sqlite-vec extension not loaded). Hybrid search will return FTS-only results.`))}getDiagnostics(){let e=this.adapter,t=e?e.constructor.name:`unknown`,n=null,r=this.externalAdapter?``:this.dbPath;if(r)try{let{statSync:e}=g(`node:fs`);n=e(r).size}catch{n=null}return{adapterType:t,vectorSearchEnabled:this.vectorEnabled,ftsEnabled:this.ftsEnabled,degradedMode:!this.vectorEnabled,dbPath:r,dbSizeBytes:n,embeddingDim:this.embeddingDim,vectorDtype:`int8`}}createKnowledgeTable(){let e=this.getAdapter();e.exec(`
|
|
91
91
|
CREATE TABLE IF NOT EXISTS knowledge (
|
|
92
92
|
id TEXT PRIMARY KEY,
|
|
93
93
|
content TEXT NOT NULL,
|
|
@@ -112,7 +112,7 @@ import{createRequire as e}from"node:module";import{existsSync as t,mkdirSync as
|
|
|
112
112
|
content,
|
|
113
113
|
tokenize = 'unicode61 remove_diacritics 2'
|
|
114
114
|
)
|
|
115
|
-
`),this.ftsEnabled=!0}catch(e){this.ftsEnabled=!1,
|
|
115
|
+
`),this.ftsEnabled=!0}catch(e){this.ftsEnabled=!1,P.warn(`FTS5 unavailable — keyword search disabled`,m(e))}}ensureVecTable(){let e=this.getAdapter(),t=e.queryAll(`SELECT name, sql FROM sqlite_master WHERE type='table' AND name='vec_knowledge'`);if(t.length>0){let n=t[0].sql??``,r=n.match(/(?:float|int8)\[(\d+)\]/i),i=r?Number(r[1]):null,a=/int8\[/i.test(n);(i!==null&&i!==this.embeddingDim||!a)&&(P.warn(`Vec table schema mismatch — dropping for recreation`,{existingDim:i,newDim:this.embeddingDim,wasInt8:a}),e.exec(`DROP TABLE vec_knowledge`))}e.exec(`
|
|
116
116
|
CREATE VIRTUAL TABLE IF NOT EXISTS vec_knowledge USING vec0(
|
|
117
117
|
embedding int8[${this.embeddingDim}] distance_metric=cosine,
|
|
118
118
|
+knowledge_id TEXT
|
|
@@ -122,7 +122,7 @@ import{createRequire as e}from"node:module";import{existsSync as t,mkdirSync as
|
|
|
122
122
|
embedding int8[${this.coarseDim}] distance_metric=cosine,
|
|
123
123
|
+knowledge_id TEXT
|
|
124
124
|
)
|
|
125
|
-
`)}enqueueWrite(e,t=!1){return new Promise((n,r)=>{let i=async()=>{try{n(await e())}catch(e){r(e)}};t?this._priorityQueue.push(i):this._normalQueue.push(i),this._drain()})}async _drain(){if(!this._draining){this._draining=!0;try{for(;this._priorityQueue.length>0||this._normalQueue.length>0;){let e=this._priorityQueue.shift()??this._normalQueue.shift();e&&await e()}}finally{this._draining=!1}}}async upsert(e,t){if(e.length!==0){if(e.length!==t.length)throw Error(`Record count (${e.length}) does not match vector count (${t.length})`);for(let n=0;n<t.length;n++)if(t[n].length===0)throw Error(`Zero-length vector at index ${n} for record ${e[n].sourcePath}`);return this.enqueueWrite(()=>this._upsertImpl(e,t))}}async upsertInteractive(e,t){if(e.length!==0){if(e.length!==t.length)throw Error(`Record count (${e.length}) does not match vector count (${t.length})`);for(let n=0;n<t.length;n++)if(t[n].length===0)throw Error(`Zero-length vector at index ${n} for record ${e[n].sourcePath}`);return this.enqueueWrite(()=>this._upsertImpl(e,t),!0)}}async upsertWithoutVector(e,t){return this.enqueueWrite(async()=>{let n=this.getAdapter(),r=e;n.exec(`BEGIN`);try{if(this.upsertKnowledgeRow(r),this.ftsEnabled&&(n.run(`DELETE FROM knowledge_fts WHERE id = ?`,[r.id]),n.run(`INSERT INTO knowledge_fts (id, content) VALUES (?, ?)`,[r.id,r.content])),this.vectorEnabled){let e=n.queryAll(`SELECT embedding FROM vec_knowledge WHERE knowledge_id = ?`,[t]);if(e.length>0){if(n.run(`DELETE FROM vec_knowledge WHERE knowledge_id = ?`,[r.id]),n.run(`INSERT INTO vec_knowledge (embedding, knowledge_id) VALUES (vec_int8(?), ?)`,[e[0].embedding,r.id]),this.coarseDim<this.embeddingDim){let e=n.queryAll(`SELECT embedding FROM vec_knowledge_coarse WHERE knowledge_id = ?`,[t]);e.length>0&&(n.run(`DELETE FROM vec_knowledge_coarse WHERE knowledge_id = ?`,[r.id]),n.run(`INSERT INTO vec_knowledge_coarse (embedding, knowledge_id) VALUES (vec_int8(?), ?)`,[e[0].embedding,r.id]))}}else
|
|
125
|
+
`)}enqueueWrite(e,t=!1){return new Promise((n,r)=>{let i=async()=>{try{n(await e())}catch(e){r(e)}};t?this._priorityQueue.push(i):this._normalQueue.push(i),this._drain()})}async _drain(){if(!this._draining){this._draining=!0;try{for(;this._priorityQueue.length>0||this._normalQueue.length>0;){let e=this._priorityQueue.shift()??this._normalQueue.shift();e&&await e()}}finally{this._draining=!1}}}async upsert(e,t){if(e.length!==0){if(e.length!==t.length)throw Error(`Record count (${e.length}) does not match vector count (${t.length})`);for(let n=0;n<t.length;n++)if(t[n].length===0)throw Error(`Zero-length vector at index ${n} for record ${e[n].sourcePath}`);return this.enqueueWrite(()=>this._upsertImpl(e,t))}}async upsertInteractive(e,t){if(e.length!==0){if(e.length!==t.length)throw Error(`Record count (${e.length}) does not match vector count (${t.length})`);for(let n=0;n<t.length;n++)if(t[n].length===0)throw Error(`Zero-length vector at index ${n} for record ${e[n].sourcePath}`);return this.enqueueWrite(()=>this._upsertImpl(e,t),!0)}}async upsertWithoutVector(e,t){return this.enqueueWrite(async()=>{let n=this.getAdapter(),r=e;n.exec(`BEGIN`);try{if(this.upsertKnowledgeRow(r),this.ftsEnabled&&(n.run(`DELETE FROM knowledge_fts WHERE id = ?`,[r.id]),n.run(`INSERT INTO knowledge_fts (id, content) VALUES (?, ?)`,[r.id,r.content])),this.vectorEnabled){let e=n.queryAll(`SELECT embedding FROM vec_knowledge WHERE knowledge_id = ?`,[t]);if(e.length>0){if(n.run(`DELETE FROM vec_knowledge WHERE knowledge_id = ?`,[r.id]),n.run(`INSERT INTO vec_knowledge (embedding, knowledge_id) VALUES (vec_int8(?), ?)`,[e[0].embedding,r.id]),this.coarseDim<this.embeddingDim){let e=n.queryAll(`SELECT embedding FROM vec_knowledge_coarse WHERE knowledge_id = ?`,[t]);e.length>0&&(n.run(`DELETE FROM vec_knowledge_coarse WHERE knowledge_id = ?`,[r.id]),n.run(`INSERT INTO vec_knowledge_coarse (embedding, knowledge_id) VALUES (vec_int8(?), ?)`,[e[0].embedding,r.id]))}}else P.warn(`upsertWithoutVector: source vector not found, record will lack vector`,{recordId:r.id,sourceRecordId:t})}n.exec(`COMMIT`)}catch(e){try{n.exec(`ROLLBACK`)}catch{}throw e}n.flush()})}upsertKnowledgeRow(e){this.getAdapter().run(`INSERT INTO knowledge (id, content, sourcePath, contentType, headingPath, chunkIndex,
|
|
126
126
|
totalChunks, startLine, endLine, fileHash, content_hash, indexedAt, origin, tags, category, version)
|
|
127
127
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
128
128
|
ON CONFLICT(id) DO UPDATE SET
|
|
@@ -140,7 +140,7 @@ import{createRequire as e}from"node:module";import{existsSync as t,mkdirSync as
|
|
|
140
140
|
origin = excluded.origin,
|
|
141
141
|
tags = excluded.tags,
|
|
142
142
|
category = excluded.category,
|
|
143
|
-
version = excluded.version`,[e.id,e.content,e.sourcePath,e.contentType,e.headingPath??``,e.chunkIndex,e.totalChunks,e.startLine,e.endLine,e.fileHash,e.contentHash??``,e.indexedAt,e.origin,JSON.stringify(e.tags??[]),e.category??``,e.version])}async _upsertImpl(e,t){let n=this.getAdapter();n.exec(`BEGIN`);try{for(let r=0;r<e.length;r++){let i=e[r];if(this.upsertKnowledgeRow(i),this.ftsEnabled&&(n.run(`DELETE FROM knowledge_fts WHERE id = ?`,[i.id]),n.run(`INSERT INTO knowledge_fts (id, content) VALUES (?, ?)`,[i.id,i.content])),this.vectorEnabled&&(n.run(`DELETE FROM vec_knowledge WHERE knowledge_id = ?`,[i.id]),n.run(`INSERT INTO vec_knowledge (embedding, knowledge_id) VALUES (vec_int8(?), ?)`,[
|
|
143
|
+
version = excluded.version`,[e.id,e.content,e.sourcePath,e.contentType,e.headingPath??``,e.chunkIndex,e.totalChunks,e.startLine,e.endLine,e.fileHash,e.contentHash??``,e.indexedAt,e.origin,JSON.stringify(e.tags??[]),e.category??``,e.version])}async _upsertImpl(e,t){let n=this.getAdapter();n.exec(`BEGIN`);try{for(let r=0;r<e.length;r++){let i=e[r];if(this.upsertKnowledgeRow(i),this.ftsEnabled&&(n.run(`DELETE FROM knowledge_fts WHERE id = ?`,[i.id]),n.run(`INSERT INTO knowledge_fts (id, content) VALUES (?, ?)`,[i.id,i.content])),this.vectorEnabled&&(n.run(`DELETE FROM vec_knowledge WHERE knowledge_id = ?`,[i.id]),n.run(`INSERT INTO vec_knowledge (embedding, knowledge_id) VALUES (vec_int8(?), ?)`,[M(t[r]),i.id]),this.coarseDim<this.embeddingDim)){let e=t[r].subarray(0,this.coarseDim);n.run(`DELETE FROM vec_knowledge_coarse WHERE knowledge_id = ?`,[i.id]),n.run(`INSERT INTO vec_knowledge_coarse (embedding, knowledge_id) VALUES (vec_int8(?), ?)`,[M(e),i.id])}}n.exec(`COMMIT`)}catch(e){try{n.exec(`ROLLBACK`)}catch{}throw e}n.flush()}async search(e,t){if(e.length===0)return[];if(!this.vectorEnabled)return this.warnedVectorDisabled||(this.warnedVectorDisabled=!0,P.warn(`search() called but vector backend is disabled — returning []`)),[];let n=this.getAdapter(),r=t?.limit??d.maxResults,i=t?.minScore??d.minScore,a=r*4,o=`
|
|
144
144
|
SELECT k.*, v.distance AS _distance
|
|
145
145
|
FROM (
|
|
146
146
|
SELECT knowledge_id, distance
|
|
@@ -153,7 +153,7 @@ import{createRequire as e}from"node:module";import{existsSync as t,mkdirSync as
|
|
|
153
153
|
${this.buildFilterSqlSuffix(t)}
|
|
154
154
|
ORDER BY v.distance ASC
|
|
155
155
|
LIMIT ?
|
|
156
|
-
`,s;try{s=n.queryAll(o,[
|
|
156
|
+
`,s;try{s=n.queryAll(o,[M(e),a,r])}catch(e){return P.warn(`vector search failed`,m(e)),[]}return s.map(e=>({record:this.fromRow(e),score:1-(e._distance??1)})).filter(e=>e.score>=i).slice(0,r)}async coarseSearch(e,t){if(!this.vectorEnabled||this.coarseDim>=this.embeddingDim)return this.search(e,t);let n=this.getAdapter(),r=t?.limit??d.maxResults,i=t?.minScore??d.minScore,a=r*4,o=e.subarray(0,this.coarseDim),s=`
|
|
157
157
|
SELECT k.*, v.distance AS _distance
|
|
158
158
|
FROM (
|
|
159
159
|
SELECT knowledge_id, distance
|
|
@@ -166,7 +166,7 @@ import{createRequire as e}from"node:module";import{existsSync as t,mkdirSync as
|
|
|
166
166
|
${this.buildFilterSqlSuffix(t)}
|
|
167
167
|
ORDER BY v.distance ASC
|
|
168
168
|
LIMIT ?
|
|
169
|
-
`,c;try{c=n.queryAll(s,[
|
|
169
|
+
`,c;try{c=n.queryAll(s,[M(o),a,r])}catch(n){return P.warn(`coarse vector search failed, falling back to full search`,m(n)),this.search(e,t)}return c.length===0?this.search(e,t):c.map(e=>({record:this.fromRow(e),score:1-(e._distance??1)})).filter(e=>e.score>=i).slice(0,r)}async ftsSearch(e,t){if(!e||e.trim().length===0||!this.ftsEnabled)return[];let n=this.getAdapter(),r=t?.limit??d.maxResults,i=`
|
|
170
170
|
SELECT k.*, bm25(knowledge_fts) AS _bm25
|
|
171
171
|
FROM knowledge_fts
|
|
172
172
|
JOIN knowledge k ON k.id = knowledge_fts.id
|
|
@@ -174,4 +174,4 @@ import{createRequire as e}from"node:module";import{existsSync as t,mkdirSync as
|
|
|
174
174
|
${this.buildFilterSqlSuffix(t,!0)}
|
|
175
175
|
ORDER BY _bm25 ASC
|
|
176
176
|
LIMIT ?
|
|
177
|
-
`,a;try{let t=
|
|
177
|
+
`,a;try{let t=R(e);a=n.queryAll(i,[t,r])}catch(e){return P.warn(`fts search failed`,m(e)),[]}return a.map(e=>({record:this.fromRow(e),score:z(e._bm25)}))}async getById(e){let t=this.getAdapter().queryAll(`SELECT * FROM knowledge WHERE id = ? LIMIT 1`,[e]);return t.length===0?null:this.fromRow(t[0])}async deleteBySourcePath(e){return this.enqueueWrite(()=>this._deleteBySourcePathImpl(e))}async _deleteBySourcePathImpl(e){let t=this.getAdapter(),n=t.queryAll(`SELECT id FROM knowledge WHERE sourcePath = ?`,[e]);if(n.length===0)return 0;t.exec(`BEGIN`);try{for(let{id:e}of n)this.vectorEnabled&&(t.run(`DELETE FROM vec_knowledge WHERE knowledge_id = ?`,[e]),this.coarseDim<this.embeddingDim&&t.run(`DELETE FROM vec_knowledge_coarse WHERE knowledge_id = ?`,[e])),this.ftsEnabled&&t.run(`DELETE FROM knowledge_fts WHERE id = ?`,[e]);t.run(`DELETE FROM knowledge WHERE sourcePath = ?`,[e]),t.exec(`COMMIT`)}catch(e){try{t.exec(`ROLLBACK`)}catch{}throw e}return t.flush(),n.length}async deleteById(e){return this.enqueueWrite(()=>this._deleteByIdImpl(e))}async deleteByIdInteractive(e){return this.enqueueWrite(()=>this._deleteByIdImpl(e),!0)}async _deleteByIdImpl(e){let t=this.getAdapter();if(t.queryAll(`SELECT id FROM knowledge WHERE id = ? LIMIT 1`,[e]).length===0)return!1;t.exec(`BEGIN`);try{this.vectorEnabled&&(t.run(`DELETE FROM vec_knowledge WHERE knowledge_id = ?`,[e]),this.coarseDim<this.embeddingDim&&t.run(`DELETE FROM vec_knowledge_coarse WHERE knowledge_id = ?`,[e])),this.ftsEnabled&&t.run(`DELETE FROM knowledge_fts WHERE id = ?`,[e]),t.run(`DELETE FROM knowledge WHERE id = ?`,[e]),t.exec(`COMMIT`)}catch(e){try{t.exec(`ROLLBACK`)}catch{}throw e}return t.flush(),!0}async getBySourcePath(e){return this.getAdapter().queryAll(`SELECT * FROM knowledge WHERE sourcePath = ? ORDER BY chunkIndex ASC`,[e]).map(e=>this.fromRow(e))}async getStats(){let e=this.getAdapter(),t=e.queryAll(`SELECT COUNT(*) AS n FROM knowledge`)[0]?.n??0;if(t===0)return{totalRecords:0,totalFiles:0,contentTypeBreakdown:{},lastIndexedAt:null,storeBackend:`sqlite-vec`,embeddingModel:u.model};let n=e.queryAll(`SELECT COUNT(DISTINCT sourcePath) AS n FROM knowledge`),r=e.queryAll(`SELECT contentType, COUNT(*) AS n FROM knowledge GROUP BY contentType`),i=e.queryAll(`SELECT MAX(indexedAt) AS ts FROM knowledge`),a={};for(let e of r)a[e.contentType]=e.n;return{totalRecords:t,totalFiles:n[0]?.n??0,contentTypeBreakdown:a,lastIndexedAt:i[0]?.ts??null,storeBackend:`sqlite-vec`,embeddingModel:u.model}}async listSourcePaths(){return this.getAdapter().queryAll(`SELECT DISTINCT sourcePath FROM knowledge ORDER BY sourcePath`).map(e=>e.sourcePath)}async createFtsIndex(){this.createFtsTable()}async dropTable(){return this.enqueueWrite(()=>this._dropTableImpl())}async _dropTableImpl(){let e=this.getAdapter();this.ftsEnabled&&e.exec(`DROP TABLE IF EXISTS knowledge_fts`),this.vectorEnabled&&(this.coarseDim<this.embeddingDim&&e.exec(`DROP TABLE IF EXISTS vec_knowledge_coarse`),e.exec(`DROP TABLE IF EXISTS vec_knowledge`)),e.exec(`DROP TABLE IF EXISTS knowledge`),e.flush(),this.createKnowledgeTable(),this.createFtsTable(),this.vectorEnabled&&this.ensureVecTable()}releaseMemory(){if(this.adapter)try{this.adapter.exec(`PRAGMA shrink_memory`),this.adapter.exec(`PRAGMA wal_checkpoint(TRUNCATE)`)}catch{}}onBeforeClose(e){this._onCloseHooks.push(e)}async close(){for(let e of this._onCloseHooks)try{e()}catch{}for(this._onCloseHooks.length=0;this._priorityQueue.length>0||this._normalQueue.length>0||this._draining;)await new Promise(e=>setTimeout(e,5));this.adapter&&!this.externalAdapter&&this.adapter.close(),this.adapter=null}getAdapter(){if(!this.adapter)throw Error(`SqliteVecStore: not initialized — call initialize() first`);return this.adapter}buildFilterSqlSuffix(e,t=!1){if(!e)return``;let n=[];if(e.contentType&&n.push(`k.contentType = '${I(e.contentType,`contentType`)}'`),e.sourceType){let t=h(e.sourceType);if(t.length>0){let e=t.map(e=>`'${I(e,`sourceType`)}'`).join(`, `);n.push(`k.contentType IN (${e})`)}}if(e.origin&&n.push(`k.origin = '${I(e.origin,`origin`)}'`),e.category&&n.push(`k.category = '${I(e.category,`category`)}'`),e.tags&&e.tags.length>0){let t=e.tags.map(e=>`k.tags LIKE '%' || '${I(e,`tag`)}' || '%'`);n.push(`(${t.join(` OR `)})`)}if(n.length===0)return``;let r=n.join(` AND `);return t?`AND ${r}`:`WHERE ${r}`}fromRow(e){return{id:e.id,content:e.content,sourcePath:e.sourcePath,contentType:e.contentType,headingPath:e.headingPath||void 0,chunkIndex:e.chunkIndex,totalChunks:e.totalChunks,startLine:e.startLine,endLine:e.endLine,fileHash:e.fileHash,contentHash:e.content_hash||void 0,indexedAt:e.indexedAt,origin:e.origin,tags:F(e.tags),category:e.category||void 0,version:e.version}}};function R(e){let t=e.replace(/["'()*:^-]/g,` `).trim();return t?t.split(/\s+/).filter(e=>e.length>0).map(e=>`"${e}"`).join(` OR `):`""`}function z(e){return e==null||Number.isNaN(e)?0:1-Math.exp(-Math.abs(e)/5)}async function B(e){switch(e.backend){case`lancedb`:{let{LanceStore:t}=await import(`./lance-store-BIP1LEiS.js`);return new t({path:e.path})}case`sqlite-vec`:return new L({path:e.path,adapter:e.adapter,embeddingDim:e.embeddingDim});default:{let t=e.backend;throw Error(`Unknown store backend: "${t}". Supported: lancedb, sqlite-vec`)}}}export{E as SqliteGraphStore,L as SqliteVecStore,T as createSqlJsAdapter,w as createSqliteAdapter,B as createStore};
|
|
@@ -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({
|
|
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,11 @@
|
|
|
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,
|
|
2
|
-
`),
|
|
3
|
-
`),
|
|
4
|
-
`);function
|
|
5
|
-
`)}function
|
|
6
|
-
`)}function O(
|
|
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,buildMcpConfigJson as m,buildSkillsSection as h,lowerFirst as g}from"./_shared.mjs";const _=[`## 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
|
+
`),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(`
|
|
3
|
+
`),y=[`## 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 b(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-+|-+$/g,``).toLowerCase()}function x(e){return`"${String(e).replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function S(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 C(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 w(e,n){let r=t[e];return typeof r==`function`?r(n):r||``}function T(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 E(){let t=[];for(let[n,r]of Object.entries(e)){if(r.variants){for(let[e,i]of Object.entries(r.variants))t.push({name:`${n}-${e}`,description:i.description||r.description});continue}t.push({name:n,description:r.description})}return t}function D(e){return E().map(({name:t,description:n})=>`- \`${e}/${t}.md\` — ${n}`).join(`
|
|
6
|
+
`)}function O(t=d(e,a)){return[`# aikit — Claude Code Agents`,``,"This workspace keeps the root `CLAUDE.md` intentionally small. Full agent instructions are split into per-agent files under `.claude/agents/`.",``,`## MCP Server`,``,"Server name: `aikit`","Configured in `.mcp.json` (already done if scaffold was deployed).",``,`## Agents`,``,t,``,`## Agent Files`,``,D(`.claude/agents`),``,`## Commands`,``,"Slash commands live under `.claude/commands/`.",``,`## Session Protocol`,``,p(n),``].join(`
|
|
7
|
+
`)}function k(){return[`# aikit — Claude Code Instructions`,``,"Detailed workspace instructions live in `AGENTS.md`.","Full sub-agent instructions live in `.claude/agents/`.","Slash commands live in `.claude/commands/`.","MCP server config lives in `.mcp.json`.",``,"Start with `AGENTS.md`, then open the specific sub-agent file you want to use.",``].join(`
|
|
8
|
+
`)}function A(e,t,n,r){let i=S(t.toolRole),a=T(t),o=h(t.skills),s=e===`Orchestrator`?[_,v]:[y],c=[n,...a,t.bodyAddendum,o,...s].filter(Boolean).join(`
|
|
7
9
|
|
|
8
|
-
`).trim(),l=t.identity?`You are the **${e}**${t.identity}`:`You are the **${e}**, ${
|
|
9
|
-
`)}function
|
|
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};
|
|
10
|
+
`).trim(),l=t.identity?`You are the **${e}**${t.identity}`:`You are the **${e}**, ${g(t.description)}.`,u=[`---`,`name: ${b(e)}`,`description: ${x(t.description)}`,`allowedTools:`,...i.map(e=>` - ${e}`),`---`,``,`# ${e} - ${t.title||e}`,``,l];return c&&u.push(``,c),u.push(``),u.join(`
|
|
11
|
+
`)}function j(){let t=[],n=d(e,a),s=f(e);t.push({path:`.mcp.json`,content:`${m({serverName:i,mcpEntry:r,configKey:`mcpServers`})}\n`}),t.push({path:`CLAUDE.md`,content:k()}),t.push({path:`AGENTS.md`,content:O(n)});for(let[e,n]of Object.entries(o))t.push({path:`.claude/commands/aikit-${e}.md`,content:C(e,n)});for(let[r,i]of Object.entries(e)){let e=w(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:A(s,{...i,description:o.description||i.description,identity:o.identity,bodyAddendum:o.bodyAddendum},e,n)})}continue}t.push({path:`.claude/agents/${r}.md`,content:A(r,i,e,n)})}return t}export{_ as CLAUDE_FLOWS_SECTION,v 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,
|
|
2
|
-
`)}function
|
|
3
|
-
`)}function
|
|
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
|
|
2
|
-
`),
|
|
3
|
-
`);function
|
|
4
|
-
`)}`}function
|
|
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: ${
|
|
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}**${
|
|
14
|
-
${
|
|
13
|
+
You are **${i}**${l}${m}
|
|
14
|
+
${f}${h}${g}
|
|
15
15
|
|
|
16
|
-
${
|
|
17
|
-
`}function
|
|
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: '${
|
|
20
|
-
${
|
|
21
|
-
model: ${
|
|
19
|
+
description: '${r.description}'
|
|
20
|
+
${r.argumentHint?`argument-hint: "${r.argumentHint}"\n`:``}tools: ${u(r.toolRole)}
|
|
21
|
+
model: ${i}
|
|
22
22
|
---
|
|
23
23
|
|
|
24
|
-
# ${
|
|
24
|
+
# ${n} - ${m}
|
|
25
25
|
|
|
26
|
-
You are the **${
|
|
26
|
+
You are the **${n}**, ${r.description.toLowerCase().replace(/^./,e=>e.toLowerCase())}
|
|
27
27
|
|
|
28
|
-
${
|
|
28
|
+
${o}${s}${l}${h}
|
|
29
29
|
|
|
30
|
-
${
|
|
31
|
-
`}function
|
|
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
|
|
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
|
-
${
|
|
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
|
|
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,9 @@
|
|
|
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,
|
|
2
|
-
`)
|
|
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,buildCompactAgentTable as c,buildHooksSection as l,buildMcpConfigJson as u,buildPromptSections as d,buildSkillsSection as f,lowerFirst as p}from"./_shared.mjs";const m=[`## 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
|
+
`),h=[`## 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 g(e,n){let r=t[e];return typeof r==`function`?r(n):r||``}function _(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 v(){let t=[];for(let[n,r]of Object.entries(e)){if(r.variants){for(let[e,i]of Object.entries(r.variants))t.push({name:`${n}-${e}`,description:i.description||r.description});continue}t.push({name:n,description:r.description})}return t}function y(e){return v().map(({name:t,description:n})=>`- \`${e}/${t}.md\` — ${n}`).join(`
|
|
4
|
+
`)}function b(e,t,n){let r=_(t),i=f(t.skills),a=e===`Orchestrator`?m:h,o=[n,...r,t.bodyAddendum,i,a].filter(Boolean).join(`
|
|
5
|
+
|
|
6
|
+
`).trim();return[`# ${e} - ${t.title||e}`,``,`> ${t.description}`,``,t.identity?`You are the **${e}**${t.identity}`:`You are the **${e}**, ${p(t.description)}.`,...o?[``,o]:[],``].join(`
|
|
7
|
+
`)}function x(){return[`# aikit — Gemini CLI Agents`,``,"This workspace keeps the root `GEMINI.md` intentionally small. Full agent instructions are split into per-agent files under `.gemini/agents/`.",``,`## MCP Server`,``,"Server name: `aikit`","Configure in `.gemini/settings.json` (already done if scaffold was deployed).",``,`## Agents`,``,s(e),``,`## Agent Files`,``,y(`.gemini/agents`),``,`## Prompts`,``,d(a),``,`## Session Protocol`,``,l(n),``].join(`
|
|
8
|
+
`)}function S(){return[`# aikit — Gemini CLI Instructions`,``,"Detailed workspace instructions live in `AGENTS.md`.","Per-agent instructions are emitted under `.gemini/agents/`.","MCP server config lives in `.gemini/settings.json`.",``,"Start with `AGENTS.md`, then open the specific agent file you want to use.",``].join(`
|
|
9
|
+
`)}function C(){let t=[{path:`.gemini/settings.json`,content:`${u({serverName:i,mcpEntry:r,configKey:`mcpServers`})}\n`},{path:`GEMINI.md`,content:S()},{path:`AGENTS.md`,content:x()}],n=c(e);for(let[r,i]of Object.entries(e)){let e=g(r,n);if(i.variants){for(let[n,a]of Object.entries(i.variants)){let o=`${r}-${n}`;t.push({path:`.gemini/agents/${o}.md`,content:b(o,{...i,description:a.description||i.description,identity:a.identity,bodyAddendum:a.bodyAddendum},e)})}continue}t.push({path:`.gemini/agents/${r}.md`,content:b(r,i,e)})}return t}export{C as generateGemini};
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
function e(e){return e.map((e,t)=>`${t+1}. ${e}`).join(`
|
|
2
|
+
`)}function t(e){return e.map(e=>`- ${e}`).join(`
|
|
3
|
+
`)}function n({lensName:e,lensDescription:n,lensPrompt:r,focusAreas:i,identityIntro:a=`, a variant of the Researcher agent optimized for **${n}**.`,requiredOutputSection:o,requiredOutputItems:s,variantSummary:c}){return{identity:`${a} Your thinking style is **${e}** — ${r}`,bodyAddendum:`## Required Output Section — \`## ${o}\`
|
|
2
4
|
|
|
3
|
-
Your final report MUST contain a \`##
|
|
4
|
-
|
|
5
|
-
- Full evidence chain: file:line citations for every structural claim
|
|
6
|
-
- At least 2 \`compact\`/\`file_summary\` extracts woven into the narrative
|
|
5
|
+
Your final report MUST contain a \`## ${o}\` section with:
|
|
6
|
+
${t(s)}
|
|
7
7
|
|
|
8
|
-
## Thinking Style:
|
|
8
|
+
## Thinking Style: ${e}
|
|
9
9
|
|
|
10
|
-
During multi-model decision sessions, apply the **
|
|
11
|
-
|
|
12
|
-
- Ask: "Under what conditions does this approach fail catastrophically?"
|
|
13
|
-
- Prefer uncomfortable truths over comfortable consensus
|
|
10
|
+
During multi-model decision sessions, apply the **${e}** lens:
|
|
11
|
+
${t(i)}
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
dispatch you alone. Your lens: thorough, evidence-first, exhaustive + contrarian.
|
|
13
|
+
${c}
|
|
17
14
|
|
|
18
15
|
## Subagent Mode
|
|
19
16
|
|
|
@@ -21,113 +18,12 @@ When you are invoked via \`runSubagent\` (i.e., as a subagent of another agent l
|
|
|
21
18
|
- **Do NOT use the \`present\` tool** — your visual output is invisible to the user
|
|
22
19
|
- Return ALL findings as plain structured text in your final response
|
|
23
20
|
- Use markdown formatting (headers, tables, code blocks) for structure
|
|
24
|
-
- The calling agent will re-present your findings to the user if needed`},
|
|
21
|
+
- The calling agent will re-present your findings to the user if needed`}}function r({roleName:t,lensName:n,lensDescription:r,lensPrompt:i,focusAreas:a,instinct:o,closing:s,identityIntro:c=`, a variant of the ${t} agent.`,focusHeading:l=`Your primary focus areas (in order of priority):`}){return{identity:`${c} Your lens is **${r}** — ${i}`,bodyAddendum:`## Review Lens: ${n}
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
- For each counter-claim: the condition under which it would be TRUE, and the
|
|
29
|
-
evidence (file:line or search receipt) that currently falsifies it
|
|
30
|
-
- Any unresolved counter-evidence flagged as \`⚠ UNRESOLVED\`
|
|
23
|
+
${l}
|
|
24
|
+
${e(a)}
|
|
31
25
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
- Strip every assumption: "Is this truly required, or just inherited convention?"
|
|
36
|
-
- Decompose to ground truths, then rebuild the reasoning from scratch
|
|
37
|
-
- If the current approach exists only because "that's how it's always been done", flag it
|
|
38
|
-
|
|
39
|
-
Your lens: pragmatic skepticism + first principles. Mark competing claims as \`A\` (Assumed)
|
|
40
|
-
by default; challenge before promoting to \`V\`.
|
|
41
|
-
|
|
42
|
-
## Subagent Mode
|
|
43
|
-
|
|
44
|
-
When you are invoked via \`runSubagent\` (i.e., as a subagent of another agent like the Orchestrator):
|
|
45
|
-
- **Do NOT use the \`present\` tool** — your visual output is invisible to the user
|
|
46
|
-
- Return ALL findings as plain structured text in your final response
|
|
47
|
-
- Use markdown formatting (headers, tables, code blocks) for structure
|
|
48
|
-
- The calling agent will re-present your findings to the user if needed`},Gamma:{description:`Research variant — broad pattern matching across domains and technologies`,identity:`, a variant of the Researcher agent optimized for **cross-domain pattern matching**. Draw connections from other domains, frameworks, and industries. Bring breadth where Alpha brings depth. Your thinking style is **Expansionist** — look for the bigger opportunity, find what's undervalued, and identify patterns others dismiss.`,bodyAddendum:`## Required Output Section — \`## Cross-Domain Analogies\`
|
|
49
|
-
|
|
50
|
-
Your final report MUST contain a \`## Cross-Domain Analogies\` section with:
|
|
51
|
-
- At least 2 patterns from other tools/frameworks/domains that apply to the question
|
|
52
|
-
- For each: the external source (cite via \`web_search\` or \`web_fetch\` receipt) and
|
|
53
|
-
how it maps to our codebase
|
|
54
|
-
- One "missing pattern we should adopt" recommendation
|
|
55
|
-
|
|
56
|
-
## Thinking Style: Expansionist
|
|
57
|
-
|
|
58
|
-
During multi-model decision sessions, apply the **Expansionist** lens:
|
|
59
|
-
- Ask: "What's the bigger opportunity everyone else is ignoring?"
|
|
60
|
-
- Seek undervalued approaches and non-obvious connections across domains
|
|
61
|
-
- Challenge narrow framing: "Is this really just an X problem, or is it also a Y problem?"
|
|
62
|
-
|
|
63
|
-
Your lens: cross-domain pattern matching + expansionist. Weight \`web_search\` + \`web_fetch\`
|
|
64
|
-
higher than peers. Assume the LLM's training data is stale — verify with fresh searches.
|
|
65
|
-
|
|
66
|
-
## Subagent Mode
|
|
67
|
-
|
|
68
|
-
When you are invoked via \`runSubagent\` (i.e., as a subagent of another agent like the Orchestrator):
|
|
69
|
-
- **Do NOT use the \`present\` tool** — your visual output is invisible to the user
|
|
70
|
-
- Return ALL findings as plain structured text in your final response
|
|
71
|
-
- Use markdown formatting (headers, tables, code blocks) for structure
|
|
72
|
-
- The calling agent will re-present your findings to the user if needed`},Delta:{description:`Research variant — implementation feasibility and performance implications`,identity:`, a variant of the Researcher agent optimized for **implementation feasibility**. Focus on performance implications, scaling concerns, and concrete implementation paths. Ground theoretical proposals in practical reality. Your thinking style is **Executor** — focus on what can actually be built, the fastest path to value, and real-world constraints.`,bodyAddendum:`## Required Output Section — \`## Implementation Cost & Feasibility\`
|
|
73
|
-
|
|
74
|
-
Your final report MUST contain a \`## Implementation Cost & Feasibility\` section with:
|
|
75
|
-
- Complexity snapshot: you MUST call \`measure({ path })\` on any file ≥ 50 LOC in the
|
|
76
|
-
target subsystem at least once and quote the \`cognitiveComplexity\` result
|
|
77
|
-
- Blast radius estimate: \`blast_radius({ changed_files })\` on the proposed edits
|
|
78
|
-
- Time/risk table: | Change | Lines | Risk | Effort |
|
|
79
|
-
- Feasibility verdict: SAFE / RISKY / INFEASIBLE with one-line justification
|
|
80
|
-
|
|
81
|
-
## Thinking Style: Executor
|
|
82
|
-
|
|
83
|
-
During multi-model decision sessions, apply the **Executor** lens:
|
|
84
|
-
- Ask: "Can this actually be built? What's the fastest path to a working version?"
|
|
85
|
-
- Ground every proposal in concrete effort: lines of code, files changed, risk
|
|
86
|
-
- Reject elegant theory that can't survive contact with the codebase
|
|
87
|
-
|
|
88
|
-
Your lens: implementation feasibility + executor. Prefer \`measure\` + \`blast_radius\` +
|
|
89
|
-
\`analyze({ aspect: "patterns", ... })\` over abstract reasoning.
|
|
90
|
-
|
|
91
|
-
## Subagent Mode
|
|
92
|
-
|
|
93
|
-
When you are invoked via \`runSubagent\` (i.e., as a subagent of another agent like the Orchestrator):
|
|
94
|
-
- **Do NOT use the \`present\` tool** — your visual output is invisible to the user
|
|
95
|
-
- Return ALL findings as plain structured text in your final response
|
|
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
|
|
98
|
-
|
|
99
|
-
Your primary focus areas (in order of priority):
|
|
100
|
-
1. **Correctness** — Logic errors, race conditions, null/undefined paths, off-by-one
|
|
101
|
-
2. **Security** — OWASP Top 10, input validation, secrets, injection vectors
|
|
102
|
-
3. **Contract compliance** — Does this honor its type signatures, API contracts, and invariants?
|
|
103
|
-
4. **Error handling** — What happens on the unhappy path? Missing try/catch, swallowed errors
|
|
104
|
-
|
|
105
|
-
Your instinct: "How does this break?" Think like an attacker and a pessimist.
|
|
106
|
-
When in doubt, flag it — false positives are cheaper than missed bugs in production.`},Beta:{description:`Code reviewer variant — different LLM perspective for dual review`,identity:`, the secondary Code-Reviewer agent. Your lens is **quality and engineering excellence** — you focus on maintainability, performance, testing, and whether the code will age well.`,bodyAddendum:`## Review Lens: Quality & Engineering Excellence
|
|
107
|
-
|
|
108
|
-
Your primary focus areas (in order of priority):
|
|
109
|
-
1. **Maintainability** — Naming clarity, single responsibility, cognitive complexity, DRY
|
|
110
|
-
2. **Performance** — N+1 queries, unnecessary allocations, missing caching, O(n²) where O(n) suffices
|
|
111
|
-
3. **Testing** — Coverage for new/changed logic, edge cases, test readability
|
|
112
|
-
4. **Patterns** — Consistency with existing codebase conventions, idiomatic usage
|
|
113
|
-
|
|
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
|
|
116
|
-
|
|
117
|
-
Your primary focus areas:
|
|
118
|
-
1. **Boundary violations** — Does this cross package/module boundaries it shouldn't?
|
|
119
|
-
2. **Dependency direction** — Are dependencies flowing inward? Any layer leakage?
|
|
120
|
-
3. **Hidden coupling** — Shared mutable state, implicit contracts, temporal coupling
|
|
121
|
-
4. **Scalability stress** — What breaks at 10x load, 10x data, 10x features?
|
|
122
|
-
|
|
123
|
-
Your instinct: "This design will fail when..." Challenge every architectural assumption.
|
|
124
|
-
If a boundary is crossed, require justification or block.`},Beta:{description:`Architecture reviewer variant — different LLM perspective for dual review`,identity:`, the secondary Architect-Reviewer agent. Your lens is **pragmatic defense** — you evaluate whether the architecture is proportional to the problem, and defend reasonable trade-offs.`,bodyAddendum:`## Review Lens: Pragmatic Defense
|
|
125
|
-
|
|
126
|
-
Your primary focus areas:
|
|
127
|
-
1. **Proportionality** — Is the architecture proportional to the problem? Over-engineering is a defect.
|
|
128
|
-
2. **Trade-off validity** — Are the trade-offs explicitly acknowledged and reasonable?
|
|
129
|
-
3. **Migration path** — Can this evolve without a rewrite? Is there a clear upgrade path?
|
|
130
|
-
4. **Team ergonomics** — Can the team actually maintain this? Does it match their skills?
|
|
131
|
-
|
|
132
|
-
Your instinct: "Is this the simplest architecture that solves the actual problem?"
|
|
133
|
-
Push back on unnecessary complexity. Defend working solutions against premature abstraction.`}}}};export{e as AGENTS};
|
|
26
|
+
${o}
|
|
27
|
+
${s}`}}const i={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:n({description:`Primary deep research agent — also serves as default Researcher`,lensName:`Contrarian`,lensDescription:`deep research`,lensPrompt:`actively look for flaws, fatal assumptions, and hidden risks in every approach. The best ideas survive adversarial pressure.`,identityIntro:`, the primary deep research agent. During multi-model decision sessions, you provide deep reasoning and nuanced system design.`,requiredOutputSection:`Depth Analysis`,requiredOutputItems:[`Deep-dive into ONE chosen subsystem (most structurally central to the question)`,`Full evidence chain: file:line citations for every structural claim`,"At least 2 `compact`/`file_summary` extracts woven into the narrative"],focusAreas:[`For every proposed approach, actively seek the fatal flaw or hidden assumption`,`Ask: "Under what conditions does this approach fail catastrophically?"`,`Prefer uncomfortable truths over comfortable consensus`],variantSummary:`You are the DEFAULT researcher. When the Orchestrator needs breadth + depth, they
|
|
28
|
+
dispatch you alone. Your lens: thorough, evidence-first, exhaustive + contrarian.`}),Beta:n({description:`Research variant — pragmatic analysis with focus on trade-offs and edge cases`,lensName:`First Principles`,lensDescription:`pragmatic analysis`,lensPrompt:`strip away assumptions, decompose to ground truths, and rebuild reasoning from scratch.`,identityIntro:`, a variant of the Researcher agent optimized for **pragmatic analysis**. Focus on trade-offs, edge cases, and practical constraints. Challenge assumptions and highlight risks the primary researcher may overlook.`,requiredOutputSection:`Failure Modes & Counter-Evidence`,requiredOutputItems:[`At least 3 adversarial claims challenging your own primary finding`,`For each counter-claim: the condition under which it would be TRUE, and the
|
|
29
|
+
evidence (file:line or search receipt) that currently falsifies it`,"Any unresolved counter-evidence flagged as `⚠ UNRESOLVED`"],focusAreas:[`Strip every assumption: "Is this truly required, or just inherited convention?"`,`Decompose to ground truths, then rebuild the reasoning from scratch`,`If the current approach exists only because "that's how it's always been done", flag it`],variantSummary:"Your lens: pragmatic skepticism + first principles. Mark competing claims as `A` (Assumed)\nby default; challenge before promoting to `V`."}),Gamma:n({description:`Research variant — broad pattern matching across domains and technologies`,lensName:`Expansionist`,lensDescription:`cross-domain pattern matching`,lensPrompt:`look for the bigger opportunity, find what's undervalued, and identify patterns others dismiss.`,identityIntro:`, a variant of the Researcher agent optimized for **cross-domain pattern matching**. Draw connections from other domains, frameworks, and industries. Bring breadth where Alpha brings depth.`,requiredOutputSection:`Cross-Domain Analogies`,requiredOutputItems:[`At least 2 patterns from other tools/frameworks/domains that apply to the question`,"For each: the external source (cite via `web_search` or `web_fetch` receipt) and\n how it maps to our codebase",`One "missing pattern we should adopt" recommendation`],focusAreas:[`Ask: "What's the bigger opportunity everyone else is ignoring?"`,`Seek undervalued approaches and non-obvious connections across domains`,`Challenge narrow framing: "Is this really just an X problem, or is it also a Y problem?"`],variantSummary:"Your lens: cross-domain pattern matching + expansionist. Weight `web_search` + `web_fetch`\nhigher than peers. Assume the LLM's training data is stale — verify with fresh searches."}),Delta:n({description:`Research variant — implementation feasibility and performance implications`,lensName:`Executor`,lensDescription:`implementation feasibility`,lensPrompt:`focus on what can actually be built, the fastest path to value, and real-world constraints.`,identityIntro:`, a variant of the Researcher agent optimized for **implementation feasibility**. Focus on performance implications, scaling concerns, and concrete implementation paths. Ground theoretical proposals in practical reality.`,requiredOutputSection:`Implementation Cost & Feasibility`,requiredOutputItems:["Complexity snapshot: you MUST call `measure({ path })` on any file ≥ 50 LOC in the\n target subsystem at least once and quote the `cognitiveComplexity` result","Blast radius estimate: `blast_radius({ changed_files })` on the proposed edits",`Time/risk table: | Change | Lines | Risk | Effort |`,`Feasibility verdict: SAFE / RISKY / INFEASIBLE with one-line justification`],focusAreas:[`Ask: "Can this actually be built? What's the fastest path to a working version?"`,`Ground every proposal in concrete effort: lines of code, files changed, risk`,`Reject elegant theory that can't survive contact with the codebase`],variantSummary:'Your lens: implementation feasibility + executor. Prefer `measure` + `blast_radius` +\n`analyze({ aspect: "patterns", ... })` over abstract reasoning.'})}},"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:r({roleName:`Code-Reviewer`,description:`Primary code reviewer`,lensName:`Compliance & Red-Team`,lensDescription:`compliance and red-teaming`,lensPrompt:`you hunt for correctness bugs, security holes, and contract violations that will break in production.`,identityIntro:`, the primary Code-Reviewer agent.`,focusAreas:[`**Correctness** — Logic errors, race conditions, null/undefined paths, off-by-one`,`**Security** — OWASP Top 10, input validation, secrets, injection vectors`,`**Contract compliance** — Does this honor its type signatures, API contracts, and invariants?`,`**Error handling** — What happens on the unhappy path? Missing try/catch, swallowed errors`],instinct:`Your instinct: "How does this break?" Think like an attacker and a pessimist.`,closing:`When in doubt, flag it — false positives are cheaper than missed bugs in production.`}),Beta:r({roleName:`Code-Reviewer`,description:`Code reviewer variant — different LLM perspective for dual review`,lensName:`Quality & Engineering Excellence`,lensDescription:`quality and engineering excellence`,lensPrompt:`you focus on maintainability, performance, testing, and whether the code will age well.`,identityIntro:`, the secondary Code-Reviewer agent.`,focusAreas:[`**Maintainability** — Naming clarity, single responsibility, cognitive complexity, DRY`,`**Performance** — N+1 queries, unnecessary allocations, missing caching, O(n²) where O(n) suffices`,`**Testing** — Coverage for new/changed logic, edge cases, test readability`,`**Patterns** — Consistency with existing codebase conventions, idiomatic usage`],instinct:`Your instinct: "Will a new team member understand this in 6 months?" Think like a mentor.`,closing:`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:r({roleName:`Architect-Reviewer`,description:`Primary architecture reviewer`,lensName:`Structural Prosecutor`,lensDescription:`structural prosecution`,lensPrompt:`you challenge architectural choices, find boundary violations, and test whether the design survives growth.`,identityIntro:`, the primary Architect-Reviewer agent.`,focusHeading:`Your primary focus areas:`,focusAreas:[`**Boundary violations** — Does this cross package/module boundaries it shouldn't?`,`**Dependency direction** — Are dependencies flowing inward? Any layer leakage?`,`**Hidden coupling** — Shared mutable state, implicit contracts, temporal coupling`,`**Scalability stress** — What breaks at 10x load, 10x data, 10x features?`],instinct:`Your instinct: "This design will fail when..." Challenge every architectural assumption.`,closing:`If a boundary is crossed, require justification or block.`}),Beta:r({roleName:`Architect-Reviewer`,description:`Architecture reviewer variant — different LLM perspective for dual review`,lensName:`Pragmatic Defense`,lensDescription:`pragmatic defense`,lensPrompt:`you evaluate whether the architecture is proportional to the problem, and defend reasonable trade-offs.`,identityIntro:`, the secondary Architect-Reviewer agent.`,focusHeading:`Your primary focus areas:`,focusAreas:[`**Proportionality** — Is the architecture proportional to the problem? Over-engineering is a defect.`,`**Trade-off validity** — Are the trade-offs explicitly acknowledged and reasonable?`,`**Migration path** — Can this evolve without a rewrite? Is there a clear upgrade path?`,`**Team ergonomics** — Can the team actually maintain this? Does it match their skills?`],instinct:`Your instinct: "Is this the simplest architecture that solves the actual problem?"`,closing:`Push back on unnecessary complexity. Defend working solutions against premature abstraction.`})}}};export{i as AGENTS};
|