Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix([issue-5610]): preserve scheduled skill routing

[._.]/ Adam Eivy27debbcc299b
diff --git a/server/services/agentPromptBuilder.test.js b/server/services/agentPromptBuilder.test.js
index 4349b27833..5969d4e756 100644
--- a/server/services/agentPromptBuilder.test.js
+++ b/server/services/agentPromptBuilder.test.js
@@ -159,6 +159,16 @@ describe('composable skill template routing', () => {
}))).toEqual(['simplify']);
});
+ it.each(['analysisType', 'selfImprovementType'])(
+ 'prefers authoritative %s routing over broad description keywords',
+ (metadataKey) => {
+ expect(detectSkillTemplates(makeTask({
+ description: 'Audit repository structure',
+ metadata: { [metadataKey]: 'module-hygiene' },
+ }))).toEqual(['module-hygiene']);
+ },
+ );
+
it('joins templates in routing order and tolerates an unavailable domain guide', async () => {
const loadTemplate = vi.fn(async (name) => ({
'security-audit': 'Security lifecycle guidance',
diff --git a/server/services/promptSections/instructions.js b/server/services/promptSections/instructions.js
index a7d366f9db..daafeeaebd 100644
--- a/server/services/promptSections/instructions.js
+++ b/server/services/promptSections/instructions.js
@@ -54,6 +54,28 @@ const SKILL_MATCHERS = [
}
];
+const SKILL_NAMES = new Set(SKILL_MATCHERS.map(({ skill }) => skill));
+const TASK_TYPE_SKILL_ALIASES = Object.freeze({
+ security: 'security-audit',
+});
+
+const skillForTaskType = (task) => {
+ const taskTypes = [
+ task?.metadata?.analysisType,
+ task?.metadata?.taskAnalysisType,
+ task?.metadata?.selfImprovementType,
+ ];
+ for (const taskType of taskTypes) {
+ if (typeof taskType !== 'string') continue;
+ const normalized = taskType.trim().toLowerCase();
+ if (Object.hasOwn(TASK_TYPE_SKILL_ALIASES, normalized)) {
+ return TASK_TYPE_SKILL_ALIASES[normalized];
+ }
+ if (SKILL_NAMES.has(normalized)) return normalized;
+ }
+ return null;
+};
+
// Domain templates complement (rather than replace) the lifecycle template
// selected above. Keep this list narrow: broad graphics terms would add prompt
// weight to tasks that do not involve scene construction or rendering.
@@ -75,6 +97,9 @@ const DOMAIN_SKILL_MATCHERS = [
* @returns {string|null} Skill template name or null if no match
*/
export function detectSkillTemplate(task) {
+ const taskTypeSkill = skillForTaskType(task);
+ if (taskTypeSkill) return taskTypeSkill;
+
const desc = (task?.description || '').toLowerCase();
for (const matcher of SKILL_MATCHERS) {
if (matcher.keywords.some(kw => desc.includes(kw))) {