holomime 1.9.0 → 1.9.1

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.d.ts CHANGED
@@ -6064,4 +6064,52 @@ declare class HolomimeViolationError extends Error {
6064
6064
  constructor(violation: CallbackViolation);
6065
6065
  }
6066
6066
 
6067
- export { ARCHETYPES, ATTACHMENT_STYLES, type AdversarialCallbacks, type AdversarialCategory, type AdversarialReport, type AdversarialResult, type AdversarialRunOptions, type AdversarialScenario, type AlpacaExample, type AnonymizedPatternReport, AnthropicProvider, type ArchetypeTemplate, type AssessmentReport, type AssessmentResult, type AssetReview, type AssetType, type AttachmentStyle, type AuditEntry, type AuditEventType, type AutopilotResult, type AutopilotThreshold, type AwarenessDimension, BUILT_IN_DETECTORS, type BehavioralBaseline, type BehavioralCredential, type BehavioralEvent, type BehavioralEventType, type BehavioralGap, type BehavioralIndex, type BehavioralMemoryStore, type BehavioralPolicy, type BehavioralPolicyRule, type BehavioralPreset, type BenchmarkCallbacks, type BenchmarkComparison, type BenchmarkReport, type BenchmarkResult, type BenchmarkScenario, type BigFive, CATEGORIES, type CallbackMode, type CallbackStats, type CallbackViolation, type CertifyInput, type Communication, type CompactionResult, type CompactionSummary, type CompileInput, type CompiledConfig, type CompiledEmbodiedConfig, type ReACTStep as ComplianceReACTStep, type ComplianceReport, type ContextLayerInput, type Conversation, type ConversationLog, type CorpusFilter, type CorpusStats, type CorrectionRecord, type CrossAgentQuery, type CustomDetectorConfig, DEFAULT_OVERSIGHT, DIMENSIONS, type DPOPair, type DetectedPattern, type DetectorFactory, type DetectorFn$1 as DetectorFn, type DetectorOptions, type DiagnosisResult, type DimensionTrajectory, type Domain, type DriftTrigger, type EdgeType, type Embodiment, type EvolutionEntry, type EvolutionHistory, type EvolutionSummary, type EvolveCallbacks, type EvolveOptions, type EvolveResult, type Expression, type FleetAgent, type FleetAgentStatus, type FleetConfig, type FleetHandle, type FleetOptions, type FrameworkSection, type GazePolicy, type Gesture, type GraphEdge, type GraphNode, type Growth, type GrowthArea, type GrowthReport, type GrowthSnapshot, Guard, type GuardEntry, type GuardFilterResult, type GuardMiddleware, type GuardMiddlewareOptions, type GuardMiddlewareStats, type GuardMode, type GuardResult, type GuardViolation, type GuardWrapResult, type HFPushOptions, type HFPushResult, type HapticPolicy, HolomimeCallbackHandler, type HolomimeCallbackOptions, HolomimeViolationError, type HubDetector, type IndexComparison, type IndexEntry, type Intervention, type InterventionRepertoire, type InterventionSource, type InterviewCallbacks, type InterviewProbe, type InterviewResponse, type InterviewResult, type IterationResult, type KnowledgeGraph, LEARNING_ORIENTATIONS, type LLMMessage, type LLMProvider, type LeaderboardEntry, type LeaderboardSubmission, type LearningOrientation, LocalMarketplaceBackend, type LogFormat, type MarketplaceAsset, type MarketplaceBackend, MarketplaceClient, type MarketplaceSearchQuery, type MarketplaceSearchResult, type Message, type Modality, type MonitoringCertificate, type Morphology, type MotionParameters, type NetworkCallbacks, type NetworkConfig, type NetworkNode, type NetworkResult, type NetworkSession, type NodeType, OllamaProvider, OpenAIProvider, type OutcomeReport, type OversightAction, type OversightMode, type OversightNotification, type OversightPolicy, PROVIDER_PARAMS, type PairingStrategy, type PatternCorrelation, type PatternDelta, type PatternReport, type PatternStatus, type PatternTracker, type PersonalitySpec, type PersonalityTier, type PhaseConfig, type PhysicalSafety, type PolicyIntent, type PreSessionDiagnosis, type Prescription, type Prosody, type Provider, type ProviderConfig, type ProxemicZone, type PublishRequest, type PublishedBenchmark, type RLHFExample, type ReACTAction, type ReACTContext, type ReACTReport, type ReACTReportOptions, type ReACTStep$1 as ReACTStep, type Registry, type RegistryEntry, type ReportStatistics, type RiskFinding, type RollingContext, STANDARD_PROBES, SURFACE_MULTIPLIERS, type SafetyEnvelope, type SelfAuditFlag, type SelfAuditResult, type SelfObservation, type SessionCallbacks, type SessionOptions, type SessionOutcome, type SessionSummary, type SessionTranscript, type SessionTurn, type Severity, type SharedIntervention, type SharedKnowledge, type SortField, type StagingDiff, type Surface, type SyncAnchor, type SyncProfile, type SyncRule, THERAPIST_META_SPEC, THERAPY_DIMENSIONS, THERAPY_PHASES, type TherapistPromptOptions, type TherapyDimensions, type TherapyMemory, type TherapyPhase, type TieredPersonality, type TrainingExport, type TraitAlignment, type TraitScores, type TreatmentGoal, type TreatmentPlan, type TreatmentProgressReport, type VerifyResult, type WatchCallbacks, type WatchEvent, type WatchHandle, type WatchOptions, type WrapAgentOptions, type WrapOptions, type WrappedAgent, addEdge, addNode, addSessionToMemory, agentHandleFromSpec, appendAuditEntry, appendEvolution, applyRecommendations, bigFiveSchema, buildAgentTherapistPrompt, buildAnonymizedReport, buildPatientSystemPrompt, buildReACTContext, buildReACTFraming, buildSharedKnowledge, buildTherapistSystemPrompt, checkApproval, checkIterationBudget, communicationSchema, compactEvolutionRun, compactIteration, compareBenchmarks, compareIndex, compile, compileCustomDetector, compileEmbodied, compileForOpenClaw, compileL0, compileL1, compileL2, compileTiered, compiledConfigSchema, compiledEmbodiedConfigSchema, computeDimensionScore, computeGazePolicy, computeMotionParameters, computeProsody, computeProxemics, computeSyncProfile, conversationLogSchema, conversationSchema, convertToHFFormat, copyToClipboard, corpusStats, createBehavioralMemory, createGist, createGraph, createGuardMiddleware, createIndex, createIndexEntry, createMemory, createProvider, createRepertoire, createTreatmentPlan, decayUnseenPatterns, deepMergeSpec, detectApologies, detectBoundaryIssues, detectFormalityIssues, detectHedging, detectRecoveryPatterns, detectRetrievalQuality, detectSentiment, detectVerbosity, discoverAgentData, discoverAgents, discoverNetworkAgents, domainSchema, embodimentSchema, emitBehavioralEvent, encodeSnapshot, estimateConfidence, evaluateOutcome, expireOldEdges, exportTrainingData, expressionSchema, extractAlpacaExamples, extractDPOPairs, extractDPOPairsWithLLM, extractRLHFExamples, extractRecommendations, fetchLeaderboard, fetchPersonality, fetchRegistry, findCrossAgentCorrelations, findEdges, findNode, findNodesByType, formatComplianceReportMarkdown, formatGapSummary, formatPolicyYaml, formatReACTReportMarkdown, gazePolicySchema, generateBehavioralPolicy, generateBenchmarkMarkdown, generateComparisonMarkdown, generateComplianceReport, generateCredential, generateGapRecommendation, generateIndexMarkdown, generateMonitoringCertificate, generateMutations, generatePrescriptions, generateProgressReport, generateReACTReport, generateShareUrl, generateSystemPrompt, gestureSchema, getAdversarialCategories, getAdversarialScenarios, getAgentBehaviors, getArchetype, getArchetypesByCategory, getBehavioralMemorySummary, getBenchmarkScenarios, getBestCorrection, getCategories, getDetector, getDimension, getEvolutionSummary, getInheritanceChain, getInterviewContext, getMarketplaceClient, getMemoryContext, getNeighbors, getPhaseContext, getPreset, getScenarioById, getTotalSignalCount, getTrajectory, getTriggersForPattern, graphStats, growthAreaSchema, growthSchema, hapticPolicySchema, hashSpec, learnIntervention, listArchetypeIds, listDetectors, listDetectorsByCategory, listDetectorsByTag, listPresets, loadAuditLog, loadBehavioralMemory, loadBenchmarkResults, loadCorpus, loadCustomDetectors, loadEvolution, loadFleetConfig, loadGraph, loadLatestBenchmark, loadMemory, loadNetworkConfig, loadRepertoire, loadSpec, loadTranscripts, loadTreatmentPlan, mergeStores, messageSchema, modalitySchema, morphologySchema, motionParametersSchema, pairAgents, parseAnthropicAPILog, parseChatGPTExport, parseClaudeExport, parseConversationLog, parseConversationLogFromString, parseJSONLLog, parseMarkdownDetector, parseOTelGenAIExport, parseOpenAIAPILog, personalitySpecSchema, physicalSafetySchema, populateFromDiagnosis, populateFromEvolve, populateFromSession, prescribeDPOPairs, processReACTResponse, prosodySchema, providerSchema, proxemicZoneSchema, publishToLeaderboard, pushToHFHub, queryCorpus, queryInterventions, querySharedKnowledge, recommendTier, recordInterventionOutcome, recordObservation, recordSelfObservation, recordSessionOutcome, registerBuiltInDetectors, registerDetector, resetMarketplaceClient, resolveInheritance, resolveOversight, runAdversarialSuite, runAssessment, runAutopilot, runBenchmark, runDiagnosis, runEvolve, runInterview, runNetwork, runPreSessionDiagnosis, runSelfAudit, runTherapySession, safetyEnvelopeSchema, saveBehavioralMemory, saveBenchmarkResult, saveCredential, saveGraph, saveMemory, saveRepertoire, saveTranscript, saveTreatmentPlan, scoreLabel, scoreTraitsFromMessages, seedBuiltInPersonalities, selectIntervention, severityMeetsThreshold, severitySchema, shareAnonymizedPatterns, shareFromDiagnosis, startFleet, startMCPServer, startWatch, summarize, summarizeSessionForMemory, summarizeTherapy, surfaceSchema, syncAnchorSchema, syncProfileSchema, syncRuleSchema, therapyDimensionsSchema, therapyScoreLabel, transferIntervention, unregisterDetector, updateEdgeWeight, validateDetectorConfig, verifyAuditChain, verifyCredential, wrapAgent };
6067
+ /**
6068
+ * HoloMime Plugin for OpenClaw
6069
+ *
6070
+ * Adds behavioral alignment monitoring to any OpenClaw agent.
6071
+ * Detects sycophancy, over-apologizing, hedge-stacking, boundary violations,
6072
+ * and 4 more behavioral patterns using 8 rule-based detectors.
6073
+ *
6074
+ * Usage:
6075
+ * import register from "holomime/integrations/openclaw";
6076
+ * register(api);
6077
+ */
6078
+ interface OpenClawPluginConfig {
6079
+ personalityPath: string;
6080
+ autoInject: boolean;
6081
+ diagnosisDetail: "summary" | "standard" | "full";
6082
+ }
6083
+ interface OpenClawPluginApi {
6084
+ registerTool(id: string, definition: {
6085
+ description: string;
6086
+ parameters: Record<string, unknown>;
6087
+ handler: (params: Record<string, unknown>, context: ToolContext) => Promise<unknown>;
6088
+ }): void;
6089
+ registerCommand(definition: {
6090
+ name: string;
6091
+ description: string;
6092
+ acceptsArgs: boolean;
6093
+ handler: (ctx: CommandContext) => {
6094
+ text: string;
6095
+ };
6096
+ }): void;
6097
+ on(event: string, handler: (event: HookEvent) => void | Promise<void>): void;
6098
+ getConfig(): OpenClawPluginConfig;
6099
+ }
6100
+ interface ToolContext {
6101
+ getConversationHistory?(): Array<{
6102
+ role: string;
6103
+ content: string;
6104
+ }>;
6105
+ }
6106
+ interface CommandContext {
6107
+ args?: string;
6108
+ }
6109
+ interface HookEvent {
6110
+ appendSystemContext?(text: string): void;
6111
+ prependSystemContext?(text: string): void;
6112
+ }
6113
+ declare function register(api: OpenClawPluginApi): void;
6114
+
6115
+ export { ARCHETYPES, ATTACHMENT_STYLES, type AdversarialCallbacks, type AdversarialCategory, type AdversarialReport, type AdversarialResult, type AdversarialRunOptions, type AdversarialScenario, type AlpacaExample, type AnonymizedPatternReport, AnthropicProvider, type ArchetypeTemplate, type AssessmentReport, type AssessmentResult, type AssetReview, type AssetType, type AttachmentStyle, type AuditEntry, type AuditEventType, type AutopilotResult, type AutopilotThreshold, type AwarenessDimension, BUILT_IN_DETECTORS, type BehavioralBaseline, type BehavioralCredential, type BehavioralEvent, type BehavioralEventType, type BehavioralGap, type BehavioralIndex, type BehavioralMemoryStore, type BehavioralPolicy, type BehavioralPolicyRule, type BehavioralPreset, type BenchmarkCallbacks, type BenchmarkComparison, type BenchmarkReport, type BenchmarkResult, type BenchmarkScenario, type BigFive, CATEGORIES, type CallbackMode, type CallbackStats, type CallbackViolation, type CertifyInput, type Communication, type CompactionResult, type CompactionSummary, type CompileInput, type CompiledConfig, type CompiledEmbodiedConfig, type ReACTStep as ComplianceReACTStep, type ComplianceReport, type ContextLayerInput, type Conversation, type ConversationLog, type CorpusFilter, type CorpusStats, type CorrectionRecord, type CrossAgentQuery, type CustomDetectorConfig, DEFAULT_OVERSIGHT, DIMENSIONS, type DPOPair, type DetectedPattern, type DetectorFactory, type DetectorFn$1 as DetectorFn, type DetectorOptions, type DiagnosisResult, type DimensionTrajectory, type Domain, type DriftTrigger, type EdgeType, type Embodiment, type EvolutionEntry, type EvolutionHistory, type EvolutionSummary, type EvolveCallbacks, type EvolveOptions, type EvolveResult, type Expression, type FleetAgent, type FleetAgentStatus, type FleetConfig, type FleetHandle, type FleetOptions, type FrameworkSection, type GazePolicy, type Gesture, type GraphEdge, type GraphNode, type Growth, type GrowthArea, type GrowthReport, type GrowthSnapshot, Guard, type GuardEntry, type GuardFilterResult, type GuardMiddleware, type GuardMiddlewareOptions, type GuardMiddlewareStats, type GuardMode, type GuardResult, type GuardViolation, type GuardWrapResult, type HFPushOptions, type HFPushResult, type HapticPolicy, HolomimeCallbackHandler, type HolomimeCallbackOptions, HolomimeViolationError, type HubDetector, type IndexComparison, type IndexEntry, type Intervention, type InterventionRepertoire, type InterventionSource, type InterviewCallbacks, type InterviewProbe, type InterviewResponse, type InterviewResult, type IterationResult, type KnowledgeGraph, LEARNING_ORIENTATIONS, type LLMMessage, type LLMProvider, type LeaderboardEntry, type LeaderboardSubmission, type LearningOrientation, LocalMarketplaceBackend, type LogFormat, type MarketplaceAsset, type MarketplaceBackend, MarketplaceClient, type MarketplaceSearchQuery, type MarketplaceSearchResult, type Message, type Modality, type MonitoringCertificate, type Morphology, type MotionParameters, type NetworkCallbacks, type NetworkConfig, type NetworkNode, type NetworkResult, type NetworkSession, type NodeType, OllamaProvider, OpenAIProvider, type OpenClawPluginApi, type OpenClawPluginConfig, type OutcomeReport, type OversightAction, type OversightMode, type OversightNotification, type OversightPolicy, PROVIDER_PARAMS, type PairingStrategy, type PatternCorrelation, type PatternDelta, type PatternReport, type PatternStatus, type PatternTracker, type PersonalitySpec, type PersonalityTier, type PhaseConfig, type PhysicalSafety, type PolicyIntent, type PreSessionDiagnosis, type Prescription, type Prosody, type Provider, type ProviderConfig, type ProxemicZone, type PublishRequest, type PublishedBenchmark, type RLHFExample, type ReACTAction, type ReACTContext, type ReACTReport, type ReACTReportOptions, type ReACTStep$1 as ReACTStep, type Registry, type RegistryEntry, type ReportStatistics, type RiskFinding, type RollingContext, STANDARD_PROBES, SURFACE_MULTIPLIERS, type SafetyEnvelope, type SelfAuditFlag, type SelfAuditResult, type SelfObservation, type SessionCallbacks, type SessionOptions, type SessionOutcome, type SessionSummary, type SessionTranscript, type SessionTurn, type Severity, type SharedIntervention, type SharedKnowledge, type SortField, type StagingDiff, type Surface, type SyncAnchor, type SyncProfile, type SyncRule, THERAPIST_META_SPEC, THERAPY_DIMENSIONS, THERAPY_PHASES, type TherapistPromptOptions, type TherapyDimensions, type TherapyMemory, type TherapyPhase, type TieredPersonality, type TrainingExport, type TraitAlignment, type TraitScores, type TreatmentGoal, type TreatmentPlan, type TreatmentProgressReport, type VerifyResult, type WatchCallbacks, type WatchEvent, type WatchHandle, type WatchOptions, type WrapAgentOptions, type WrapOptions, type WrappedAgent, addEdge, addNode, addSessionToMemory, agentHandleFromSpec, appendAuditEntry, appendEvolution, applyRecommendations, bigFiveSchema, buildAgentTherapistPrompt, buildAnonymizedReport, buildPatientSystemPrompt, buildReACTContext, buildReACTFraming, buildSharedKnowledge, buildTherapistSystemPrompt, checkApproval, checkIterationBudget, communicationSchema, compactEvolutionRun, compactIteration, compareBenchmarks, compareIndex, compile, compileCustomDetector, compileEmbodied, compileForOpenClaw, compileL0, compileL1, compileL2, compileTiered, compiledConfigSchema, compiledEmbodiedConfigSchema, computeDimensionScore, computeGazePolicy, computeMotionParameters, computeProsody, computeProxemics, computeSyncProfile, conversationLogSchema, conversationSchema, convertToHFFormat, copyToClipboard, corpusStats, createBehavioralMemory, createGist, createGraph, createGuardMiddleware, createIndex, createIndexEntry, createMemory, createProvider, createRepertoire, createTreatmentPlan, decayUnseenPatterns, deepMergeSpec, detectApologies, detectBoundaryIssues, detectFormalityIssues, detectHedging, detectRecoveryPatterns, detectRetrievalQuality, detectSentiment, detectVerbosity, discoverAgentData, discoverAgents, discoverNetworkAgents, domainSchema, embodimentSchema, emitBehavioralEvent, encodeSnapshot, estimateConfidence, evaluateOutcome, expireOldEdges, exportTrainingData, expressionSchema, extractAlpacaExamples, extractDPOPairs, extractDPOPairsWithLLM, extractRLHFExamples, extractRecommendations, fetchLeaderboard, fetchPersonality, fetchRegistry, findCrossAgentCorrelations, findEdges, findNode, findNodesByType, formatComplianceReportMarkdown, formatGapSummary, formatPolicyYaml, formatReACTReportMarkdown, gazePolicySchema, generateBehavioralPolicy, generateBenchmarkMarkdown, generateComparisonMarkdown, generateComplianceReport, generateCredential, generateGapRecommendation, generateIndexMarkdown, generateMonitoringCertificate, generateMutations, generatePrescriptions, generateProgressReport, generateReACTReport, generateShareUrl, generateSystemPrompt, gestureSchema, getAdversarialCategories, getAdversarialScenarios, getAgentBehaviors, getArchetype, getArchetypesByCategory, getBehavioralMemorySummary, getBenchmarkScenarios, getBestCorrection, getCategories, getDetector, getDimension, getEvolutionSummary, getInheritanceChain, getInterviewContext, getMarketplaceClient, getMemoryContext, getNeighbors, getPhaseContext, getPreset, getScenarioById, getTotalSignalCount, getTrajectory, getTriggersForPattern, graphStats, growthAreaSchema, growthSchema, hapticPolicySchema, hashSpec, learnIntervention, listArchetypeIds, listDetectors, listDetectorsByCategory, listDetectorsByTag, listPresets, loadAuditLog, loadBehavioralMemory, loadBenchmarkResults, loadCorpus, loadCustomDetectors, loadEvolution, loadFleetConfig, loadGraph, loadLatestBenchmark, loadMemory, loadNetworkConfig, loadRepertoire, loadSpec, loadTranscripts, loadTreatmentPlan, mergeStores, messageSchema, modalitySchema, morphologySchema, motionParametersSchema, pairAgents, parseAnthropicAPILog, parseChatGPTExport, parseClaudeExport, parseConversationLog, parseConversationLogFromString, parseJSONLLog, parseMarkdownDetector, parseOTelGenAIExport, parseOpenAIAPILog, personalitySpecSchema, physicalSafetySchema, populateFromDiagnosis, populateFromEvolve, populateFromSession, prescribeDPOPairs, processReACTResponse, prosodySchema, providerSchema, proxemicZoneSchema, publishToLeaderboard, pushToHFHub, queryCorpus, queryInterventions, querySharedKnowledge, recommendTier, recordInterventionOutcome, recordObservation, recordSelfObservation, recordSessionOutcome, registerBuiltInDetectors, registerDetector, register as registerOpenClawPlugin, resetMarketplaceClient, resolveInheritance, resolveOversight, runAdversarialSuite, runAssessment, runAutopilot, runBenchmark, runDiagnosis, runEvolve, runInterview, runNetwork, runPreSessionDiagnosis, runSelfAudit, runTherapySession, safetyEnvelopeSchema, saveBehavioralMemory, saveBenchmarkResult, saveCredential, saveGraph, saveMemory, saveRepertoire, saveTranscript, saveTreatmentPlan, scoreLabel, scoreTraitsFromMessages, seedBuiltInPersonalities, selectIntervention, severityMeetsThreshold, severitySchema, shareAnonymizedPatterns, shareFromDiagnosis, startFleet, startMCPServer, startWatch, summarize, summarizeSessionForMemory, summarizeTherapy, surfaceSchema, syncAnchorSchema, syncProfileSchema, syncRuleSchema, therapyDimensionsSchema, therapyScoreLabel, transferIntervention, unregisterDetector, updateEdgeWeight, validateDetectorConfig, verifyAuditChain, verifyCredential, wrapAgent };
package/dist/index.js CHANGED
@@ -7868,7 +7868,7 @@ function parseRetryAfter(response) {
7868
7868
  return 0;
7869
7869
  }
7870
7870
  function delay(ms) {
7871
- return new Promise((resolve17) => setTimeout(resolve17, ms));
7871
+ return new Promise((resolve18) => setTimeout(resolve18, ms));
7872
7872
  }
7873
7873
  var OpenAIProvider = class {
7874
7874
  name = "openai";
@@ -12108,6 +12108,155 @@ var HolomimeViolationError = class extends Error {
12108
12108
  this.violation = violation;
12109
12109
  }
12110
12110
  };
12111
+
12112
+ // src/integrations/openclaw.ts
12113
+ import { readFileSync as readFileSync20, existsSync as existsSync19 } from "fs";
12114
+ import { resolve as resolve17 } from "path";
12115
+ function loadSpec2(specPath) {
12116
+ const resolved = resolve17(process.cwd(), specPath);
12117
+ if (!existsSync19(resolved)) return null;
12118
+ try {
12119
+ return JSON.parse(readFileSync20(resolved, "utf-8"));
12120
+ } catch {
12121
+ return null;
12122
+ }
12123
+ }
12124
+ function formatDiagnosisSummary(result) {
12125
+ const patternCount = result.patterns.length;
12126
+ const health = patternCount === 0 ? 100 : Math.max(0, 100 - patternCount * 15);
12127
+ const grade = health >= 85 ? "A" : health >= 70 ? "B" : health >= 50 ? "C" : health >= 30 ? "D" : "F";
12128
+ return JSON.stringify({
12129
+ health,
12130
+ grade,
12131
+ status: patternCount === 0 ? "healthy" : result.patterns[0].severity,
12132
+ patternsDetected: patternCount,
12133
+ patternIds: result.patterns.map((p) => p.id),
12134
+ recommendation: patternCount === 0 ? "continue" : patternCount <= 2 ? "adjust" : "pause_and_reflect"
12135
+ }, null, 2);
12136
+ }
12137
+ function formatDiagnosisStandard(result) {
12138
+ return JSON.stringify({
12139
+ messagesAnalyzed: result.messagesAnalyzed,
12140
+ assistantResponses: result.assistantResponses,
12141
+ patterns: result.patterns.map((p) => ({
12142
+ id: p.id,
12143
+ name: p.name,
12144
+ severity: p.severity,
12145
+ count: p.count,
12146
+ percentage: p.percentage,
12147
+ description: p.description,
12148
+ prescription: p.prescription
12149
+ })),
12150
+ healthy: result.healthy.map((p) => p.id),
12151
+ timestamp: result.timestamp
12152
+ }, null, 2);
12153
+ }
12154
+ function formatDiagnosis(result, detail) {
12155
+ if (detail === "summary") return formatDiagnosisSummary(result);
12156
+ if (detail === "standard") return formatDiagnosisStandard(result);
12157
+ return JSON.stringify(result, null, 2);
12158
+ }
12159
+ function register(api) {
12160
+ const config = api.getConfig();
12161
+ api.registerTool("holomime_diagnose", {
12162
+ description: "Analyze conversation for behavioral patterns using HoloMime's 8 rule-based detectors. Detects over-apologizing, hedging, sycophancy, boundary violations, error spirals, sentiment skew, formality issues, and retrieval quality. Returns health score (0-100), grade (A-F), and actionable prescriptions.",
12163
+ parameters: {
12164
+ type: "object",
12165
+ properties: {
12166
+ messages: {
12167
+ type: "array",
12168
+ items: {
12169
+ type: "object",
12170
+ properties: {
12171
+ role: { type: "string", enum: ["user", "assistant", "system"] },
12172
+ content: { type: "string" }
12173
+ },
12174
+ required: ["role", "content"]
12175
+ },
12176
+ description: "Conversation messages to analyze. If omitted, uses current conversation history."
12177
+ },
12178
+ detail: {
12179
+ type: "string",
12180
+ enum: ["summary", "standard", "full"],
12181
+ description: "Detail level: summary (~100 tokens), standard (default), full (with examples)."
12182
+ }
12183
+ }
12184
+ },
12185
+ handler: async (params, context) => {
12186
+ let messages = params.messages;
12187
+ if (!messages && context.getConversationHistory) {
12188
+ messages = context.getConversationHistory().map((m) => ({
12189
+ role: m.role,
12190
+ content: m.content
12191
+ }));
12192
+ }
12193
+ if (!messages || messages.length === 0) {
12194
+ return { text: "No messages to analyze. Provide messages or start a conversation first." };
12195
+ }
12196
+ const result = runDiagnosis(messages);
12197
+ const detail = params.detail ?? config.diagnosisDetail;
12198
+ return { text: formatDiagnosis(result, detail) };
12199
+ }
12200
+ });
12201
+ api.registerTool("holomime_assess", {
12202
+ description: "Full Big Five personality alignment assessment. Compares agent behavior against its .personality.json specification. Returns trait alignments, health score, and prescriptions. Requires a .personality.json file in the project root.",
12203
+ parameters: {
12204
+ type: "object",
12205
+ properties: {
12206
+ messages: {
12207
+ type: "array",
12208
+ items: {
12209
+ type: "object",
12210
+ properties: {
12211
+ role: { type: "string", enum: ["user", "assistant", "system"] },
12212
+ content: { type: "string" }
12213
+ },
12214
+ required: ["role", "content"]
12215
+ },
12216
+ description: "Conversation messages to assess. If omitted, uses current conversation history."
12217
+ }
12218
+ }
12219
+ },
12220
+ handler: async (params, context) => {
12221
+ const spec = loadSpec2(config.personalityPath);
12222
+ if (!spec) {
12223
+ return { text: `No personality spec found at ${config.personalityPath}. Create one with: npx holomime init` };
12224
+ }
12225
+ let messages = params.messages;
12226
+ if (!messages && context.getConversationHistory) {
12227
+ messages = context.getConversationHistory().map((m) => ({
12228
+ role: m.role,
12229
+ content: m.content
12230
+ }));
12231
+ }
12232
+ if (!messages || messages.length === 0) {
12233
+ return { text: "No messages to assess." };
12234
+ }
12235
+ const result = runAssessment(messages, spec);
12236
+ return { text: JSON.stringify(result, null, 2) };
12237
+ }
12238
+ });
12239
+ api.registerCommand({
12240
+ name: "holomime-brain",
12241
+ description: "Launch the 3D brain visualization for this agent. Opens in your browser.",
12242
+ acceptsArgs: false,
12243
+ handler: () => {
12244
+ return {
12245
+ text: "To view your agent's brain visualization, run:\n\n```\nnpx holomime brain\n```\n\nThis opens a real-time 3D brain that lights up based on detected behavioral patterns. Press 's' to generate a shareable snapshot URL.\n\nLearn more: https://holomime.dev"
12246
+ };
12247
+ }
12248
+ });
12249
+ if (config.autoInject) {
12250
+ api.on("before_prompt_build", (event) => {
12251
+ const spec = loadSpec2(config.personalityPath);
12252
+ if (!spec) return;
12253
+ const { soul } = compileForOpenClaw(spec);
12254
+ event.appendSystemContext?.(
12255
+ "\n\n<!-- HoloMime Behavioral Alignment Context -->\n" + soul
12256
+ );
12257
+ });
12258
+ }
12259
+ }
12111
12260
  export {
12112
12261
  ARCHETYPES,
12113
12262
  ATTACHMENT_STYLES,
@@ -12323,6 +12472,7 @@ export {
12323
12472
  recordSessionOutcome,
12324
12473
  registerBuiltInDetectors,
12325
12474
  registerDetector,
12475
+ register as registerOpenClawPlugin,
12326
12476
  resetMarketplaceClient,
12327
12477
  resolveInheritance,
12328
12478
  resolveOversight,
@@ -0,0 +1,49 @@
1
+ /**
2
+ * HoloMime Plugin for OpenClaw
3
+ *
4
+ * Adds behavioral alignment monitoring to any OpenClaw agent.
5
+ * Detects sycophancy, over-apologizing, hedge-stacking, boundary violations,
6
+ * and 4 more behavioral patterns using 8 rule-based detectors.
7
+ *
8
+ * Usage:
9
+ * import register from "holomime/integrations/openclaw";
10
+ * register(api);
11
+ */
12
+ interface OpenClawPluginConfig {
13
+ personalityPath: string;
14
+ autoInject: boolean;
15
+ diagnosisDetail: "summary" | "standard" | "full";
16
+ }
17
+ interface OpenClawPluginApi {
18
+ registerTool(id: string, definition: {
19
+ description: string;
20
+ parameters: Record<string, unknown>;
21
+ handler: (params: Record<string, unknown>, context: ToolContext) => Promise<unknown>;
22
+ }): void;
23
+ registerCommand(definition: {
24
+ name: string;
25
+ description: string;
26
+ acceptsArgs: boolean;
27
+ handler: (ctx: CommandContext) => {
28
+ text: string;
29
+ };
30
+ }): void;
31
+ on(event: string, handler: (event: HookEvent) => void | Promise<void>): void;
32
+ getConfig(): OpenClawPluginConfig;
33
+ }
34
+ interface ToolContext {
35
+ getConversationHistory?(): Array<{
36
+ role: string;
37
+ content: string;
38
+ }>;
39
+ }
40
+ interface CommandContext {
41
+ args?: string;
42
+ }
43
+ interface HookEvent {
44
+ appendSystemContext?(text: string): void;
45
+ prependSystemContext?(text: string): void;
46
+ }
47
+ declare function register(api: OpenClawPluginApi): void;
48
+
49
+ export { type OpenClawPluginApi, type OpenClawPluginConfig, register as default };