はじめに
ドメイン パックは、特定の業界に固有のスキル、ツール、プロンプトを含む、事前に構築されたバンドルです。ユーザーは、ジェネリック エージェントの代わりに「ヘルスケア パック」を選択すると、医療ツール、臨床プロンプト、HIPAA 準拠チェックをすぐに利用できます。
1. ドメイン パックのアーキテクチャ
// packages/domains/src/types.ts
export interface DomainPack {
id: string;
name: string;
slug: string;
description: string;
version: string;
icon: string;
color: string;
skills: SkillDefinition[];
systemPrompt: string; // Domain-specific base prompt
suggestedQuestions: string[]; // Quick-start examples
complianceRules?: ComplianceRule[];
requiredPermissions?: string[];
}
export interface ComplianceRule {
id: string;
name: string;
description: string;
check: (message: string) => boolean;
action: 'warn' | 'block' | 'redact';
}
2. ヘルスケア ドメイン パック
// packages/domains/src/packs/healthcare.ts
export const healthcarePack: DomainPack = {
id: 'healthcare',
name: 'Healthcare & Medical',
slug: 'healthcare',
description: 'Medical AI assistant with clinical tools and HIPAA compliance',
version: '1.0.0',
icon: '🏥',
color: '#10b981',
systemPrompt: `You are a medical AI assistant. Guidelines:
- Always cite medical sources (PubMed, clinical guidelines)
- Include appropriate disclaimers for medical advice
- Follow HIPAA compliance for patient data
- Use ICD-10 codes when relevant
- Recommend professional consultation for diagnoses`,
suggestedQuestions: [
'Explain the mechanism of action of metformin',
'What are the differential diagnoses for chest pain?',
'Summarize the latest guidelines for hypertension management',
],
skills: [
defineSkill({
id: 'medical-search',
name: 'Medical Literature Search',
description: 'Search PubMed and medical databases',
version: '1.0.0',
tools: [
{
definition: {
name: 'pubmed_search',
description: 'Search PubMed for medical literature',
parameters: {
type: 'object',
properties: {
query: { type: 'string', description: 'Medical search query' },
maxResults: { type: 'number', description: 'Max results (1-20)' },
},
required: ['query'],
},
},
handler: pubmedSearchHandler,
},
{
definition: {
name: 'drug_interaction_check',
description: 'Check for drug-drug interactions',
parameters: {
type: 'object',
properties: {
drugs: { type: 'string', description: 'Comma-separated drug names' },
},
required: ['drugs'],
},
},
handler: drugInteractionHandler,
},
{
definition: {
name: 'icd10_lookup',
description: 'Look up ICD-10 diagnosis codes',
parameters: {
type: 'object',
properties: {
query: { type: 'string', description: 'Condition or symptom' },
},
required: ['query'],
},
},
handler: icd10LookupHandler,
},
],
}),
],
complianceRules: [
{
id: 'hipaa-phi',
name: 'HIPAA PHI Detection',
description: 'Detect and redact Protected Health Information',
check: (message) => {
// Detect SSN, patient IDs, etc.
return /\b\d{3}-\d{2}-\d{4}\b/.test(message) ||
/patient\s+id:\s*\w+/i.test(message);
},
action: 'redact',
},
],
};
3. ドメイン パック レジストリ
// packages/domains/src/domain-registry.ts
export class DomainRegistry {
private packs = new Map<string, DomainPack>();
register(pack: DomainPack) {
this.packs.set(pack.id, pack);
}
get(id: string): DomainPack | undefined {
return this.packs.get(id);
}
listAll(): DomainPack[] {
return Array.from(this.packs.values());
}
// Activate domain for a session
activateForSession(
domainId: string,
sessionId: string,
skillManager: SkillManager,
): void {
const pack = this.packs.get(domainId);
if (!pack) throw new Error(`Domain pack not found: ${domainId}`);
// Register all skills from the pack
for (const skill of pack.skills) {
skillManager.register(skill);
skillManager.activate(sessionId, skill.id);
}
}
}
4. xClaw で利用可能なドメイン パック
| パック | ツール | 使用例 |
|---|---|---|
| ヘルスケア | PubMed 検索、薬物相互作用、ICD-10 | 医療AIアシスタント |
| 法的 | 判例調査、契約分析、コンプライアンス | 法的調査 |
| 財務 | 市場データ、財務分析、リスクスコアリング | ファイナンシャルアドバイザー |
| 教育 | クイズジェネレーター、カリキュラムビルダー、採点 | エドテック AI |
| DevOps | ログ分析、インフラチェック、AlertManager | SRE アシスタント |
| カスタマーサポート | チケット検索、FAQ検索、感情分析 | サポートボット |
| 内容 | SEO分析、コンテンツカレンダー、ソーシャルポスト生成 | コンテンツマーケティング |
| 人事 | 履歴書パーサー、求人マッチング、面接の質問 | 人事オートメーション |
| 電子商取引 | 製品検索、価格比較、レビュー分析 | ショッピングアシスタント |
| データ分析 | SQL生成、チャート作成、統計テスト | データアナリスト |
| 研究 | 論文検索、引用管理、文献レビュー | 学術研究 |
| クリエイティブ | 画像プロンプト、ストーリージェネレーター、ブランドネーミング | クリエイティブAI |
| セキュリティ | CVE ルックアップ、SIEM 分析、脅威インテリジェンス | セキュリティアナリスト |
5. まとめ
- ドメイン パック = 事前構築されたバンドル (スキル + プロンプト + コンプライアンス)
- レジストリ パターン — プラグアンドプレイのアクティベーション
- コンプライアンス ルール — ドメイン固有の安全性チェック
- スケーラビリティ — 各パックは独立したパッケージであり、個別に公開できます。
次の記事: プラグイン システムと MCP プロトコル。