AI Skills

Add AI skills and register them with the HotCRM stack.

AI Skills

AI skills live in the skills/ directory of the package that owns them — src/sales/skills/ and src/service/skills/ today — and each package re-exports its own from that directory's index.ts.

HotCRM defines no agents of its own — there is no src/agents/ directory. Skills attach to the platform assistant (ask), which every ObjectStack environment already provides. Registering a skill in its package's skill list is the whole wiring step.

Add a skill

// src/sales/skills/renewal_pitch.skill.ts
import { defineSkill } from '@objectstack/spec';

export const RenewalPitchSkill = defineSkill({
  name: 'renewal_pitch',
  label: 'Renewal Pitch',
  description: 'Drafts renewal talk tracks from account and contract context.',
  instructions: `When asked for a renewal pitch, inspect the current
account and contract records, summarize risk, and draft a concise
  customer-facing talk track.`,
  tools: ['describe_object', 'query_records'],
});

Register it

Registration is two steps, and skipping the second one loses the skill in silence. Re-export it from its own package barrel, then add it to its package's skill list — appSkills in objectstack.composition.ts for the app package (sales, revenue and marketing), serviceSkills in src/service/index.ts for the service module. That list, not the barrel, is what the package's own defineStack({ skills }) receives:

// src/sales/skills/index.ts — the package barrel: a re-export, nothing else
export { RenewalPitchSkill } from './renewal_pitch.skill.js';
// objectstack.composition.ts — the app package's list
import { RenewalPitchSkill } from './src/sales/skills/index.js';

export const appSkills = [
  // …existing skills
  RenewalPitchSkill,
];

To make the skill activate on a particular record instead of everywhere, declare a triggerConditions entry on it — for example { field: 'objectName', operator: 'eq', value: 'crm_contract' }.

Verify

pnpm validate
pnpm typecheck
pnpm test

On this page