@soleri/forge 5.0.1 → 5.1.2
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/dist/index.js +0 -0
- package/dist/patching.js +3 -3
- package/dist/patching.js.map +1 -1
- package/dist/templates/activate.js +5 -5
- package/dist/templates/activate.js.map +1 -1
- package/dist/templates/claude-md-template.js +11 -11
- package/dist/templates/claude-md-template.js.map +1 -1
- package/dist/templates/entry-point.js +17 -2
- package/dist/templates/entry-point.js.map +1 -1
- package/dist/templates/setup-script.js +2 -2
- package/dist/templates/setup-script.js.map +1 -1
- package/dist/templates/test-facades.js +11 -2
- package/dist/templates/test-facades.js.map +1 -1
- package/dist/types.d.ts +2 -2
- package/package.json +1 -1
- package/src/__tests__/knowledge-installer.test.ts +7 -7
- package/src/patching.ts +3 -3
- package/src/templates/activate.ts +5 -5
- package/src/templates/claude-md-template.ts +49 -29
- package/src/templates/entry-point.ts +17 -2
- package/src/templates/setup-script.ts +2 -2
- package/src/templates/test-facades.ts +11 -2
- package/dist/templates/brain.d.ts +0 -6
- package/dist/templates/brain.js +0 -478
- package/dist/templates/brain.js.map +0 -1
- package/dist/templates/core-facade.d.ts +0 -6
- package/dist/templates/core-facade.js +0 -564
- package/dist/templates/core-facade.js.map +0 -1
- package/dist/templates/facade-factory.d.ts +0 -1
- package/dist/templates/facade-factory.js +0 -63
- package/dist/templates/facade-factory.js.map +0 -1
- package/dist/templates/facade-types.d.ts +0 -1
- package/dist/templates/facade-types.js +0 -46
- package/dist/templates/facade-types.js.map +0 -1
- package/dist/templates/intelligence-loader.d.ts +0 -1
- package/dist/templates/intelligence-loader.js +0 -43
- package/dist/templates/intelligence-loader.js.map +0 -1
- package/dist/templates/intelligence-types.d.ts +0 -1
- package/dist/templates/intelligence-types.js +0 -24
- package/dist/templates/intelligence-types.js.map +0 -1
- package/dist/templates/llm-client.d.ts +0 -7
- package/dist/templates/llm-client.js +0 -300
- package/dist/templates/llm-client.js.map +0 -1
- package/dist/templates/llm-key-pool.d.ts +0 -7
- package/dist/templates/llm-key-pool.js +0 -211
- package/dist/templates/llm-key-pool.js.map +0 -1
- package/dist/templates/llm-types.d.ts +0 -5
- package/dist/templates/llm-types.js +0 -161
- package/dist/templates/llm-types.js.map +0 -1
- package/dist/templates/llm-utils.d.ts +0 -5
- package/dist/templates/llm-utils.js +0 -260
- package/dist/templates/llm-utils.js.map +0 -1
- package/dist/templates/planner.d.ts +0 -5
- package/dist/templates/planner.js +0 -150
- package/dist/templates/planner.js.map +0 -1
- package/dist/templates/test-brain.d.ts +0 -6
- package/dist/templates/test-brain.js +0 -474
- package/dist/templates/test-brain.js.map +0 -1
- package/dist/templates/test-llm.d.ts +0 -7
- package/dist/templates/test-llm.js +0 -574
- package/dist/templates/test-llm.js.map +0 -1
- package/dist/templates/test-loader.d.ts +0 -5
- package/dist/templates/test-loader.js +0 -146
- package/dist/templates/test-loader.js.map +0 -1
- package/dist/templates/test-planner.d.ts +0 -5
- package/dist/templates/test-planner.js +0 -271
- package/dist/templates/test-planner.js.map +0 -1
- package/dist/templates/test-vault.d.ts +0 -5
- package/dist/templates/test-vault.js +0 -380
- package/dist/templates/test-vault.js.map +0 -1
- package/dist/templates/vault.d.ts +0 -5
- package/dist/templates/vault.js +0 -263
- package/dist/templates/vault.js.map +0 -1
package/dist/index.js
CHANGED
|
File without changes
|
package/dist/patching.js
CHANGED
|
@@ -85,11 +85,11 @@ function patchIndexTsV4(source, newDomains, hasBrain) {
|
|
|
85
85
|
* Fallback anchor: line containing `## Intent Detection` (older agents without memory/brain rows)
|
|
86
86
|
*/
|
|
87
87
|
export function patchClaudeMdContent(source, agentId, newDomains) {
|
|
88
|
-
const
|
|
88
|
+
const toolPrefix = agentId; // keep hyphens — matches MCP tool registration
|
|
89
89
|
const bt = '`';
|
|
90
90
|
// Filter out domains whose rows already exist (idempotent)
|
|
91
91
|
const domainsToAdd = newDomains.filter((d) => {
|
|
92
|
-
const toolName = `${
|
|
92
|
+
const toolName = `${toolPrefix}_${d.replace(/-/g, '_')}`;
|
|
93
93
|
return !source.includes(`${toolName}`);
|
|
94
94
|
});
|
|
95
95
|
if (domainsToAdd.length === 0)
|
|
@@ -110,7 +110,7 @@ export function patchClaudeMdContent(source, agentId, newDomains) {
|
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
const newRows = domainsToAdd.flatMap((d) => {
|
|
113
|
-
const toolName = `${
|
|
113
|
+
const toolName = `${toolPrefix}_${d.replace(/-/g, '_')}`;
|
|
114
114
|
return [
|
|
115
115
|
` '| ${d} patterns | ${bt}${toolName}${bt} | ${bt}get_patterns${bt} |',`,
|
|
116
116
|
` '| Search ${d} | ${bt}${toolName}${bt} | ${bt}search${bt} |',`,
|
package/dist/patching.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patching.js","sourceRoot":"","sources":["../src/patching.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAC1B,MAAc,EACd,UAAoB,EACpB,SAAmB;IAEnB,sEAAsE;IACtE,MAAM,SAAS,GAAG,6DAA6D,CAAC;IAChF,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAExC,IAAI,OAAO,EAAE,CAAC;QACZ,MAAM,oBAAoB,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QACxC,MAAM,YAAY,GAAG,UAAU,CAAC,MAAM,CACpC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,oBAAoB,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAC5F,CAAC;QACF,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,MAAM,CAAC;QAE7C,MAAM,UAAU,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,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AAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAC1F,CAAC;AAED,SAAS,UAAU,CAAC,CAAS;IAC3B,OAAO,CAAC;SACL,KAAK,CAAC,SAAS,CAAC;SAChB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SAClD,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC"}
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
* Uses array-joined pattern because generated code contains template literals.
|
|
7
7
|
*/
|
|
8
8
|
export function generateActivate(config) {
|
|
9
|
-
const
|
|
9
|
+
const toolPrefix = config.id; // keep hyphens — matches MCP tool registration
|
|
10
10
|
const _marker = `${config.id}:mode`;
|
|
11
11
|
// Build tool recommendations from config domains
|
|
12
12
|
const toolRecLines = [];
|
|
13
13
|
for (const d of config.domains) {
|
|
14
|
-
const toolName = `${
|
|
14
|
+
const toolName = `${toolPrefix}_${d.replace(/-/g, '_')}`;
|
|
15
15
|
toolRecLines.push(` { intent: 'search ${d}', facade: '${toolName}', op: 'search' },`);
|
|
16
16
|
toolRecLines.push(` { intent: '${d} patterns', facade: '${toolName}', op: 'get_patterns' },`);
|
|
17
17
|
toolRecLines.push(` { intent: 'capture ${d}', facade: '${toolName}', op: 'capture' },`);
|
|
@@ -107,9 +107,9 @@ export function generateActivate(config) {
|
|
|
107
107
|
guidelineLines,
|
|
108
108
|
' ],',
|
|
109
109
|
' tool_recommendations: [',
|
|
110
|
-
` { intent: 'health check', facade: '${
|
|
111
|
-
` { intent: 'search all', facade: '${
|
|
112
|
-
` { intent: 'vault stats', facade: '${
|
|
110
|
+
` { intent: 'health check', facade: '${toolPrefix}_core', op: 'health' },`,
|
|
111
|
+
` { intent: 'search all', facade: '${toolPrefix}_core', op: 'search' },`,
|
|
112
|
+
` { intent: 'vault stats', facade: '${toolPrefix}_core', op: 'vault_stats' },`,
|
|
113
113
|
...toolRecLines,
|
|
114
114
|
' ],',
|
|
115
115
|
` session_instruction: 'You are now ' + PERSONA.name + ', a ' + PERSONA.role + '. Stay in character for the ENTIRE session. ' +`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activate.js","sourceRoot":"","sources":["../../src/templates/activate.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAmB;IAClD,MAAM,
|
|
1
|
+
{"version":3,"file":"activate.js","sourceRoot":"","sources":["../../src/templates/activate.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAmB;IAClD,MAAM,UAAU,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC,+CAA+C;IAC7E,MAAM,OAAO,GAAG,GAAG,MAAM,CAAC,EAAE,OAAO,CAAC;IAEpC,iDAAiD;IACjD,MAAM,YAAY,GAAa,EAAE,CAAC;IAClC,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QAC/B,MAAM,QAAQ,GAAG,GAAG,UAAU,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;QACzD,YAAY,CAAC,IAAI,CAAC,2BAA2B,CAAC,eAAe,QAAQ,oBAAoB,CAAC,CAAC;QAC3F,YAAY,CAAC,IAAI,CACf,oBAAoB,CAAC,wBAAwB,QAAQ,0BAA0B,CAChF,CAAC;QACF,YAAY,CAAC,IAAI,CAAC,4BAA4B,CAAC,eAAe,QAAQ,qBAAqB,CAAC,CAAC;IAC/F,CAAC;IAED,qDAAqD;IACrD,MAAM,cAAc,GAAG,MAAM,CAAC,UAAU;SACrC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACT,MAAM,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KA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C;QACnC,QAAQ;QACR,mBAAmB;QACnB,cAAc;QACd,QAAQ;QACR,6BAA6B;QAC7B,4CAA4C,UAAU,yBAAyB;QAC/E,0CAA0C,UAAU,yBAAyB;QAC7E,2CAA2C,UAAU,8BAA8B;QACnF,GAAG,YAAY;QACf,QAAQ;QACR,mIAAmI;QACnI,oHAAoH;QACpH,qBAAqB;QACrB,6CAA6C;QAC7C,0DAA0D;QAC1D,2CAA2C;QAC3C,8CAA8C;QAC9C,QAAQ;QACR,sCAAsC;QACtC,4BAA4B;QAC5B,MAAM;QACN,GAAG;QACH,EAAE;QACF,KAAK;QACL,iBAAiB,MAAM,CAAC,IAAI,mCAAmC;QAC/D,KAAK;QACL,yDAAyD;QACzD,YAAY;QACZ,wBAAwB;QACxB,mGAAmG;QACnG,MAAM;QACN,GAAG;KACJ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* backtick/template-literal escaping nightmares entirely.
|
|
9
9
|
*/
|
|
10
10
|
export function generateClaudeMdTemplate(config) {
|
|
11
|
-
const
|
|
11
|
+
const toolPrefix = config.id; // keep hyphens — matches MCP tool registration
|
|
12
12
|
const marker = `${config.id}:mode`;
|
|
13
13
|
const bt = '`'; // backtick — keeps template clean
|
|
14
14
|
// Build the raw markdown lines (plain text, no escaping needed)
|
|
@@ -19,34 +19,34 @@ export function generateClaudeMdTemplate(config) {
|
|
|
19
19
|
'',
|
|
20
20
|
`## ${config.name} Integration`,
|
|
21
21
|
'',
|
|
22
|
-
`**Activate:** "Hello, ${config.name}!" \u2192 ${bt}${
|
|
23
|
-
`**Deactivate:** "Goodbye, ${config.name}!" \u2192 ${bt}${
|
|
22
|
+
`**Activate:** "Hello, ${config.name}!" \u2192 ${bt}${toolPrefix}_core op:activate params:{ projectPath: "." }${bt}`,
|
|
23
|
+
`**Deactivate:** "Goodbye, ${config.name}!" \u2192 ${bt}${toolPrefix}_core op:activate params:{ deactivate: true }${bt}`,
|
|
24
24
|
'',
|
|
25
25
|
'On activation, adopt the returned persona. Stay in character until deactivated.',
|
|
26
26
|
'',
|
|
27
27
|
'## Session Start',
|
|
28
28
|
'',
|
|
29
|
-
`On every new session: ${bt}${
|
|
29
|
+
`On every new session: ${bt}${toolPrefix}_core op:register params:{ projectPath: "." }${bt}`,
|
|
30
30
|
'',
|
|
31
31
|
'## Facades',
|
|
32
32
|
'',
|
|
33
33
|
'| Need | Facade | Op |',
|
|
34
34
|
'|------|--------|----|',
|
|
35
|
-
`| Health check | ${bt}${
|
|
36
|
-
`| Search all | ${bt}${
|
|
37
|
-
`| Vault stats | ${bt}${
|
|
38
|
-
`| Identity | ${bt}${
|
|
35
|
+
`| Health check | ${bt}${toolPrefix}_core${bt} | ${bt}health${bt} |`,
|
|
36
|
+
`| Search all | ${bt}${toolPrefix}_core${bt} | ${bt}search${bt} |`,
|
|
37
|
+
`| Vault stats | ${bt}${toolPrefix}_core${bt} | ${bt}vault_stats${bt} |`,
|
|
38
|
+
`| Identity | ${bt}${toolPrefix}_core${bt} | ${bt}identity${bt} |`,
|
|
39
39
|
];
|
|
40
40
|
// Domain-specific facade rows
|
|
41
41
|
for (const d of config.domains) {
|
|
42
|
-
const toolName = `${
|
|
42
|
+
const toolName = `${toolPrefix}_${d.replace(/-/g, '_')}`;
|
|
43
43
|
mdLines.push(`| ${d} patterns | ${bt}${toolName}${bt} | ${bt}get_patterns${bt} |`);
|
|
44
44
|
mdLines.push(`| Search ${d} | ${bt}${toolName}${bt} | ${bt}search${bt} |`);
|
|
45
45
|
mdLines.push(`| Capture ${d} | ${bt}${toolName}${bt} | ${bt}capture${bt} |`);
|
|
46
46
|
}
|
|
47
47
|
// Memory + Session + Export + Brain + Planning rows
|
|
48
|
-
mdLines.push(`| Memory search | ${bt}${
|
|
49
|
-
mdLines.push('', '## Intent Detection', '', '| Signal | Intent |', '|--------|--------|', '| Problem described ("broken", "janky", "weird") | FIX |', '| Need expressed ("I need", "we should have") | BUILD |', '| Quality questioned ("is this right?") | REVIEW |', '| Advice sought ("how should I", "best way") | PLAN |', '| Improvement requested ("make it faster") | IMPROVE |', '', '## Knowledge Protocol', '', 'When seeking guidance: vault before codebase before web.', '', `1. Search vault \u2014 ${bt}${
|
|
48
|
+
mdLines.push(`| Memory search | ${bt}${toolPrefix}_core${bt} | ${bt}memory_search${bt} |`, `| Memory capture | ${bt}${toolPrefix}_core${bt} | ${bt}memory_capture${bt} |`, `| Memory list | ${bt}${toolPrefix}_core${bt} | ${bt}memory_list${bt} |`, `| Session capture | ${bt}${toolPrefix}_core${bt} | ${bt}session_capture${bt} |`, `| Export knowledge | ${bt}${toolPrefix}_core${bt} | ${bt}export${bt} |`, `| Record feedback | ${bt}${toolPrefix}_core${bt} | ${bt}record_feedback${bt} |`, `| Rebuild vocabulary | ${bt}${toolPrefix}_core${bt} | ${bt}rebuild_vocabulary${bt} |`, `| Brain stats | ${bt}${toolPrefix}_core${bt} | ${bt}brain_stats${bt} |`, `| LLM status | ${bt}${toolPrefix}_core${bt} | ${bt}llm_status${bt} |`, `| Create plan | ${bt}${toolPrefix}_core${bt} | ${bt}create_plan${bt} |`, `| Get plan | ${bt}${toolPrefix}_core${bt} | ${bt}get_plan${bt} |`, `| Approve plan | ${bt}${toolPrefix}_core${bt} | ${bt}approve_plan${bt} |`, `| Update task | ${bt}${toolPrefix}_core${bt} | ${bt}update_task${bt} |`, `| Complete plan | ${bt}${toolPrefix}_core${bt} | ${bt}complete_plan${bt} |`, `| Route intent | ${bt}${toolPrefix}_core${bt} | ${bt}route_intent${bt} |`, `| Morph mode | ${bt}${toolPrefix}_core${bt} | ${bt}morph${bt} |`, `| Get behavior rules | ${bt}${toolPrefix}_core${bt} | ${bt}get_behavior_rules${bt} |`, `| Get identity | ${bt}${toolPrefix}_core${bt} | ${bt}get_identity${bt} |`, `| Update identity | ${bt}${toolPrefix}_core${bt} | ${bt}update_identity${bt} |`, `| Add guideline | ${bt}${toolPrefix}_core${bt} | ${bt}add_guideline${bt} |`, `| Remove guideline | ${bt}${toolPrefix}_core${bt} | ${bt}remove_guideline${bt} |`, `| Rollback identity | ${bt}${toolPrefix}_core${bt} | ${bt}rollback_identity${bt} |`);
|
|
49
|
+
mdLines.push('', '## Auto-Routing', '', 'A UserPromptSubmit hook auto-classifies every prompt via keyword matching.', `When you see a ${bt}[MODE-NAME]${bt} indicator in the system context:`, '', `1. Call ${bt}${toolPrefix}_core op:route_intent params:{ prompt: "<user message>" }${bt} to get full behavior rules`, '2. Follow the returned behavior rules for the detected mode', '3. Briefly acknowledge mode changes in your response (e.g., "Switching to FIX-MODE")', '', 'Available modes: FIX-MODE, BUILD-MODE, IMPROVE-MODE, DELIVER-MODE, REVIEW-MODE, PLAN-MODE, DESIGN-MODE, VALIDATE-MODE, EXPLORE-MODE, GENERAL-MODE.', 'GENERAL-MODE means the hook detected a work task but could not classify a specific mode — route_intent will refine it.', '', '## Intent Detection', '', '| Signal | Intent |', '|--------|--------|', '| Problem described ("broken", "janky", "weird") | FIX |', '| Need expressed ("I need", "we should have") | BUILD |', '| Quality questioned ("is this right?") | REVIEW |', '| Advice sought ("how should I", "best way") | PLAN |', '| Improvement requested ("make it faster") | IMPROVE |', '', '## Knowledge Protocol', '', 'When seeking guidance: vault before codebase before web.', '', `1. Search vault \u2014 ${bt}${toolPrefix}_core op:search${bt}`, '2. Codebase \u2014 only if vault has nothing', '3. Web \u2014 last resort', '', '## Knowledge Capture', '', 'When learning something that should persist, use the domain capture ops.', '', '## Session Capture', '', 'A PreCompact hook is configured to call `session_capture` before context compaction.', 'This automatically preserves session summaries as memories for future sessions.', `To manually capture: ${bt}${toolPrefix}_core op:session_capture params:{ summary: "..." }${bt}`, '', '## Planning', '', 'For multi-step tasks, use the planning system:', `1. Create: ${bt}${toolPrefix}_core op:create_plan params:{ objective: "...", scope: "...", tasks: [...] }${bt}`, `2. Approve: ${bt}${toolPrefix}_core op:approve_plan params:{ planId: "...", startExecution: true }${bt}`, `3. Track: ${bt}${toolPrefix}_core op:update_task params:{ planId: "...", taskId: "...", status: "completed" }${bt}`, `4. Complete: ${bt}${toolPrefix}_core op:complete_plan params:{ planId: "..." }${bt}`, '', 'Check activation response for recovered plans in `executing` state — remind the user.', '', `<!-- /${marker} -->`);
|
|
50
50
|
// Escape each markdown line for use in a single-quoted TS string literal
|
|
51
51
|
const quotedLines = mdLines.map((line) => {
|
|
52
52
|
const escaped = line.replace(/\\/g, '\\\\').replace(/'/g, "\\'");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-md-template.js","sourceRoot":"","sources":["../../src/templates/claude-md-template.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,UAAU,wBAAwB,CAAC,MAAmB;IAC1D,MAAM,
|
|
1
|
+
{"version":3,"file":"claude-md-template.js","sourceRoot":"","sources":["../../src/templates/claude-md-template.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,UAAU,wBAAwB,CAAC,MAAmB;IAC1D,MAAM,UAAU,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC,+CAA+C;IAC7E,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC,EAAE,OAAO,CAAC;IACnC,MAAM,EAAE,GAAG,GAAG,CAAC,CAAC,kCAAkC;IAElD,gEAAgE;IAChE,MAAM,OAAO,GAAa;QACxB,QAAQ,MAAM,MAAM;QACpB,EAAE;QACF,KAAK,MAAM,CAAC,IAAI,OAAO;QACvB,EAAE;QACF,MAAM,MAAM,CAAC,IAAI,cAAc;QAC/B,EAAE;QACF,yBAAyB,MAAM,CAAC,IAAI,aAAa,EAAE,GAAG,UAAU,gDAAgD,EAAE,EAAE;QACpH,6BAA6B,MAAM,CAAC,IAAI,aAAa,EAAE,GAAG,UAAU,gDAAgD,EAAE,EAAE;QACxH,EAAE;QACF,iFAAiF;QACjF,EAAE;QACF,kBAAkB;QAClB,EAAE;QACF,yBAAyB,EAAE,GAAG,UAAU,gDAAgD,EAAE,EAAE;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,MAAM,MAAM,CACtB,CAAC;IAEF,yEAAyE;IACzE,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACvC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACjE,OAAO,QAAQ,OAAO,IAAI,CAAC;IAC7B,CAAC,CAAC,CAAC;IAEH,sCAAsC;IACtC,MAAM,OAAO,GAAG;QACd,KAAK;QACL,4BAA4B,MAAM,CAAC,IAAI,GAAG;QAC1C,gDAAgD;QAChD,KAAK;QACL,gDAAgD;QAChD,YAAY;QACZ,GAAG,WAAW;QACd,kBAAkB;QAClB,GAAG;QACH,EAAE;QACF,+CAA+C;QAC/C,aAAa,MAAM,IAAI;QACvB,GAAG;KACJ,CAAC;IAEF,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -59,9 +59,13 @@ async function main(): Promise<void> {
|
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
61
|
name: 'identity',
|
|
62
|
-
description: 'Get agent identity — name, role, principles.',
|
|
62
|
+
description: 'Get agent identity — name, role, principles. Uses IdentityManager with PERSONA fallback.',
|
|
63
63
|
auth: 'read',
|
|
64
|
-
handler: async () =>
|
|
64
|
+
handler: async () => {
|
|
65
|
+
const identity = runtime.identityManager.getIdentity('${config.id}');
|
|
66
|
+
if (identity) return identity;
|
|
67
|
+
return PERSONA;
|
|
68
|
+
},
|
|
65
69
|
},
|
|
66
70
|
{
|
|
67
71
|
name: 'activate',
|
|
@@ -75,6 +79,17 @@ async function main(): Promise<void> {
|
|
|
75
79
|
if (params.deactivate) {
|
|
76
80
|
return deactivateAgent();
|
|
77
81
|
}
|
|
82
|
+
// Seed identity from PERSONA on first activation
|
|
83
|
+
if (!runtime.identityManager.getIdentity('${config.id}')) {
|
|
84
|
+
runtime.identityManager.setIdentity('${config.id}', {
|
|
85
|
+
name: PERSONA.name,
|
|
86
|
+
role: PERSONA.role,
|
|
87
|
+
description: PERSONA.description ?? '',
|
|
88
|
+
personality: PERSONA.principles ?? [],
|
|
89
|
+
changedBy: 'system',
|
|
90
|
+
changeReason: 'Initial identity seeded from PERSONA',
|
|
91
|
+
});
|
|
92
|
+
}
|
|
78
93
|
return activateAgent(runtime.vault, (params.projectPath as string) ?? '.', runtime.planner);
|
|
79
94
|
},
|
|
80
95
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry-point.js","sourceRoot":"","sources":["../../src/templates/entry-point.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAmB;IACpD,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAEtD,OAAO;;;;;;;;;;;;;;;;;;;;;;;;gBAwBO,MAAM,CAAC,EAAE
|
|
1
|
+
{"version":3,"file":"entry-point.js","sourceRoot":"","sources":["../../src/templates/entry-point.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAmB;IACpD,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAEtD,OAAO;;;;;;;;;;;;;;;;;;;;;;;;gBAwBO,MAAM,CAAC,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gEA+BuC,MAAM,CAAC,EAAE;;;;;;;qGAO4B,MAAM,CAAC,IAAI;;;;;;;;;;;oDAW5D,MAAM,CAAC,EAAE;iDACZ,MAAM,CAAC,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kCA4DxB,MAAM,CAAC,IAAI;;;;;;;;;;;;;;;;;;;aAmBhC,MAAM,CAAC,EAAE;;;;;wDAKkC,MAAM,CAAC,EAAE,MAAM,cAAc;;;;aAIxE,MAAM,CAAC,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBA8BF,MAAM,CAAC,EAAE;;;CAG5B,CAAC;AACF,CAAC"}
|
|
@@ -72,7 +72,7 @@ if [ ! -f "$SETTINGS_FILE" ]; then
|
|
|
72
72
|
"PreCompact": [
|
|
73
73
|
{
|
|
74
74
|
"type": "prompt",
|
|
75
|
-
"prompt": "Before context is compacted, capture a session summary by calling ${config.id
|
|
75
|
+
"prompt": "Before context is compacted, capture a session summary by calling ${config.id}_core op:session_capture with a brief summary of what was accomplished, the topics covered, files modified, and tools used."
|
|
76
76
|
}
|
|
77
77
|
]
|
|
78
78
|
}
|
|
@@ -91,7 +91,7 @@ else
|
|
|
91
91
|
if (!settings.hooks.PreCompact) settings.hooks.PreCompact = [];
|
|
92
92
|
settings.hooks.PreCompact.push({
|
|
93
93
|
type: 'prompt',
|
|
94
|
-
prompt: 'Before context is compacted, capture a session summary by calling ${config.id
|
|
94
|
+
prompt: 'Before context is compacted, capture a session summary by calling ${config.id}_core op:session_capture with a brief summary of what was accomplished, the topics covered, files modified, and tools used.'
|
|
95
95
|
});
|
|
96
96
|
fs.writeFileSync('$SETTINGS_FILE', JSON.stringify(settings, null, 2) + '\\n');
|
|
97
97
|
"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-script.js","sourceRoot":"","sources":["../../src/templates/setup-script.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAmB;IACrD,OAAO;;;;cAIK,MAAM,CAAC,EAAE;;YAEX,MAAM,CAAC,IAAI;;;;;;;;;;;;;;;;;;;mBAmBJ,MAAM,CAAC,IAAI;;;;;;;;;;;;;;;gCAeE,MAAM,CAAC,IAAI;;;;;;;;oBAQvB,MAAM,CAAC,IAAI;;;wBAGP,MAAM,CAAC,IAAI;;;;;;;;;;;;;;;;;;uFAkBoD,MAAM,CAAC,EAAE
|
|
1
|
+
{"version":3,"file":"setup-script.js","sourceRoot":"","sources":["../../src/templates/setup-script.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAmB;IACrD,OAAO;;;;cAIK,MAAM,CAAC,EAAE;;YAEX,MAAM,CAAC,IAAI;;;;;;;;;;;;;;;;;;;mBAmBJ,MAAM,CAAC,IAAI;;;;;;;;;;;;;;;gCAeE,MAAM,CAAC,IAAI;;;;;;;;oBAQvB,MAAM,CAAC,IAAI;;;wBAGP,MAAM,CAAC,IAAI;;;;;;;;;;;;;;;;;;uFAkBoD,MAAM,CAAC,EAAE;;;;;;;;;;;;;;;;;;;qFAmBX,MAAM,CAAC,EAAE;;;;;;;;;;;;;4BAalE,MAAM,CAAC,IAAI;;QAE/B,MAAM,CAAC,IAAI;CAClB,CAAC;AACF,CAAC"}
|
|
@@ -175,8 +175,17 @@ ${domainDescribes}
|
|
|
175
175
|
expect(opNames).toContain('activate');
|
|
176
176
|
expect(opNames).toContain('inject_claude_md');
|
|
177
177
|
expect(opNames).toContain('setup');
|
|
178
|
-
//
|
|
179
|
-
expect(
|
|
178
|
+
// Control ops (8)
|
|
179
|
+
expect(opNames).toContain('get_identity');
|
|
180
|
+
expect(opNames).toContain('update_identity');
|
|
181
|
+
expect(opNames).toContain('add_guideline');
|
|
182
|
+
expect(opNames).toContain('remove_guideline');
|
|
183
|
+
expect(opNames).toContain('rollback_identity');
|
|
184
|
+
expect(opNames).toContain('route_intent');
|
|
185
|
+
expect(opNames).toContain('morph');
|
|
186
|
+
expect(opNames).toContain('get_behavior_rules');
|
|
187
|
+
// Total: 50
|
|
188
|
+
expect(facade.ops.length).toBe(50);
|
|
180
189
|
});
|
|
181
190
|
|
|
182
191
|
it('search should query across all domains with ranked results', async () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-facades.js","sourceRoot":"","sources":["../../src/templates/test-facades.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,M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agent dir will be created inside) */
|
|
19
19
|
outputDir: z.ZodString;
|
|
20
20
|
}, "strip", z.ZodTypeAny, {
|
|
21
|
-
name: string;
|
|
22
21
|
id: string;
|
|
22
|
+
name: string;
|
|
23
23
|
role: string;
|
|
24
24
|
description: string;
|
|
25
25
|
domains: string[];
|
|
@@ -27,8 +27,8 @@ export declare const AgentConfigSchema: z.ZodObject<{
|
|
|
27
27
|
greeting: string;
|
|
28
28
|
outputDir: string;
|
|
29
29
|
}, {
|
|
30
|
-
name: string;
|
|
31
30
|
id: string;
|
|
31
|
+
name: string;
|
|
32
32
|
role: string;
|
|
33
33
|
description: string;
|
|
34
34
|
domains: string[];
|
package/package.json
CHANGED
|
@@ -86,11 +86,11 @@ main();
|
|
|
86
86
|
const content = `export function getClaudeMdContent(): string {
|
|
87
87
|
return [
|
|
88
88
|
'# Test Agent',
|
|
89
|
-
'| existing-domain patterns | \`
|
|
90
|
-
'| Search existing-domain | \`
|
|
91
|
-
'| Capture existing-domain | \`
|
|
92
|
-
'| Memory search | \`
|
|
93
|
-
'| Memory capture | \`
|
|
89
|
+
'| existing-domain patterns | \`test-agent_existing_domain\` | \`get_patterns\` |',
|
|
90
|
+
'| Search existing-domain | \`test-agent_existing_domain\` | \`search\` |',
|
|
91
|
+
'| Capture existing-domain | \`test-agent_existing_domain\` | \`capture\` |',
|
|
92
|
+
'| Memory search | \`test-agent_core\` | \`memory_search\` |',
|
|
93
|
+
'| Memory capture | \`test-agent_core\` | \`memory_capture\` |',
|
|
94
94
|
].join('\\n');
|
|
95
95
|
}
|
|
96
96
|
`;
|
|
@@ -478,7 +478,7 @@ import { Vault } from './vault/vault.js';
|
|
|
478
478
|
const result = patchClaudeMdContent(sampleSource, 'my-agent', ['web-components']);
|
|
479
479
|
expect(result).not.toBeNull();
|
|
480
480
|
|
|
481
|
-
expect(result).toContain('
|
|
481
|
+
expect(result).toContain('my-agent_web_components');
|
|
482
482
|
});
|
|
483
483
|
|
|
484
484
|
it('should handle multiple new domains', () => {
|
|
@@ -564,7 +564,7 @@ import { Vault } from './vault/vault.js';
|
|
|
564
564
|
'utf-8',
|
|
565
565
|
);
|
|
566
566
|
expect(patched).toContain('new-domain patterns');
|
|
567
|
-
expect(patched).toContain('
|
|
567
|
+
expect(patched).toContain('test-agent_new_domain');
|
|
568
568
|
});
|
|
569
569
|
|
|
570
570
|
it('should not patch source files when only updating existing domains', async () => {
|
package/src/patching.ts
CHANGED
|
@@ -109,12 +109,12 @@ export function patchClaudeMdContent(
|
|
|
109
109
|
agentId: string,
|
|
110
110
|
newDomains: string[],
|
|
111
111
|
): string | null {
|
|
112
|
-
const
|
|
112
|
+
const toolPrefix = agentId; // keep hyphens — matches MCP tool registration
|
|
113
113
|
const bt = '`';
|
|
114
114
|
|
|
115
115
|
// Filter out domains whose rows already exist (idempotent)
|
|
116
116
|
const domainsToAdd = newDomains.filter((d) => {
|
|
117
|
-
const toolName = `${
|
|
117
|
+
const toolName = `${toolPrefix}_${d.replace(/-/g, '_')}`;
|
|
118
118
|
return !source.includes(`${toolName}`);
|
|
119
119
|
});
|
|
120
120
|
|
|
@@ -136,7 +136,7 @@ export function patchClaudeMdContent(
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
const newRows = domainsToAdd.flatMap((d) => {
|
|
139
|
-
const toolName = `${
|
|
139
|
+
const toolName = `${toolPrefix}_${d.replace(/-/g, '_')}`;
|
|
140
140
|
return [
|
|
141
141
|
` '| ${d} patterns | ${bt}${toolName}${bt} | ${bt}get_patterns${bt} |',`,
|
|
142
142
|
` '| Search ${d} | ${bt}${toolName}${bt} | ${bt}search${bt} |',`,
|
|
@@ -8,13 +8,13 @@ import type { AgentConfig } from '../types.js';
|
|
|
8
8
|
* Uses array-joined pattern because generated code contains template literals.
|
|
9
9
|
*/
|
|
10
10
|
export function generateActivate(config: AgentConfig): string {
|
|
11
|
-
const
|
|
11
|
+
const toolPrefix = config.id; // keep hyphens — matches MCP tool registration
|
|
12
12
|
const _marker = `${config.id}:mode`;
|
|
13
13
|
|
|
14
14
|
// Build tool recommendations from config domains
|
|
15
15
|
const toolRecLines: string[] = [];
|
|
16
16
|
for (const d of config.domains) {
|
|
17
|
-
const toolName = `${
|
|
17
|
+
const toolName = `${toolPrefix}_${d.replace(/-/g, '_')}`;
|
|
18
18
|
toolRecLines.push(` { intent: 'search ${d}', facade: '${toolName}', op: 'search' },`);
|
|
19
19
|
toolRecLines.push(
|
|
20
20
|
` { intent: '${d} patterns', facade: '${toolName}', op: 'get_patterns' },`,
|
|
@@ -114,9 +114,9 @@ export function generateActivate(config: AgentConfig): string {
|
|
|
114
114
|
guidelineLines,
|
|
115
115
|
' ],',
|
|
116
116
|
' tool_recommendations: [',
|
|
117
|
-
` { intent: 'health check', facade: '${
|
|
118
|
-
` { intent: 'search all', facade: '${
|
|
119
|
-
` { intent: 'vault stats', facade: '${
|
|
117
|
+
` { intent: 'health check', facade: '${toolPrefix}_core', op: 'health' },`,
|
|
118
|
+
` { intent: 'search all', facade: '${toolPrefix}_core', op: 'search' },`,
|
|
119
|
+
` { intent: 'vault stats', facade: '${toolPrefix}_core', op: 'vault_stats' },`,
|
|
120
120
|
...toolRecLines,
|
|
121
121
|
' ],',
|
|
122
122
|
` session_instruction: 'You are now ' + PERSONA.name + ', a ' + PERSONA.role + '. Stay in character for the ENTIRE session. ' +`,
|
|
@@ -10,7 +10,7 @@ import type { AgentConfig } from '../types.js';
|
|
|
10
10
|
* backtick/template-literal escaping nightmares entirely.
|
|
11
11
|
*/
|
|
12
12
|
export function generateClaudeMdTemplate(config: AgentConfig): string {
|
|
13
|
-
const
|
|
13
|
+
const toolPrefix = config.id; // keep hyphens — matches MCP tool registration
|
|
14
14
|
const marker = `${config.id}:mode`;
|
|
15
15
|
const bt = '`'; // backtick — keeps template clean
|
|
16
16
|
|
|
@@ -22,28 +22,28 @@ export function generateClaudeMdTemplate(config: AgentConfig): string {
|
|
|
22
22
|
'',
|
|
23
23
|
`## ${config.name} Integration`,
|
|
24
24
|
'',
|
|
25
|
-
`**Activate:** "Hello, ${config.name}!" \u2192 ${bt}${
|
|
26
|
-
`**Deactivate:** "Goodbye, ${config.name}!" \u2192 ${bt}${
|
|
25
|
+
`**Activate:** "Hello, ${config.name}!" \u2192 ${bt}${toolPrefix}_core op:activate params:{ projectPath: "." }${bt}`,
|
|
26
|
+
`**Deactivate:** "Goodbye, ${config.name}!" \u2192 ${bt}${toolPrefix}_core op:activate params:{ deactivate: true }${bt}`,
|
|
27
27
|
'',
|
|
28
28
|
'On activation, adopt the returned persona. Stay in character until deactivated.',
|
|
29
29
|
'',
|
|
30
30
|
'## Session Start',
|
|
31
31
|
'',
|
|
32
|
-
`On every new session: ${bt}${
|
|
32
|
+
`On every new session: ${bt}${toolPrefix}_core op:register params:{ projectPath: "." }${bt}`,
|
|
33
33
|
'',
|
|
34
34
|
'## Facades',
|
|
35
35
|
'',
|
|
36
36
|
'| Need | Facade | Op |',
|
|
37
37
|
'|------|--------|----|',
|
|
38
|
-
`| Health check | ${bt}${
|
|
39
|
-
`| Search all | ${bt}${
|
|
40
|
-
`| Vault stats | ${bt}${
|
|
41
|
-
`| Identity | ${bt}${
|
|
38
|
+
`| Health check | ${bt}${toolPrefix}_core${bt} | ${bt}health${bt} |`,
|
|
39
|
+
`| Search all | ${bt}${toolPrefix}_core${bt} | ${bt}search${bt} |`,
|
|
40
|
+
`| Vault stats | ${bt}${toolPrefix}_core${bt} | ${bt}vault_stats${bt} |`,
|
|
41
|
+
`| Identity | ${bt}${toolPrefix}_core${bt} | ${bt}identity${bt} |`,
|
|
42
42
|
];
|
|
43
43
|
|
|
44
44
|
// Domain-specific facade rows
|
|
45
45
|
for (const d of config.domains) {
|
|
46
|
-
const toolName = `${
|
|
46
|
+
const toolName = `${toolPrefix}_${d.replace(/-/g, '_')}`;
|
|
47
47
|
mdLines.push(`| ${d} patterns | ${bt}${toolName}${bt} | ${bt}get_patterns${bt} |`);
|
|
48
48
|
mdLines.push(`| Search ${d} | ${bt}${toolName}${bt} | ${bt}search${bt} |`);
|
|
49
49
|
mdLines.push(`| Capture ${d} | ${bt}${toolName}${bt} | ${bt}capture${bt} |`);
|
|
@@ -51,23 +51,43 @@ export function generateClaudeMdTemplate(config: AgentConfig): string {
|
|
|
51
51
|
|
|
52
52
|
// Memory + Session + Export + Brain + Planning rows
|
|
53
53
|
mdLines.push(
|
|
54
|
-
`| Memory search | ${bt}${
|
|
55
|
-
`| Memory capture | ${bt}${
|
|
56
|
-
`| Memory list | ${bt}${
|
|
57
|
-
`| Session capture | ${bt}${
|
|
58
|
-
`| Export knowledge | ${bt}${
|
|
59
|
-
`| Record feedback | ${bt}${
|
|
60
|
-
`| Rebuild vocabulary | ${bt}${
|
|
61
|
-
`| Brain stats | ${bt}${
|
|
62
|
-
`| LLM status | ${bt}${
|
|
63
|
-
`| Create plan | ${bt}${
|
|
64
|
-
`| Get plan | ${bt}${
|
|
65
|
-
`| Approve plan | ${bt}${
|
|
66
|
-
`| Update task | ${bt}${
|
|
67
|
-
`| Complete plan | ${bt}${
|
|
54
|
+
`| Memory search | ${bt}${toolPrefix}_core${bt} | ${bt}memory_search${bt} |`,
|
|
55
|
+
`| Memory capture | ${bt}${toolPrefix}_core${bt} | ${bt}memory_capture${bt} |`,
|
|
56
|
+
`| Memory list | ${bt}${toolPrefix}_core${bt} | ${bt}memory_list${bt} |`,
|
|
57
|
+
`| Session capture | ${bt}${toolPrefix}_core${bt} | ${bt}session_capture${bt} |`,
|
|
58
|
+
`| Export knowledge | ${bt}${toolPrefix}_core${bt} | ${bt}export${bt} |`,
|
|
59
|
+
`| Record feedback | ${bt}${toolPrefix}_core${bt} | ${bt}record_feedback${bt} |`,
|
|
60
|
+
`| Rebuild vocabulary | ${bt}${toolPrefix}_core${bt} | ${bt}rebuild_vocabulary${bt} |`,
|
|
61
|
+
`| Brain stats | ${bt}${toolPrefix}_core${bt} | ${bt}brain_stats${bt} |`,
|
|
62
|
+
`| LLM status | ${bt}${toolPrefix}_core${bt} | ${bt}llm_status${bt} |`,
|
|
63
|
+
`| Create plan | ${bt}${toolPrefix}_core${bt} | ${bt}create_plan${bt} |`,
|
|
64
|
+
`| Get plan | ${bt}${toolPrefix}_core${bt} | ${bt}get_plan${bt} |`,
|
|
65
|
+
`| Approve plan | ${bt}${toolPrefix}_core${bt} | ${bt}approve_plan${bt} |`,
|
|
66
|
+
`| Update task | ${bt}${toolPrefix}_core${bt} | ${bt}update_task${bt} |`,
|
|
67
|
+
`| Complete plan | ${bt}${toolPrefix}_core${bt} | ${bt}complete_plan${bt} |`,
|
|
68
|
+
`| Route intent | ${bt}${toolPrefix}_core${bt} | ${bt}route_intent${bt} |`,
|
|
69
|
+
`| Morph mode | ${bt}${toolPrefix}_core${bt} | ${bt}morph${bt} |`,
|
|
70
|
+
`| Get behavior rules | ${bt}${toolPrefix}_core${bt} | ${bt}get_behavior_rules${bt} |`,
|
|
71
|
+
`| Get identity | ${bt}${toolPrefix}_core${bt} | ${bt}get_identity${bt} |`,
|
|
72
|
+
`| Update identity | ${bt}${toolPrefix}_core${bt} | ${bt}update_identity${bt} |`,
|
|
73
|
+
`| Add guideline | ${bt}${toolPrefix}_core${bt} | ${bt}add_guideline${bt} |`,
|
|
74
|
+
`| Remove guideline | ${bt}${toolPrefix}_core${bt} | ${bt}remove_guideline${bt} |`,
|
|
75
|
+
`| Rollback identity | ${bt}${toolPrefix}_core${bt} | ${bt}rollback_identity${bt} |`,
|
|
68
76
|
);
|
|
69
77
|
|
|
70
78
|
mdLines.push(
|
|
79
|
+
'',
|
|
80
|
+
'## Auto-Routing',
|
|
81
|
+
'',
|
|
82
|
+
'A UserPromptSubmit hook auto-classifies every prompt via keyword matching.',
|
|
83
|
+
`When you see a ${bt}[MODE-NAME]${bt} indicator in the system context:`,
|
|
84
|
+
'',
|
|
85
|
+
`1. Call ${bt}${toolPrefix}_core op:route_intent params:{ prompt: "<user message>" }${bt} to get full behavior rules`,
|
|
86
|
+
'2. Follow the returned behavior rules for the detected mode',
|
|
87
|
+
'3. Briefly acknowledge mode changes in your response (e.g., "Switching to FIX-MODE")',
|
|
88
|
+
'',
|
|
89
|
+
'Available modes: FIX-MODE, BUILD-MODE, IMPROVE-MODE, DELIVER-MODE, REVIEW-MODE, PLAN-MODE, DESIGN-MODE, VALIDATE-MODE, EXPLORE-MODE, GENERAL-MODE.',
|
|
90
|
+
'GENERAL-MODE means the hook detected a work task but could not classify a specific mode — route_intent will refine it.',
|
|
71
91
|
'',
|
|
72
92
|
'## Intent Detection',
|
|
73
93
|
'',
|
|
@@ -83,7 +103,7 @@ export function generateClaudeMdTemplate(config: AgentConfig): string {
|
|
|
83
103
|
'',
|
|
84
104
|
'When seeking guidance: vault before codebase before web.',
|
|
85
105
|
'',
|
|
86
|
-
`1. Search vault \u2014 ${bt}${
|
|
106
|
+
`1. Search vault \u2014 ${bt}${toolPrefix}_core op:search${bt}`,
|
|
87
107
|
'2. Codebase \u2014 only if vault has nothing',
|
|
88
108
|
'3. Web \u2014 last resort',
|
|
89
109
|
'',
|
|
@@ -95,15 +115,15 @@ export function generateClaudeMdTemplate(config: AgentConfig): string {
|
|
|
95
115
|
'',
|
|
96
116
|
'A PreCompact hook is configured to call `session_capture` before context compaction.',
|
|
97
117
|
'This automatically preserves session summaries as memories for future sessions.',
|
|
98
|
-
`To manually capture: ${bt}${
|
|
118
|
+
`To manually capture: ${bt}${toolPrefix}_core op:session_capture params:{ summary: "..." }${bt}`,
|
|
99
119
|
'',
|
|
100
120
|
'## Planning',
|
|
101
121
|
'',
|
|
102
122
|
'For multi-step tasks, use the planning system:',
|
|
103
|
-
`1. Create: ${bt}${
|
|
104
|
-
`2. Approve: ${bt}${
|
|
105
|
-
`3. Track: ${bt}${
|
|
106
|
-
`4. Complete: ${bt}${
|
|
123
|
+
`1. Create: ${bt}${toolPrefix}_core op:create_plan params:{ objective: "...", scope: "...", tasks: [...] }${bt}`,
|
|
124
|
+
`2. Approve: ${bt}${toolPrefix}_core op:approve_plan params:{ planId: "...", startExecution: true }${bt}`,
|
|
125
|
+
`3. Track: ${bt}${toolPrefix}_core op:update_task params:{ planId: "...", taskId: "...", status: "completed" }${bt}`,
|
|
126
|
+
`4. Complete: ${bt}${toolPrefix}_core op:complete_plan params:{ planId: "..." }${bt}`,
|
|
107
127
|
'',
|
|
108
128
|
'Check activation response for recovered plans in `executing` state — remind the user.',
|
|
109
129
|
'',
|
|
@@ -62,9 +62,13 @@ async function main(): Promise<void> {
|
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
64
|
name: 'identity',
|
|
65
|
-
description: 'Get agent identity — name, role, principles.',
|
|
65
|
+
description: 'Get agent identity — name, role, principles. Uses IdentityManager with PERSONA fallback.',
|
|
66
66
|
auth: 'read',
|
|
67
|
-
handler: async () =>
|
|
67
|
+
handler: async () => {
|
|
68
|
+
const identity = runtime.identityManager.getIdentity('${config.id}');
|
|
69
|
+
if (identity) return identity;
|
|
70
|
+
return PERSONA;
|
|
71
|
+
},
|
|
68
72
|
},
|
|
69
73
|
{
|
|
70
74
|
name: 'activate',
|
|
@@ -78,6 +82,17 @@ async function main(): Promise<void> {
|
|
|
78
82
|
if (params.deactivate) {
|
|
79
83
|
return deactivateAgent();
|
|
80
84
|
}
|
|
85
|
+
// Seed identity from PERSONA on first activation
|
|
86
|
+
if (!runtime.identityManager.getIdentity('${config.id}')) {
|
|
87
|
+
runtime.identityManager.setIdentity('${config.id}', {
|
|
88
|
+
name: PERSONA.name,
|
|
89
|
+
role: PERSONA.role,
|
|
90
|
+
description: PERSONA.description ?? '',
|
|
91
|
+
personality: PERSONA.principles ?? [],
|
|
92
|
+
changedBy: 'system',
|
|
93
|
+
changeReason: 'Initial identity seeded from PERSONA',
|
|
94
|
+
});
|
|
95
|
+
}
|
|
81
96
|
return activateAgent(runtime.vault, (params.projectPath as string) ?? '.', runtime.planner);
|
|
82
97
|
},
|
|
83
98
|
},
|
|
@@ -74,7 +74,7 @@ if [ ! -f "$SETTINGS_FILE" ]; then
|
|
|
74
74
|
"PreCompact": [
|
|
75
75
|
{
|
|
76
76
|
"type": "prompt",
|
|
77
|
-
"prompt": "Before context is compacted, capture a session summary by calling ${config.id
|
|
77
|
+
"prompt": "Before context is compacted, capture a session summary by calling ${config.id}_core op:session_capture with a brief summary of what was accomplished, the topics covered, files modified, and tools used."
|
|
78
78
|
}
|
|
79
79
|
]
|
|
80
80
|
}
|
|
@@ -93,7 +93,7 @@ else
|
|
|
93
93
|
if (!settings.hooks.PreCompact) settings.hooks.PreCompact = [];
|
|
94
94
|
settings.hooks.PreCompact.push({
|
|
95
95
|
type: 'prompt',
|
|
96
|
-
prompt: 'Before context is compacted, capture a session summary by calling ${config.id
|
|
96
|
+
prompt: 'Before context is compacted, capture a session summary by calling ${config.id}_core op:session_capture with a brief summary of what was accomplished, the topics covered, files modified, and tools used.'
|
|
97
97
|
});
|
|
98
98
|
fs.writeFileSync('$SETTINGS_FILE', JSON.stringify(settings, null, 2) + '\\n');
|
|
99
99
|
"
|
|
@@ -178,8 +178,17 @@ ${domainDescribes}
|
|
|
178
178
|
expect(opNames).toContain('activate');
|
|
179
179
|
expect(opNames).toContain('inject_claude_md');
|
|
180
180
|
expect(opNames).toContain('setup');
|
|
181
|
-
//
|
|
182
|
-
expect(
|
|
181
|
+
// Control ops (8)
|
|
182
|
+
expect(opNames).toContain('get_identity');
|
|
183
|
+
expect(opNames).toContain('update_identity');
|
|
184
|
+
expect(opNames).toContain('add_guideline');
|
|
185
|
+
expect(opNames).toContain('remove_guideline');
|
|
186
|
+
expect(opNames).toContain('rollback_identity');
|
|
187
|
+
expect(opNames).toContain('route_intent');
|
|
188
|
+
expect(opNames).toContain('morph');
|
|
189
|
+
expect(opNames).toContain('get_behavior_rules');
|
|
190
|
+
// Total: 50
|
|
191
|
+
expect(facade.ops.length).toBe(50);
|
|
183
192
|
});
|
|
184
193
|
|
|
185
194
|
it('search should query across all domains with ranked results', async () => {
|