Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
/**
* Every BrainEngine member, classified for the Rust engine (docs/designs/RUST_ENGINE.md, "Capability gating").
*
* `implemented` members run on the Rust engine. Every other member names the capability it belongs to; until the Rust
* engine implements it, a call rejects with `engine_capability_missing` naming that capability, before any work, so
* nothing is written. The `satisfies` clause makes a new BrainEngine member fail to compile until it is classified here.
*/
import type { Capability } from '../engine-capabilities.ts';
import type { BrainEngine } from '../engine.ts';
export type MemberClass = 'implemented' | Capability;
export const RUST_ENGINE_MEMBERS = {
// implemented
kind: 'implemented',
capabilities: 'implemented',
connect: 'implemented',
disconnect: 'implemented',
reconnect: 'implemented',
registerBeforeDisconnect: 'implemented',
// raw_sql
withReservedConnection: 'raw_sql',
executeRaw: 'raw_sql',
executeRawDirect: 'raw_sql',
keywordBoundedRead: 'raw_sql',
runMigration: 'raw_sql',
// schema
initSchema: 'schema',
holdSchemaMigrationLock: 'schema',
// transactions
transaction: 'transactions',
transactionDirect: 'transactions',
lockPageKeys: 'transactions',
// pages
getPage: 'pages',
readPageSnapshot: 'pages',
readPageSnapshotsBatch: 'pages',
putPage: 'pages',
findDuplicatePage: 'pages',
findDuplicatePages: 'pages',
deletePage: 'pages',
deletePages: 'pages',
resolveSlugsByPaths: 'pages',
softDeletePage: 'pages',
softDeletePages: 'pages',
restorePage: 'pages',
purgeDeletedPages: 'pages',
listPages: 'pages',
findPages: 'pages',
countPagesBy: 'pages',
resolveSlugs: 'pages',
getAllSlugs: 'pages',
listAllPageRefs: 'pages',
listPrefixSampledPages: 'pages',
listCorpusSample: 'pages',
getPageTimestamps: 'pages',
getEffectiveDates: 'pages',
getContentFlagsByPageIds: 'pages',
getUnverifiedExtractionPageIds: 'pages',
countStalePagesForExtraction: 'pages',
listStalePagesForExtraction: 'pages',
markPagesExtractedBatch: 'pages',
markPagesAttendanceBlocked: 'pages',
countStaleFrontmatterKeyPages: 'pages',
listStaleFrontmatterKeyPages: 'pages',
stripStaleFrontmatterKeys: 'pages',
updateSlug: 'pages',
resolveSlugWithAlias: 'pages',
resolveSlugWithAliasDetailed: 'pages',
resolveAliases: 'pages',
setPageAliases: 'pages',
updatePageContextualRetrievalState: 'pages',
// sources
listAllSources: 'sources',
updateSourceConfig: 'sources',
// config
getConfig: 'config',
setConfig: 'config',
unsetConfig: 'config',
listConfigKeys: 'config',
getAllConfig: 'config',
// page_versions
createVersion: 'page_versions',
getVersions: 'page_versions',
revertToVersion: 'page_versions',
// page_body
refreshPageBody: 'page_body',
allocateBodyOccurrenceIds: 'page_body',
stageSegmentTexts: 'page_body',
readSegmentTexts: 'page_body',
stageManifestRows: 'page_body',
readManifest: 'page_body',
stageSegmentChunks: 'page_body',
createSegmentedPageShell: 'page_body',
flipBodyGeneration: 'page_body',
openBodyStaging: 'page_body',
setBodyStagingState: 'page_body',
sweepSegments: 'page_body',
readSegmentDerivations: 'page_body',
upsertSegmentDerivations: 'page_body',
retireSegmentDerivations: 'page_body',
// tags
addTag: 'tags',
removeTag: 'tags',
getTags: 'tags',
// chunks
upsertChunks: 'chunks',
sealChunks: 'chunks',
getChunks: 'chunks',
getChunkPage: 'chunks',
getChunkWindows: 'chunks',
countChunklessPagesWithContent: 'chunks',
listChunklessPagesWithContent: 'chunks',
deleteChunks: 'chunks',
// embeddings
getEmbeddingsByChunkIds: 'embeddings',
countStaleChunks: 'embeddings',
sumStaleChunkChars: 'embeddings',
setPageEmbeddingSignature: 'embeddings',
invalidateStaleSignatureEmbeddings: 'embeddings',
invalidateContentDriftEmbeddings: 'embeddings',
listStaleChunks: 'embeddings',
readEmbeddingStateCounts: 'embeddings',
listEmbeddingStateRows: 'embeddings',
getChunksWithEmbeddings: 'embeddings',
// keyword_search
searchKeyword: 'keyword_search',
countKeywordPages: 'keyword_search',
searchKeywordPages: 'keyword_search',
searchTitles: 'keyword_search',
searchKeywordChunks: 'keyword_search',
findByTitleFuzzy: 'keyword_search',
// vector_search
searchVector: 'vector_search',
// links
addLink: 'links',
addLinksBatch: 'links',
replaceDerivedLinks: 'links',
replaceDerivedLinksBatch: 'links',
removeLink: 'links',
removeLinksByPagesAndSource: 'links',
getLinks: 'links',
getBacklinks: 'links',
listLinkSources: 'links',
rewriteLinks: 'links',
getBacklinkCounts: 'links',
// timeline
addTimelineEntry: 'timeline',
addTimelineEntriesBatch: 'timeline',
getTimeline: 'timeline',
getTimelineForDate: 'timeline',
getSince: 'timeline',
getOnThisDay: 'timeline',
getLastSeen: 'timeline',
upsertEventProjection: 'timeline',
// graph
traverseGraph: 'graph',
traversePaths: 'graph',
traversePathsDetailed: 'graph',
relationalFanout: 'graph',
relationalChainHop: 'graph',
getAdjacencyBoosts: 'graph',
findOrphanPages: 'graph',
// facts
insertFact: 'facts',
insertFacts: 'facts',
deleteFactsForPage: 'facts',
expireFact: 'facts',
listFactsByEntity: 'facts',
listFactsSince: 'facts',
listFactsKeyset: 'facts',
listFactsBySession: 'facts',
listSupersessions: 'facts',
countUnconsolidatedFacts: 'facts',
findCandidateDuplicates: 'facts',
consolidateFact: 'facts',
findTrajectory: 'facts',
getFactsHealth: 'facts',
migrateFactsToCanonical: 'facts',
// takes
addTakesBatch: 'takes',
updateTakeEmbeddings: 'takes',
listTakes: 'takes',
searchTakes: 'takes',
searchTakesVector: 'takes',
getTakeEmbeddings: 'takes',
countStaleTakes: 'takes',
listStaleTakes: 'takes',
updateTake: 'takes',
supersedeTake: 'takes',
resolveTake: 'takes',
getScorecard: 'takes',
getCalibrationCurve: 'takes',
addSynthesisEvidence: 'takes',
listActiveTakesForPages: 'takes',
// files
upsertFile: 'files',
getFile: 'files',
listFilesForPage: 'files',
// code_edges
addCodeEdges: 'code_edges',
deleteCodeEdgesForChunks: 'code_edges',
getCallersOf: 'code_edges',
getCalleesOf: 'code_edges',
getEdgesByChunk: 'code_edges',
// salience
getSalienceScores: 'salience',
batchLoadEmotionalInputs: 'salience',
setEmotionalWeightBatch: 'salience',
getRecentSalience: 'salience',
// health
getStats: 'health',
getHealth: 'health',
listEnrichCandidates: 'health',
findAnomalies: 'health',
// raw_data
putRawData: 'raw_data',
getRawData: 'raw_data',
// eval_capture
logEvalCandidate: 'eval_capture',
listEvalCandidates: 'eval_capture',
deleteEvalCandidatesBefore: 'eval_capture',
logEvalCaptureFailure: 'eval_capture',
listEvalCaptureFailures: 'eval_capture',
// ingest_log
logIngest: 'ingest_log',
getIngestLog: 'ingest_log',
// dream_verdicts
getDreamVerdict: 'dream_verdicts',
putDreamVerdict: 'dream_verdicts',
sweepDreamVerdicts: 'dream_verdicts',
// contradictions
writeContradictionsRun: 'contradictions',
loadContradictionsTrend: 'contradictions',
getContradictionCacheEntry: 'contradictions',
putContradictionCacheEntry: 'contradictions',
sweepContradictionCache: 'contradictions',
// ontology
mergeOntologyFact: 'ontology',
getOntology: 'ontology',
discoverOntologyDimensions: 'ontology',
findOntologyConflicts: 'ontology',
} as const satisfies Record<keyof BrainEngine, MemberClass>;
export type RustEngineMember = keyof typeof RUST_ENGINE_MEMBERS;