@cleocode/core 2026.4.31 → 2026.4.36
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/adapters/adapter-registry.js +64 -0
- package/dist/adapters/adapter-registry.js.map +1 -0
- package/dist/adapters/discovery.js +83 -0
- package/dist/adapters/discovery.js.map +1 -0
- package/dist/adapters/index.js +9 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/manager.js +260 -0
- package/dist/adapters/manager.js.map +1 -0
- package/dist/admin/export-tasks.js +171 -0
- package/dist/admin/export-tasks.js.map +1 -0
- package/dist/admin/export.js +103 -0
- package/dist/admin/export.js.map +1 -0
- package/dist/admin/help.js +106 -0
- package/dist/admin/help.js.map +1 -0
- package/dist/admin/import-tasks.js +182 -0
- package/dist/admin/import-tasks.js.map +1 -0
- package/dist/admin/import.js +129 -0
- package/dist/admin/import.js.map +1 -0
- package/dist/admin/index.js +13 -0
- package/dist/admin/index.js.map +1 -0
- package/dist/adrs/find.js +134 -0
- package/dist/adrs/find.js.map +1 -0
- package/dist/adrs/index.js +15 -0
- package/dist/adrs/index.js.map +1 -0
- package/dist/adrs/link-pipeline.js +160 -0
- package/dist/adrs/link-pipeline.js.map +1 -0
- package/dist/adrs/list.js +43 -0
- package/dist/adrs/list.js.map +1 -0
- package/dist/adrs/parse.js +51 -0
- package/dist/adrs/parse.js.map +1 -0
- package/dist/adrs/show.js +22 -0
- package/dist/adrs/show.js.map +1 -0
- package/dist/adrs/sync.js +232 -0
- package/dist/adrs/sync.js.map +1 -0
- package/dist/adrs/types.js +9 -0
- package/dist/adrs/types.js.map +1 -0
- package/dist/adrs/validate.js +57 -0
- package/dist/adrs/validate.js.map +1 -0
- package/dist/agents/agent-registry.js +288 -0
- package/dist/agents/agent-registry.js.map +1 -0
- package/dist/agents/agent-schema.js +82 -0
- package/dist/agents/agent-schema.js.map +1 -0
- package/dist/agents/capacity.js +116 -0
- package/dist/agents/capacity.js.map +1 -0
- package/dist/agents/execution-learning.js +474 -0
- package/dist/agents/execution-learning.js.map +1 -0
- package/dist/agents/health-monitor.js +217 -0
- package/dist/agents/health-monitor.js.map +1 -0
- package/dist/agents/index.js +29 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/registry.js +314 -0
- package/dist/agents/registry.js.map +1 -0
- package/dist/agents/retry.js +215 -0
- package/dist/agents/retry.js.map +1 -0
- package/dist/audit-prune.js +94 -0
- package/dist/audit-prune.js.map +1 -0
- package/dist/audit.js +68 -0
- package/dist/audit.js.map +1 -0
- package/dist/backfill/index.js +229 -0
- package/dist/backfill/index.js.map +1 -0
- package/dist/bootstrap.js +435 -0
- package/dist/bootstrap.js.map +1 -0
- package/dist/caamp/adapter.js +259 -0
- package/dist/caamp/adapter.js.map +1 -0
- package/dist/caamp/capability-check.js +38 -0
- package/dist/caamp/capability-check.js.map +1 -0
- package/dist/caamp/index.js +21 -0
- package/dist/caamp/index.js.map +1 -0
- package/dist/caamp-init.js +16 -0
- package/dist/caamp-init.js.map +1 -0
- package/dist/cleo.js +322 -0
- package/dist/cleo.js.map +1 -0
- package/dist/code/index.js +14 -0
- package/dist/code/index.js.map +1 -0
- package/dist/code/outline.js +165 -0
- package/dist/code/outline.js.map +1 -0
- package/dist/code/parser.js +420 -0
- package/dist/code/parser.js.map +1 -0
- package/dist/code/search.js +135 -0
- package/dist/code/search.js.map +1 -0
- package/dist/code/unfold.js +155 -0
- package/dist/code/unfold.js.map +1 -0
- package/dist/codebase-map/analyzers/architecture.js +129 -0
- package/dist/codebase-map/analyzers/architecture.js.map +1 -0
- package/dist/codebase-map/analyzers/concerns.js +122 -0
- package/dist/codebase-map/analyzers/concerns.js.map +1 -0
- package/dist/codebase-map/analyzers/conventions.js +149 -0
- package/dist/codebase-map/analyzers/conventions.js.map +1 -0
- package/dist/codebase-map/analyzers/integrations.js +108 -0
- package/dist/codebase-map/analyzers/integrations.js.map +1 -0
- package/dist/codebase-map/analyzers/stack.js +117 -0
- package/dist/codebase-map/analyzers/stack.js.map +1 -0
- package/dist/codebase-map/analyzers/structure.js +137 -0
- package/dist/codebase-map/analyzers/structure.js.map +1 -0
- package/dist/codebase-map/analyzers/testing.js +118 -0
- package/dist/codebase-map/analyzers/testing.js.map +1 -0
- package/dist/codebase-map/index.js +57 -0
- package/dist/codebase-map/index.js.map +1 -0
- package/dist/codebase-map/store.js +122 -0
- package/dist/codebase-map/store.js.map +1 -0
- package/dist/codebase-map/summary.js +152 -0
- package/dist/codebase-map/summary.js.map +1 -0
- package/dist/compliance/index.js +288 -0
- package/dist/compliance/index.js.map +1 -0
- package/dist/compliance/protocol-enforcement.js +332 -0
- package/dist/compliance/protocol-enforcement.js.map +1 -0
- package/dist/compliance/protocol-rules.js +786 -0
- package/dist/compliance/protocol-rules.js.map +1 -0
- package/dist/compliance/protocol-types.js +79 -0
- package/dist/compliance/protocol-types.js.map +1 -0
- package/dist/compliance/store.js +53 -0
- package/dist/compliance/store.js.map +1 -0
- package/dist/conduit/conduit-client.js +107 -0
- package/dist/conduit/conduit-client.js.map +1 -0
- package/dist/conduit/factory.js +52 -0
- package/dist/conduit/factory.js.map +1 -0
- package/dist/conduit/http-transport.js +155 -0
- package/dist/conduit/http-transport.js.map +1 -0
- package/dist/conduit/index.js +15 -0
- package/dist/conduit/index.js.map +1 -0
- package/dist/conduit/local-transport.js +255 -0
- package/dist/conduit/local-transport.js.map +1 -0
- package/dist/conduit/sse-transport.js +299 -0
- package/dist/conduit/sse-transport.js.map +1 -0
- package/dist/config/build-config.js +29 -0
- package/dist/config/build-config.js.map +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +407 -0
- package/dist/config.js.map +1 -0
- package/dist/constants.js +18 -0
- package/dist/constants.js.map +1 -0
- package/dist/context/index.js +137 -0
- package/dist/context/index.js.map +1 -0
- package/dist/crypto/credentials.js +219 -0
- package/dist/crypto/credentials.js.map +1 -0
- package/dist/discovery.js +182 -0
- package/dist/discovery.js.map +1 -0
- package/dist/engine-result.js +12 -0
- package/dist/engine-result.js.map +1 -0
- package/dist/error-catalog.js +404 -0
- package/dist/error-catalog.js.map +1 -0
- package/dist/error-registry.js +393 -0
- package/dist/error-registry.js.map +1 -0
- package/dist/errors.js +173 -0
- package/dist/errors.js.map +1 -0
- package/dist/hooks/handlers/agent-hooks.js +106 -0
- package/dist/hooks/handlers/agent-hooks.js.map +1 -0
- package/dist/hooks/handlers/conduit-hooks.d.ts +72 -0
- package/dist/hooks/handlers/conduit-hooks.d.ts.map +1 -0
- package/dist/hooks/handlers/conduit-hooks.js +229 -0
- package/dist/hooks/handlers/conduit-hooks.js.map +1 -0
- package/dist/hooks/handlers/context-hooks.js +111 -0
- package/dist/hooks/handlers/context-hooks.js.map +1 -0
- package/dist/hooks/handlers/error-hooks.js +52 -0
- package/dist/hooks/handlers/error-hooks.js.map +1 -0
- package/dist/hooks/handlers/file-hooks.js +104 -0
- package/dist/hooks/handlers/file-hooks.js.map +1 -0
- package/dist/hooks/handlers/handler-helpers.js +61 -0
- package/dist/hooks/handlers/handler-helpers.js.map +1 -0
- package/dist/hooks/handlers/index.d.ts +6 -0
- package/dist/hooks/handlers/index.d.ts.map +1 -1
- package/dist/hooks/handlers/index.js +37 -0
- package/dist/hooks/handlers/index.js.map +1 -0
- package/dist/hooks/handlers/intelligence-hooks.d.ts +26 -0
- package/dist/hooks/handlers/intelligence-hooks.d.ts.map +1 -0
- package/dist/hooks/handlers/intelligence-hooks.js +69 -0
- package/dist/hooks/handlers/intelligence-hooks.js.map +1 -0
- package/dist/hooks/handlers/memory-bridge-refresh.js +42 -0
- package/dist/hooks/handlers/memory-bridge-refresh.js.map +1 -0
- package/dist/hooks/handlers/notification-hooks.js +62 -0
- package/dist/hooks/handlers/notification-hooks.js.map +1 -0
- package/dist/hooks/handlers/session-hooks.d.ts +30 -0
- package/dist/hooks/handlers/session-hooks.d.ts.map +1 -1
- package/dist/hooks/handlers/session-hooks.js +190 -0
- package/dist/hooks/handlers/session-hooks.js.map +1 -0
- package/dist/hooks/handlers/task-hooks.d.ts +2 -0
- package/dist/hooks/handlers/task-hooks.d.ts.map +1 -1
- package/dist/hooks/handlers/task-hooks.js +79 -0
- package/dist/hooks/handlers/task-hooks.js.map +1 -0
- package/dist/hooks/handlers/watchdog-hooks.d.ts +49 -0
- package/dist/hooks/handlers/watchdog-hooks.d.ts.map +1 -0
- package/dist/hooks/handlers/watchdog-hooks.js +162 -0
- package/dist/hooks/handlers/watchdog-hooks.js.map +1 -0
- package/dist/hooks/handlers/work-capture-hooks.js +165 -0
- package/dist/hooks/handlers/work-capture-hooks.js.map +1 -0
- package/dist/hooks/index.js +13 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/payload-schemas.js +220 -0
- package/dist/hooks/payload-schemas.js.map +1 -0
- package/dist/hooks/provider-hooks.js +66 -0
- package/dist/hooks/provider-hooks.js.map +1 -0
- package/dist/hooks/registry.js +229 -0
- package/dist/hooks/registry.js.map +1 -0
- package/dist/hooks/types.js +66 -0
- package/dist/hooks/types.js.map +1 -0
- package/dist/hooks.js +136 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.js +56736 -47002
- package/dist/index.js.map +4 -4
- package/dist/init.js +920 -0
- package/dist/init.js.map +1 -0
- package/dist/inject/index.js +82 -0
- package/dist/inject/index.js.map +1 -0
- package/dist/injection.d.ts +13 -1
- package/dist/injection.d.ts.map +1 -1
- package/dist/injection.js +377 -0
- package/dist/injection.js.map +1 -0
- package/dist/intelligence/adaptive-validation.js +497 -0
- package/dist/intelligence/adaptive-validation.js.map +1 -0
- package/dist/intelligence/impact.js +675 -0
- package/dist/intelligence/impact.js.map +1 -0
- package/dist/intelligence/index.js +22 -0
- package/dist/intelligence/index.js.map +1 -0
- package/dist/intelligence/patterns.js +492 -0
- package/dist/intelligence/patterns.js.map +1 -0
- package/dist/intelligence/prediction.js +499 -0
- package/dist/intelligence/prediction.js.map +1 -0
- package/dist/intelligence/types.js +13 -0
- package/dist/intelligence/types.js.map +1 -0
- package/dist/internal.d.ts +10 -3
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +321 -0
- package/dist/internal.js.map +1 -0
- package/dist/issue/create.js +121 -0
- package/dist/issue/create.js.map +1 -0
- package/dist/issue/diagnostics.js +59 -0
- package/dist/issue/diagnostics.js.map +1 -0
- package/dist/issue/index.js +10 -0
- package/dist/issue/index.js.map +1 -0
- package/dist/issue/template-parser.js +267 -0
- package/dist/issue/template-parser.js.map +1 -0
- package/dist/json-schema-validator.js +76 -0
- package/dist/json-schema-validator.js.map +1 -0
- package/dist/lib/index.js +11 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/retry.js +152 -0
- package/dist/lib/retry.js.map +1 -0
- package/dist/lib/tree-sitter-languages.js +75 -0
- package/dist/lib/tree-sitter-languages.js.map +1 -0
- package/dist/lifecycle/chain-composition.js +152 -0
- package/dist/lifecycle/chain-composition.js.map +1 -0
- package/dist/lifecycle/chain-store.js +246 -0
- package/dist/lifecycle/chain-store.js.map +1 -0
- package/dist/lifecycle/consolidate-rcasd.js +352 -0
- package/dist/lifecycle/consolidate-rcasd.js.map +1 -0
- package/dist/lifecycle/default-chain.js +176 -0
- package/dist/lifecycle/default-chain.js.map +1 -0
- package/dist/lifecycle/evidence.js +180 -0
- package/dist/lifecycle/evidence.js.map +1 -0
- package/dist/lifecycle/frontmatter.js +363 -0
- package/dist/lifecycle/frontmatter.js.map +1 -0
- package/dist/lifecycle/index.js +756 -0
- package/dist/lifecycle/index.js.map +1 -0
- package/dist/lifecycle/pipeline.js +656 -0
- package/dist/lifecycle/pipeline.js.map +1 -0
- package/dist/lifecycle/rcasd-index.js +326 -0
- package/dist/lifecycle/rcasd-index.js.map +1 -0
- package/dist/lifecycle/rcasd-paths.js +220 -0
- package/dist/lifecycle/rcasd-paths.js.map +1 -0
- package/dist/lifecycle/resume.js +864 -0
- package/dist/lifecycle/resume.js.map +1 -0
- package/dist/lifecycle/stage-artifacts.js +94 -0
- package/dist/lifecycle/stage-artifacts.js.map +1 -0
- package/dist/lifecycle/stage-guidance.js +234 -0
- package/dist/lifecycle/stage-guidance.js.map +1 -0
- package/dist/lifecycle/stages.js +534 -0
- package/dist/lifecycle/stages.js.map +1 -0
- package/dist/lifecycle/state-machine.js +516 -0
- package/dist/lifecycle/state-machine.js.map +1 -0
- package/dist/lifecycle/tessera-engine.js +249 -0
- package/dist/lifecycle/tessera-engine.js.map +1 -0
- package/dist/logger.js +140 -0
- package/dist/logger.js.map +1 -0
- package/dist/memory/anthropic-key-resolver.d.ts +35 -0
- package/dist/memory/anthropic-key-resolver.d.ts.map +1 -0
- package/dist/memory/anthropic-key-resolver.js +105 -0
- package/dist/memory/anthropic-key-resolver.js.map +1 -0
- package/dist/memory/auto-extract.d.ts +38 -42
- package/dist/memory/auto-extract.d.ts.map +1 -1
- package/dist/memory/auto-extract.js +77 -0
- package/dist/memory/auto-extract.js.map +1 -0
- package/dist/memory/brain-backfill.js +389 -0
- package/dist/memory/brain-backfill.js.map +1 -0
- package/dist/memory/brain-consolidator.d.ts +48 -0
- package/dist/memory/brain-consolidator.d.ts.map +1 -0
- package/dist/memory/brain-consolidator.js +294 -0
- package/dist/memory/brain-consolidator.js.map +1 -0
- package/dist/memory/brain-embedding.js +66 -0
- package/dist/memory/brain-embedding.js.map +1 -0
- package/dist/memory/brain-lifecycle.d.ts +83 -2
- package/dist/memory/brain-lifecycle.d.ts.map +1 -1
- package/dist/memory/brain-lifecycle.js +807 -0
- package/dist/memory/brain-lifecycle.js.map +1 -0
- package/dist/memory/brain-links.js +161 -0
- package/dist/memory/brain-links.js.map +1 -0
- package/dist/memory/brain-maintenance.js +114 -0
- package/dist/memory/brain-maintenance.js.map +1 -0
- package/dist/memory/brain-migration.js +149 -0
- package/dist/memory/brain-migration.js.map +1 -0
- package/dist/memory/brain-purge.js +243 -0
- package/dist/memory/brain-purge.js.map +1 -0
- package/dist/memory/brain-reasoning.js +215 -0
- package/dist/memory/brain-reasoning.js.map +1 -0
- package/dist/memory/brain-retrieval.d.ts +75 -1
- package/dist/memory/brain-retrieval.d.ts.map +1 -1
- package/dist/memory/brain-retrieval.js +1044 -0
- package/dist/memory/brain-retrieval.js.map +1 -0
- package/dist/memory/brain-row-types.js +10 -0
- package/dist/memory/brain-row-types.js.map +1 -0
- package/dist/memory/brain-search.d.ts +82 -15
- package/dist/memory/brain-search.d.ts.map +1 -1
- package/dist/memory/brain-search.js +613 -0
- package/dist/memory/brain-search.js.map +1 -0
- package/dist/memory/brain-similarity.js +145 -0
- package/dist/memory/brain-similarity.js.map +1 -0
- package/dist/memory/claude-mem-migration.js +277 -0
- package/dist/memory/claude-mem-migration.js.map +1 -0
- package/dist/memory/decisions.d.ts.map +1 -1
- package/dist/memory/decisions.js +218 -0
- package/dist/memory/decisions.js.map +1 -0
- package/dist/memory/embedding-local.js +102 -0
- package/dist/memory/embedding-local.js.map +1 -0
- package/dist/memory/embedding-queue.js +271 -0
- package/dist/memory/embedding-queue.js.map +1 -0
- package/dist/memory/embedding-worker.js +58 -0
- package/dist/memory/embedding-worker.js.map +1 -0
- package/dist/memory/engine-compat.d.ts +16 -1
- package/dist/memory/engine-compat.d.ts.map +1 -1
- package/dist/memory/engine-compat.js +1561 -0
- package/dist/memory/engine-compat.js.map +1 -0
- package/dist/memory/extraction-gate.d.ts +139 -0
- package/dist/memory/extraction-gate.d.ts.map +1 -0
- package/dist/memory/extraction-gate.js +459 -0
- package/dist/memory/extraction-gate.js.map +1 -0
- package/dist/memory/graph-auto-populate.js +148 -0
- package/dist/memory/graph-auto-populate.js.map +1 -0
- package/dist/memory/graph-queries.js +290 -0
- package/dist/memory/graph-queries.js.map +1 -0
- package/dist/memory/index.d.ts +2 -0
- package/dist/memory/index.d.ts.map +1 -1
- package/dist/memory/index.js +1144 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/learnings.d.ts +14 -0
- package/dist/memory/learnings.d.ts.map +1 -1
- package/dist/memory/learnings.js +179 -0
- package/dist/memory/learnings.js.map +1 -0
- package/dist/memory/llm-extraction.d.ts +107 -0
- package/dist/memory/llm-extraction.d.ts.map +1 -0
- package/dist/memory/llm-extraction.js +425 -0
- package/dist/memory/llm-extraction.js.map +1 -0
- package/dist/memory/memory-bridge.js +382 -0
- package/dist/memory/memory-bridge.js.map +1 -0
- package/dist/memory/mental-model-injection.js +61 -0
- package/dist/memory/mental-model-injection.js.map +1 -0
- package/dist/memory/mental-model-queue.js +211 -0
- package/dist/memory/mental-model-queue.js.map +1 -0
- package/dist/memory/observer-reflector.d.ts +157 -0
- package/dist/memory/observer-reflector.d.ts.map +1 -0
- package/dist/memory/observer-reflector.js +626 -0
- package/dist/memory/observer-reflector.js.map +1 -0
- package/dist/memory/patterns.d.ts +24 -4
- package/dist/memory/patterns.d.ts.map +1 -1
- package/dist/memory/patterns.js +174 -0
- package/dist/memory/patterns.js.map +1 -0
- package/dist/memory/pipeline-manifest-sqlite.js +975 -0
- package/dist/memory/pipeline-manifest-sqlite.js.map +1 -0
- package/dist/memory/quality-scoring.d.ts +42 -5
- package/dist/memory/quality-scoring.d.ts.map +1 -1
- package/dist/memory/quality-scoring.js +182 -0
- package/dist/memory/quality-scoring.js.map +1 -0
- package/dist/memory/session-memory.js +331 -0
- package/dist/memory/session-memory.js.map +1 -0
- package/dist/metrics/ab-test.js +260 -0
- package/dist/metrics/ab-test.js.map +1 -0
- package/dist/metrics/aggregation.js +363 -0
- package/dist/metrics/aggregation.js.map +1 -0
- package/dist/metrics/common.js +64 -0
- package/dist/metrics/common.js.map +1 -0
- package/dist/metrics/enums.js +78 -0
- package/dist/metrics/enums.js.map +1 -0
- package/dist/metrics/index.js +19 -0
- package/dist/metrics/index.js.map +1 -0
- package/dist/metrics/model-provider-registry.js +88 -0
- package/dist/metrics/model-provider-registry.js.map +1 -0
- package/dist/metrics/otel-integration.js +263 -0
- package/dist/metrics/otel-integration.js.map +1 -0
- package/dist/metrics/provider-detection.js +103 -0
- package/dist/metrics/provider-detection.js.map +1 -0
- package/dist/metrics/token-estimation.js +253 -0
- package/dist/metrics/token-estimation.js.map +1 -0
- package/dist/metrics/token-service.js +450 -0
- package/dist/metrics/token-service.js.map +1 -0
- package/dist/migration/agent-outputs.js +316 -0
- package/dist/migration/agent-outputs.js.map +1 -0
- package/dist/migration/checksum.js +92 -0
- package/dist/migration/checksum.js.map +1 -0
- package/dist/migration/index.js +282 -0
- package/dist/migration/index.js.map +1 -0
- package/dist/migration/logger.js +360 -0
- package/dist/migration/logger.js.map +1 -0
- package/dist/migration/preflight.js +9 -0
- package/dist/migration/preflight.js.map +1 -0
- package/dist/migration/state.js +421 -0
- package/dist/migration/state.js.map +1 -0
- package/dist/migration/validate.js +241 -0
- package/dist/migration/validate.js.map +1 -0
- package/dist/mvi-helpers.js +73 -0
- package/dist/mvi-helpers.js.map +1 -0
- package/dist/nexus/deps.js +375 -0
- package/dist/nexus/deps.js.map +1 -0
- package/dist/nexus/discover.js +288 -0
- package/dist/nexus/discover.js.map +1 -0
- package/dist/nexus/hash.js +10 -0
- package/dist/nexus/hash.js.map +1 -0
- package/dist/nexus/index.js +40 -0
- package/dist/nexus/index.js.map +1 -0
- package/dist/nexus/migrate-json-to-sqlite.js +115 -0
- package/dist/nexus/migrate-json-to-sqlite.js.map +1 -0
- package/dist/nexus/nexus-bridge.d.ts +51 -0
- package/dist/nexus/nexus-bridge.d.ts.map +1 -0
- package/dist/nexus/nexus-bridge.js +321 -0
- package/dist/nexus/nexus-bridge.js.map +1 -0
- package/dist/nexus/permissions.js +105 -0
- package/dist/nexus/permissions.js.map +1 -0
- package/dist/nexus/query.js +175 -0
- package/dist/nexus/query.js.map +1 -0
- package/dist/nexus/registry.js +584 -0
- package/dist/nexus/registry.js.map +1 -0
- package/dist/nexus/sharing/index.js +288 -0
- package/dist/nexus/sharing/index.js.map +1 -0
- package/dist/nexus/transfer-types.js +8 -0
- package/dist/nexus/transfer-types.js.map +1 -0
- package/dist/nexus/transfer.js +271 -0
- package/dist/nexus/transfer.js.map +1 -0
- package/dist/nexus/workspace.js +355 -0
- package/dist/nexus/workspace.js.map +1 -0
- package/dist/observability/index.js +103 -0
- package/dist/observability/index.js.map +1 -0
- package/dist/observability/log-filter.js +63 -0
- package/dist/observability/log-filter.js.map +1 -0
- package/dist/observability/log-parser.js +99 -0
- package/dist/observability/log-parser.js.map +1 -0
- package/dist/observability/log-reader.js +139 -0
- package/dist/observability/log-reader.js.map +1 -0
- package/dist/observability/types.js +19 -0
- package/dist/observability/types.js.map +1 -0
- package/dist/orchestration/analyze.js +107 -0
- package/dist/orchestration/analyze.js.map +1 -0
- package/dist/orchestration/bootstrap.js +132 -0
- package/dist/orchestration/bootstrap.js.map +1 -0
- package/dist/orchestration/context.js +56 -0
- package/dist/orchestration/context.js.map +1 -0
- package/dist/orchestration/critical-path.js +100 -0
- package/dist/orchestration/critical-path.js.map +1 -0
- package/dist/orchestration/hierarchy.js +183 -0
- package/dist/orchestration/hierarchy.js.map +1 -0
- package/dist/orchestration/index.js +287 -0
- package/dist/orchestration/index.js.map +1 -0
- package/dist/orchestration/parallel.js +89 -0
- package/dist/orchestration/parallel.js.map +1 -0
- package/dist/orchestration/protocol-validators.js +815 -0
- package/dist/orchestration/protocol-validators.js.map +1 -0
- package/dist/orchestration/skill-ops.js +98 -0
- package/dist/orchestration/skill-ops.js.map +1 -0
- package/dist/orchestration/status.js +107 -0
- package/dist/orchestration/status.js.map +1 -0
- package/dist/orchestration/unblock.js +103 -0
- package/dist/orchestration/unblock.js.map +1 -0
- package/dist/orchestration/validate-spawn.js +67 -0
- package/dist/orchestration/validate-spawn.js.map +1 -0
- package/dist/orchestration/waves.js +86 -0
- package/dist/orchestration/waves.js.map +1 -0
- package/dist/otel/index.js +163 -0
- package/dist/otel/index.js.map +1 -0
- package/dist/output.js +164 -0
- package/dist/output.js.map +1 -0
- package/dist/pagination.js +64 -0
- package/dist/pagination.js.map +1 -0
- package/dist/paths.js +882 -0
- package/dist/paths.js.map +1 -0
- package/dist/phases/deps.js +372 -0
- package/dist/phases/deps.js.map +1 -0
- package/dist/phases/index.js +349 -0
- package/dist/phases/index.js.map +1 -0
- package/dist/pipeline/index.js +10 -0
- package/dist/pipeline/index.js.map +1 -0
- package/dist/pipeline/phase.js +45 -0
- package/dist/pipeline/phase.js.map +1 -0
- package/dist/platform.js +211 -0
- package/dist/platform.js.map +1 -0
- package/dist/project-info.js +84 -0
- package/dist/project-info.js.map +1 -0
- package/dist/reconciliation/index.js +10 -0
- package/dist/reconciliation/index.js.map +1 -0
- package/dist/reconciliation/link-store.js +175 -0
- package/dist/reconciliation/link-store.js.map +1 -0
- package/dist/reconciliation/reconciliation-engine.js +298 -0
- package/dist/reconciliation/reconciliation-engine.js.map +1 -0
- package/dist/release/artifacts.js +427 -0
- package/dist/release/artifacts.js.map +1 -0
- package/dist/release/changelog-writer.js +151 -0
- package/dist/release/changelog-writer.js.map +1 -0
- package/dist/release/channel.js +144 -0
- package/dist/release/channel.js.map +1 -0
- package/dist/release/ci.js +166 -0
- package/dist/release/ci.js.map +1 -0
- package/dist/release/github-pr.js +225 -0
- package/dist/release/github-pr.js.map +1 -0
- package/dist/release/guards.js +116 -0
- package/dist/release/guards.js.map +1 -0
- package/dist/release/index.js +22 -0
- package/dist/release/index.js.map +1 -0
- package/dist/release/release-config.js +158 -0
- package/dist/release/release-config.js.map +1 -0
- package/dist/release/release-manifest.js +1019 -0
- package/dist/release/release-manifest.js.map +1 -0
- package/dist/release/version-bump.js +255 -0
- package/dist/release/version-bump.js.map +1 -0
- package/dist/remote/index.js +257 -0
- package/dist/remote/index.js.map +1 -0
- package/dist/repair.js +130 -0
- package/dist/repair.js.map +1 -0
- package/dist/research/index.js +2 -0
- package/dist/research/index.js.map +1 -0
- package/dist/roadmap/index.js +59 -0
- package/dist/roadmap/index.js.map +1 -0
- package/dist/routing/capability-matrix.js +1556 -0
- package/dist/routing/capability-matrix.js.map +1 -0
- package/dist/routing/index.js +9 -0
- package/dist/routing/index.js.map +1 -0
- package/dist/scaffold.d.ts +18 -0
- package/dist/scaffold.d.ts.map +1 -1
- package/dist/scaffold.js +1798 -0
- package/dist/scaffold.js.map +1 -0
- package/dist/schema-management.js +295 -0
- package/dist/schema-management.js.map +1 -0
- package/dist/security/index.js +9 -0
- package/dist/security/index.js.map +1 -0
- package/dist/security/input-sanitization.js +326 -0
- package/dist/security/input-sanitization.js.map +1 -0
- package/dist/sequence/index.js +295 -0
- package/dist/sequence/index.js.map +1 -0
- package/dist/sessions/assumptions.js +54 -0
- package/dist/sessions/assumptions.js.map +1 -0
- package/dist/sessions/briefing.js +377 -0
- package/dist/sessions/briefing.js.map +1 -0
- package/dist/sessions/context-alert.js +222 -0
- package/dist/sessions/context-alert.js.map +1 -0
- package/dist/sessions/context-inject.js +61 -0
- package/dist/sessions/context-inject.js.map +1 -0
- package/dist/sessions/context-monitor.js +98 -0
- package/dist/sessions/context-monitor.js.map +1 -0
- package/dist/sessions/decisions.js +65 -0
- package/dist/sessions/decisions.js.map +1 -0
- package/dist/sessions/find.js +65 -0
- package/dist/sessions/find.js.map +1 -0
- package/dist/sessions/handoff.js +328 -0
- package/dist/sessions/handoff.js.map +1 -0
- package/dist/sessions/hitl-warnings.js +254 -0
- package/dist/sessions/hitl-warnings.js.map +1 -0
- package/dist/sessions/index.js +327 -0
- package/dist/sessions/index.js.map +1 -0
- package/dist/sessions/session-archive.js +40 -0
- package/dist/sessions/session-archive.js.map +1 -0
- package/dist/sessions/session-cleanup.js +59 -0
- package/dist/sessions/session-cleanup.js.map +1 -0
- package/dist/sessions/session-drift.js +134 -0
- package/dist/sessions/session-drift.js.map +1 -0
- package/dist/sessions/session-enforcement.js +144 -0
- package/dist/sessions/session-enforcement.js.map +1 -0
- package/dist/sessions/session-grade.js +253 -0
- package/dist/sessions/session-grade.js.map +1 -0
- package/dist/sessions/session-history.js +42 -0
- package/dist/sessions/session-history.js.map +1 -0
- package/dist/sessions/session-id.js +81 -0
- package/dist/sessions/session-id.js.map +1 -0
- package/dist/sessions/session-memory-bridge.js +30 -0
- package/dist/sessions/session-memory-bridge.js.map +1 -0
- package/dist/sessions/session-show.js +24 -0
- package/dist/sessions/session-show.js.map +1 -0
- package/dist/sessions/session-stats.js +69 -0
- package/dist/sessions/session-stats.js.map +1 -0
- package/dist/sessions/session-suspend.js +39 -0
- package/dist/sessions/session-suspend.js.map +1 -0
- package/dist/sessions/session-switch.js +51 -0
- package/dist/sessions/session-switch.js.map +1 -0
- package/dist/sessions/session-view.js +76 -0
- package/dist/sessions/session-view.js.map +1 -0
- package/dist/sessions/snapshot.js +213 -0
- package/dist/sessions/snapshot.js.map +1 -0
- package/dist/sessions/statusline-setup.js +85 -0
- package/dist/sessions/statusline-setup.js.map +1 -0
- package/dist/sessions/types.js +8 -0
- package/dist/sessions/types.js.map +1 -0
- package/dist/skills/agents/config.js +94 -0
- package/dist/skills/agents/config.js.map +1 -0
- package/dist/skills/agents/install.js +116 -0
- package/dist/skills/agents/install.js.map +1 -0
- package/dist/skills/agents/registry.js +161 -0
- package/dist/skills/agents/registry.js.map +1 -0
- package/dist/skills/discovery.js +333 -0
- package/dist/skills/discovery.js.map +1 -0
- package/dist/skills/dispatch.js +347 -0
- package/dist/skills/dispatch.js.map +1 -0
- package/dist/skills/dynamic-skill-generator.js +87 -0
- package/dist/skills/dynamic-skill-generator.js.map +1 -0
- package/dist/skills/index.js +44 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/skills/injection/subagent.js +195 -0
- package/dist/skills/injection/subagent.js.map +1 -0
- package/dist/skills/injection/token.js +260 -0
- package/dist/skills/injection/token.js.map +1 -0
- package/dist/skills/install.js +40 -0
- package/dist/skills/install.js.map +1 -0
- package/dist/skills/manifests/contribution.js +175 -0
- package/dist/skills/manifests/contribution.js.map +1 -0
- package/dist/skills/manifests/research.js +281 -0
- package/dist/skills/manifests/research.js.map +1 -0
- package/dist/skills/manifests/resolver.js +146 -0
- package/dist/skills/manifests/resolver.js.map +1 -0
- package/dist/skills/marketplace.js +90 -0
- package/dist/skills/marketplace.js.map +1 -0
- package/dist/skills/orchestrator/spawn.js +178 -0
- package/dist/skills/orchestrator/spawn.js.map +1 -0
- package/dist/skills/orchestrator/startup.js +451 -0
- package/dist/skills/orchestrator/startup.js.map +1 -0
- package/dist/skills/orchestrator/validator.js +301 -0
- package/dist/skills/orchestrator/validator.js.map +1 -0
- package/dist/skills/precedence-integration.js +73 -0
- package/dist/skills/precedence-integration.js.map +1 -0
- package/dist/skills/precedence-types.js +16 -0
- package/dist/skills/precedence-types.js.map +1 -0
- package/dist/skills/routing-table.js +63 -0
- package/dist/skills/routing-table.js.map +1 -0
- package/dist/skills/skill-paths.js +217 -0
- package/dist/skills/skill-paths.js.map +1 -0
- package/dist/skills/test-utility.js +55 -0
- package/dist/skills/test-utility.js.map +1 -0
- package/dist/skills/types.js +118 -0
- package/dist/skills/types.js.map +1 -0
- package/dist/skills/validation.js +183 -0
- package/dist/skills/validation.js.map +1 -0
- package/dist/skills/version.js +57 -0
- package/dist/skills/version.js.map +1 -0
- package/dist/snapshot/index.js +188 -0
- package/dist/snapshot/index.js.map +1 -0
- package/dist/spawn/adapter-registry.js +246 -0
- package/dist/spawn/adapter-registry.js.map +1 -0
- package/dist/spawn/index.js +10 -0
- package/dist/spawn/index.js.map +1 -0
- package/dist/stats/index.d.ts.map +1 -1
- package/dist/stats/index.js +350 -0
- package/dist/stats/index.js.map +1 -0
- package/dist/stats/workflow-telemetry.js +400 -0
- package/dist/stats/workflow-telemetry.js.map +1 -0
- package/dist/sticky/archive.js +47 -0
- package/dist/sticky/archive.js.map +1 -0
- package/dist/sticky/convert.js +235 -0
- package/dist/sticky/convert.js.map +1 -0
- package/dist/sticky/create.js +48 -0
- package/dist/sticky/create.js.map +1 -0
- package/dist/sticky/id.js +35 -0
- package/dist/sticky/id.js.map +1 -0
- package/dist/sticky/index.js +16 -0
- package/dist/sticky/index.js.map +1 -0
- package/dist/sticky/list.js +57 -0
- package/dist/sticky/list.js.map +1 -0
- package/dist/sticky/purge.js +45 -0
- package/dist/sticky/purge.js.map +1 -0
- package/dist/sticky/show.js +42 -0
- package/dist/sticky/show.js.map +1 -0
- package/dist/sticky/types.js +10 -0
- package/dist/sticky/types.js.map +1 -0
- package/dist/store/agent-registry-accessor.js +886 -0
- package/dist/store/agent-registry-accessor.js.map +1 -0
- package/dist/store/api-key-kdf.js +84 -0
- package/dist/store/api-key-kdf.js.map +1 -0
- package/dist/store/atomic.js +167 -0
- package/dist/store/atomic.js.map +1 -0
- package/dist/store/backup-crypto.js +184 -0
- package/dist/store/backup-crypto.js.map +1 -0
- package/dist/store/backup-pack.js +581 -0
- package/dist/store/backup-pack.js.map +1 -0
- package/dist/store/backup-unpack.js +449 -0
- package/dist/store/backup-unpack.js.map +1 -0
- package/dist/store/backup.js +94 -0
- package/dist/store/backup.js.map +1 -0
- package/dist/store/brain-accessor.js +429 -0
- package/dist/store/brain-accessor.js.map +1 -0
- package/dist/store/brain-schema.d.ts +663 -39
- package/dist/store/brain-schema.d.ts.map +1 -1
- package/dist/store/brain-schema.js +579 -0
- package/dist/store/brain-schema.js.map +1 -0
- package/dist/store/brain-sqlite.d.ts.map +1 -1
- package/dist/store/brain-sqlite.js +297 -0
- package/dist/store/brain-sqlite.js.map +1 -0
- package/dist/store/cache.js +168 -0
- package/dist/store/cache.js.map +1 -0
- package/dist/store/chain-schema.js +51 -0
- package/dist/store/chain-schema.js.map +1 -0
- package/dist/store/cleanup-legacy.js +171 -0
- package/dist/store/cleanup-legacy.js.map +1 -0
- package/dist/store/conduit-sqlite.js +570 -0
- package/dist/store/conduit-sqlite.js.map +1 -0
- package/dist/store/converters.js +124 -0
- package/dist/store/converters.js.map +1 -0
- package/dist/store/cross-db-cleanup.js +319 -0
- package/dist/store/cross-db-cleanup.js.map +1 -0
- package/dist/store/data-accessor.js +26 -0
- package/dist/store/data-accessor.js.map +1 -0
- package/dist/store/data-safety-central.js +269 -0
- package/dist/store/data-safety-central.js.map +1 -0
- package/dist/store/data-safety.js +274 -0
- package/dist/store/data-safety.js.map +1 -0
- package/dist/store/db-helpers.js +224 -0
- package/dist/store/db-helpers.js.map +1 -0
- package/dist/store/export.js +155 -0
- package/dist/store/export.js.map +1 -0
- package/dist/store/file-utils.js +270 -0
- package/dist/store/file-utils.js.map +1 -0
- package/dist/store/git-checkpoint.js +365 -0
- package/dist/store/git-checkpoint.js.map +1 -0
- package/dist/store/global-salt.js +147 -0
- package/dist/store/global-salt.js.map +1 -0
- package/dist/store/import-logging.js +139 -0
- package/dist/store/import-logging.js.map +1 -0
- package/dist/store/import-remap.js +145 -0
- package/dist/store/import-remap.js.map +1 -0
- package/dist/store/import-sort.js +121 -0
- package/dist/store/import-sort.js.map +1 -0
- package/dist/store/index.js +29 -0
- package/dist/store/index.js.map +1 -0
- package/dist/store/json.js +208 -0
- package/dist/store/json.js.map +1 -0
- package/dist/store/lifecycle-store.js +249 -0
- package/dist/store/lifecycle-store.js.map +1 -0
- package/dist/store/lock.js +70 -0
- package/dist/store/lock.js.map +1 -0
- package/dist/store/migrate-signaldock-to-conduit.js +562 -0
- package/dist/store/migrate-signaldock-to-conduit.js.map +1 -0
- package/dist/store/migration-manager.d.ts +5 -1
- package/dist/store/migration-manager.d.ts.map +1 -1
- package/dist/store/migration-manager.js +288 -0
- package/dist/store/migration-manager.js.map +1 -0
- package/dist/store/migration-sqlite.js +676 -0
- package/dist/store/migration-sqlite.js.map +1 -0
- package/dist/store/nexus-schema.js +268 -0
- package/dist/store/nexus-schema.js.map +1 -0
- package/dist/store/nexus-sqlite.js +242 -0
- package/dist/store/nexus-sqlite.js.map +1 -0
- package/dist/store/nexus-validation-schemas.js +40 -0
- package/dist/store/nexus-validation-schemas.js.map +1 -0
- package/dist/store/parsers.js +37 -0
- package/dist/store/parsers.js.map +1 -0
- package/dist/store/project-detect.js +457 -0
- package/dist/store/project-detect.js.map +1 -0
- package/dist/store/provider.js +101 -0
- package/dist/store/provider.js.map +1 -0
- package/dist/store/regenerators.js +207 -0
- package/dist/store/regenerators.js.map +1 -0
- package/dist/store/restore-conflict-report.js +206 -0
- package/dist/store/restore-conflict-report.js.map +1 -0
- package/dist/store/restore-json-merge.js +454 -0
- package/dist/store/restore-json-merge.js.map +1 -0
- package/dist/store/safety-data-accessor.js +257 -0
- package/dist/store/safety-data-accessor.js.map +1 -0
- package/dist/store/schema.js +7 -0
- package/dist/store/schema.js.map +1 -0
- package/dist/store/session-store.js +219 -0
- package/dist/store/session-store.js.map +1 -0
- package/dist/store/signaldock-sqlite.js +550 -0
- package/dist/store/signaldock-sqlite.js.map +1 -0
- package/dist/store/sqlite-backup.js +498 -0
- package/dist/store/sqlite-backup.js.map +1 -0
- package/dist/store/sqlite-data-accessor.js +787 -0
- package/dist/store/sqlite-data-accessor.js.map +1 -0
- package/dist/store/sqlite.js +483 -0
- package/dist/store/sqlite.js.map +1 -0
- package/dist/store/status-registry.js +8 -0
- package/dist/store/status-registry.js.map +1 -0
- package/dist/store/t310-readiness.js +115 -0
- package/dist/store/t310-readiness.js.map +1 -0
- package/dist/store/task-store.js +358 -0
- package/dist/store/task-store.js.map +1 -0
- package/dist/store/tasks-schema.d.ts +1 -1
- package/dist/store/tasks-schema.js +610 -0
- package/dist/store/tasks-schema.js.map +1 -0
- package/dist/store/typed-query.js +15 -0
- package/dist/store/typed-query.js.map +1 -0
- package/dist/store/validation-schemas.d.ts +6 -6
- package/dist/store/validation-schemas.js +278 -0
- package/dist/store/validation-schemas.js.map +1 -0
- package/dist/system/archive-analytics.js +277 -0
- package/dist/system/archive-analytics.js.map +1 -0
- package/dist/system/archive-stats.js +64 -0
- package/dist/system/archive-stats.js.map +1 -0
- package/dist/system/audit.js +145 -0
- package/dist/system/audit.js.map +1 -0
- package/dist/system/backup.js +280 -0
- package/dist/system/backup.js.map +1 -0
- package/dist/system/cleanup.js +134 -0
- package/dist/system/cleanup.js.map +1 -0
- package/dist/system/dependencies.js +466 -0
- package/dist/system/dependencies.js.map +1 -0
- package/dist/system/health.d.ts.map +1 -1
- package/dist/system/health.js +1206 -0
- package/dist/system/health.js.map +1 -0
- package/dist/system/index.js +18 -0
- package/dist/system/index.js.map +1 -0
- package/dist/system/inject-generate.js +122 -0
- package/dist/system/inject-generate.js.map +1 -0
- package/dist/system/labels.js +38 -0
- package/dist/system/labels.js.map +1 -0
- package/dist/system/metrics.js +61 -0
- package/dist/system/metrics.js.map +1 -0
- package/dist/system/migrate.js +43 -0
- package/dist/system/migrate.js.map +1 -0
- package/dist/system/platform-paths.js +80 -0
- package/dist/system/platform-paths.js.map +1 -0
- package/dist/system/runtime.js +161 -0
- package/dist/system/runtime.js.map +1 -0
- package/dist/system/safestop.js +89 -0
- package/dist/system/safestop.js.map +1 -0
- package/dist/system/storage-preflight.js +123 -0
- package/dist/system/storage-preflight.js.map +1 -0
- package/dist/task-work/index.js +159 -0
- package/dist/task-work/index.js.map +1 -0
- package/dist/tasks/add.js +837 -0
- package/dist/tasks/add.js.map +1 -0
- package/dist/tasks/analyze.js +85 -0
- package/dist/tasks/analyze.js.map +1 -0
- package/dist/tasks/archive.js +90 -0
- package/dist/tasks/archive.js.map +1 -0
- package/dist/tasks/atomicity.js +83 -0
- package/dist/tasks/atomicity.js.map +1 -0
- package/dist/tasks/cancel-ops.js +83 -0
- package/dist/tasks/cancel-ops.js.map +1 -0
- package/dist/tasks/complete.d.ts.map +1 -1
- package/dist/tasks/complete.js +228 -0
- package/dist/tasks/complete.js.map +1 -0
- package/dist/tasks/crossref-extract.js +73 -0
- package/dist/tasks/crossref-extract.js.map +1 -0
- package/dist/tasks/delete-preview.js +192 -0
- package/dist/tasks/delete-preview.js.map +1 -0
- package/dist/tasks/delete.js +120 -0
- package/dist/tasks/delete.js.map +1 -0
- package/dist/tasks/deletion-strategy.js +200 -0
- package/dist/tasks/deletion-strategy.js.map +1 -0
- package/dist/tasks/dependency-check.js +278 -0
- package/dist/tasks/dependency-check.js.map +1 -0
- package/dist/tasks/deps-ready.js +32 -0
- package/dist/tasks/deps-ready.js.map +1 -0
- package/dist/tasks/enforcement.js +86 -0
- package/dist/tasks/enforcement.js.map +1 -0
- package/dist/tasks/epic-enforcement.js +294 -0
- package/dist/tasks/epic-enforcement.js.map +1 -0
- package/dist/tasks/find.js +163 -0
- package/dist/tasks/find.js.map +1 -0
- package/dist/tasks/graph-cache.js +127 -0
- package/dist/tasks/graph-cache.js.map +1 -0
- package/dist/tasks/graph-ops.d.ts.map +1 -1
- package/dist/tasks/graph-ops.js +173 -0
- package/dist/tasks/graph-ops.js.map +1 -0
- package/dist/tasks/graph-rag.js +328 -0
- package/dist/tasks/graph-rag.js.map +1 -0
- package/dist/tasks/hierarchy-policy.js +149 -0
- package/dist/tasks/hierarchy-policy.js.map +1 -0
- package/dist/tasks/hierarchy.js +185 -0
- package/dist/tasks/hierarchy.js.map +1 -0
- package/dist/tasks/id-generator.js +65 -0
- package/dist/tasks/id-generator.js.map +1 -0
- package/dist/tasks/index.js +14 -0
- package/dist/tasks/index.js.map +1 -0
- package/dist/tasks/labels.js +55 -0
- package/dist/tasks/labels.js.map +1 -0
- package/dist/tasks/list.js +75 -0
- package/dist/tasks/list.js.map +1 -0
- package/dist/tasks/phase-tracking.js +133 -0
- package/dist/tasks/phase-tracking.js.map +1 -0
- package/dist/tasks/pipeline-stage.js +248 -0
- package/dist/tasks/pipeline-stage.js.map +1 -0
- package/dist/tasks/plan.js +268 -0
- package/dist/tasks/plan.js.map +1 -0
- package/dist/tasks/relates.js +101 -0
- package/dist/tasks/relates.js.map +1 -0
- package/dist/tasks/show.js +83 -0
- package/dist/tasks/show.js.map +1 -0
- package/dist/tasks/size-weighting.js +86 -0
- package/dist/tasks/size-weighting.js.map +1 -0
- package/dist/tasks/staleness.js +86 -0
- package/dist/tasks/staleness.js.map +1 -0
- package/dist/tasks/task-ops.js +1741 -0
- package/dist/tasks/task-ops.js.map +1 -0
- package/dist/tasks/update.js +303 -0
- package/dist/tasks/update.js.map +1 -0
- package/dist/templates/index.js +10 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/templates/parser.js +254 -0
- package/dist/templates/parser.js.map +1 -0
- package/dist/ui/aliases.js +153 -0
- package/dist/ui/aliases.js.map +1 -0
- package/dist/ui/changelog.js +184 -0
- package/dist/ui/changelog.js.map +1 -0
- package/dist/ui/command-registry.js +168 -0
- package/dist/ui/command-registry.js.map +1 -0
- package/dist/ui/flags.js +94 -0
- package/dist/ui/flags.js.map +1 -0
- package/dist/ui/index.js +24 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/upgrade.js +1148 -0
- package/dist/upgrade.js.map +1 -0
- package/dist/validation/chain-validation.js +146 -0
- package/dist/validation/chain-validation.js.map +1 -0
- package/dist/validation/compliance.js +155 -0
- package/dist/validation/compliance.js.map +1 -0
- package/dist/validation/docs-sync.js +212 -0
- package/dist/validation/docs-sync.js.map +1 -0
- package/dist/validation/doctor/checks.js +1069 -0
- package/dist/validation/doctor/checks.js.map +1 -0
- package/dist/validation/doctor/index.js +9 -0
- package/dist/validation/doctor/index.js.map +1 -0
- package/dist/validation/doctor/project-cache.js +160 -0
- package/dist/validation/doctor/project-cache.js.map +1 -0
- package/dist/validation/doctor/utils.js +155 -0
- package/dist/validation/doctor/utils.js.map +1 -0
- package/dist/validation/engine.js +914 -0
- package/dist/validation/engine.js.map +1 -0
- package/dist/validation/gap-check.js +175 -0
- package/dist/validation/gap-check.js.map +1 -0
- package/dist/validation/index.js +40 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/validation/manifest.js +237 -0
- package/dist/validation/manifest.js.map +1 -0
- package/dist/validation/operation-gate-validators.js +724 -0
- package/dist/validation/operation-gate-validators.js.map +1 -0
- package/dist/validation/operation-verification-gates.js +532 -0
- package/dist/validation/operation-verification-gates.js.map +1 -0
- package/dist/validation/param-utils.js +141 -0
- package/dist/validation/param-utils.js.map +1 -0
- package/dist/validation/protocol-common.js +300 -0
- package/dist/validation/protocol-common.js.map +1 -0
- package/dist/validation/protocols/_shared.js +82 -0
- package/dist/validation/protocols/_shared.js.map +1 -0
- package/dist/validation/protocols/architecture-decision.js +31 -0
- package/dist/validation/protocols/architecture-decision.js.map +1 -0
- package/dist/validation/protocols/artifact-publish.js +28 -0
- package/dist/validation/protocols/artifact-publish.js.map +1 -0
- package/dist/validation/protocols/consensus.js +41 -0
- package/dist/validation/protocols/consensus.js.map +1 -0
- package/dist/validation/protocols/contribution.js +27 -0
- package/dist/validation/protocols/contribution.js.map +1 -0
- package/dist/validation/protocols/decomposition.js +28 -0
- package/dist/validation/protocols/decomposition.js.map +1 -0
- package/dist/validation/protocols/implementation.js +24 -0
- package/dist/validation/protocols/implementation.js.map +1 -0
- package/dist/validation/protocols/provenance.js +29 -0
- package/dist/validation/protocols/provenance.js.map +1 -0
- package/dist/validation/protocols/release.js +29 -0
- package/dist/validation/protocols/release.js.map +1 -0
- package/dist/validation/protocols/research.js +24 -0
- package/dist/validation/protocols/research.js.map +1 -0
- package/dist/validation/protocols/specification.js +27 -0
- package/dist/validation/protocols/specification.js.map +1 -0
- package/dist/validation/protocols/testing.js +30 -0
- package/dist/validation/protocols/testing.js.map +1 -0
- package/dist/validation/protocols/validation.js +30 -0
- package/dist/validation/protocols/validation.js.map +1 -0
- package/dist/validation/schema-integrity.js +170 -0
- package/dist/validation/schema-integrity.js.map +1 -0
- package/dist/validation/schema-validator.js +176 -0
- package/dist/validation/schema-validator.js.map +1 -0
- package/dist/validation/validate-ops.js +937 -0
- package/dist/validation/validate-ops.js.map +1 -0
- package/dist/validation/validation-rules.js +226 -0
- package/dist/validation/validation-rules.js.map +1 -0
- package/dist/validation/verification.js +321 -0
- package/dist/validation/verification.js.map +1 -0
- package/migrations/drizzle-brain/20260411000001_t528-graph-schema-expansion/migration.sql +47 -0
- package/migrations/drizzle-brain/20260412000001_t531-quality-score-typed-tables/migration.sql +23 -0
- package/migrations/drizzle-brain/20260413000001_t549-tiered-typed-memory/migration.sql +195 -0
- package/migrations/drizzle-nexus/20260412000001_t529-nexus-graph-tables/migration.sql +49 -0
- package/package.json +13 -12
- package/src/config.ts +7 -0
- package/src/hooks/handlers/__tests__/conduit-hooks.test.ts +356 -0
- package/src/hooks/handlers/conduit-hooks.ts +258 -0
- package/src/hooks/handlers/index.ts +13 -0
- package/src/hooks/handlers/intelligence-hooks.ts +80 -0
- package/src/hooks/handlers/session-hooks.ts +78 -0
- package/src/hooks/handlers/task-hooks.ts +14 -0
- package/src/hooks/handlers/watchdog-hooks.ts +187 -0
- package/src/injection.ts +41 -2
- package/src/internal.ts +39 -2
- package/src/memory/__tests__/auto-extract.test.ts +43 -114
- package/src/memory/__tests__/brain-automation.test.ts +16 -39
- package/src/memory/__tests__/brain-rrf.test.ts +431 -0
- package/src/memory/__tests__/llm-extraction.test.ts +342 -0
- package/src/memory/__tests__/observer-reflector.test.ts +475 -0
- package/src/memory/anthropic-key-resolver.ts +113 -0
- package/src/memory/auto-extract.ts +40 -72
- package/src/memory/brain-consolidator.ts +344 -0
- package/src/memory/brain-lifecycle.ts +636 -2
- package/src/memory/brain-retrieval.ts +630 -18
- package/src/memory/brain-search.ts +234 -132
- package/src/memory/decisions.ts +21 -1
- package/src/memory/engine-compat.ts +25 -15
- package/src/memory/extraction-gate.ts +574 -0
- package/src/memory/index.ts +6 -2
- package/src/memory/learnings.ts +34 -1
- package/src/memory/llm-extraction.ts +524 -0
- package/src/memory/memory-bridge.ts +29 -12
- package/src/memory/observer-reflector.ts +829 -0
- package/src/memory/patterns.ts +30 -1
- package/src/memory/quality-scoring.ts +93 -9
- package/src/nexus/nexus-bridge.ts +444 -0
- package/src/scaffold.ts +42 -0
- package/src/stats/index.ts +11 -3
- package/src/store/brain-schema.ts +282 -0
- package/src/store/brain-sqlite.ts +55 -0
- package/src/store/migration-manager.ts +83 -12
- package/src/system/health.ts +17 -0
- package/src/tasks/complete.ts +7 -10
- package/src/tasks/graph-ops.ts +1 -0
- package/src/tasks/task-ops.ts +1 -1
- package/templates/CLEO-INJECTION.md +15 -0
|
@@ -0,0 +1,574 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extraction Gate — Verification layer before BRAIN memory storage.
|
|
3
|
+
*
|
|
4
|
+
* Wraps all memory writes with three ordered checks:
|
|
5
|
+
* A. Content-hash deduplication (always runs — fast, no embedding needed)
|
|
6
|
+
* B. Cosine similarity deduplication (runs when embedding is available; skipped for trusted sources)
|
|
7
|
+
* C. Confidence threshold enforcement (always runs)
|
|
8
|
+
*
|
|
9
|
+
* Trusted sources (manual, owner) bypass Check B but still run A and C.
|
|
10
|
+
*
|
|
11
|
+
* Design goals:
|
|
12
|
+
* - NEVER block the primary write path on error — all checks wrapped in try/catch
|
|
13
|
+
* - Degrade gracefully to hash-only dedup when embedding is unavailable
|
|
14
|
+
* - Contradiction detection uses a polarity-flip heuristic (no LLM required)
|
|
15
|
+
*
|
|
16
|
+
* @task T549 Wave 2-A
|
|
17
|
+
* @epic T549
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { createHash } from 'node:crypto';
|
|
21
|
+
import type {
|
|
22
|
+
BrainCognitiveType,
|
|
23
|
+
BrainMemoryTier,
|
|
24
|
+
BrainSourceConfidence,
|
|
25
|
+
} from '../store/brain-schema.js';
|
|
26
|
+
import { isEmbeddingAvailable } from './brain-embedding.js';
|
|
27
|
+
import { searchSimilar } from './brain-similarity.js';
|
|
28
|
+
import { addGraphEdge } from './graph-auto-populate.js';
|
|
29
|
+
|
|
30
|
+
// ============================================================================
|
|
31
|
+
// Types
|
|
32
|
+
// ============================================================================
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* A candidate memory entry produced by the extraction engine or supplied
|
|
36
|
+
* directly by a trusted agent/owner.
|
|
37
|
+
*/
|
|
38
|
+
export interface MemoryCandidate {
|
|
39
|
+
/** The main text content to store. */
|
|
40
|
+
text: string;
|
|
41
|
+
/** Human-readable label for the entry. Defaults to first 120 chars of text. */
|
|
42
|
+
title?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Cognitive type — determines which BRAIN table receives this entry.
|
|
45
|
+
* Uses BRAIN_COGNITIVE_TYPES vocabulary (semantic/episodic/procedural).
|
|
46
|
+
*/
|
|
47
|
+
memoryType: BrainCognitiveType;
|
|
48
|
+
/** Storage tier — determines eviction policy. */
|
|
49
|
+
tier: BrainMemoryTier;
|
|
50
|
+
/**
|
|
51
|
+
* Confidence 0.0–1.0.
|
|
52
|
+
* Below MINIMUM_CONFIDENCE (0.40) sends entry to pending queue.
|
|
53
|
+
*/
|
|
54
|
+
confidence: number;
|
|
55
|
+
/** Source pipeline that produced this candidate. */
|
|
56
|
+
source: 'transcript' | 'task-completion' | 'diff' | 'manual' | 'debrief';
|
|
57
|
+
/** Session ID of the originating session (for graph linking). */
|
|
58
|
+
sourceSessionId?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Source reliability level for the memory entry.
|
|
61
|
+
* Manual/owner sources skip similarity check (trusted bypass).
|
|
62
|
+
*/
|
|
63
|
+
sourceConfidence?: BrainSourceConfidence;
|
|
64
|
+
/**
|
|
65
|
+
* When true, skip Checks A-B (similarity/contradiction) — only Check C applies.
|
|
66
|
+
* Automatically set for 'manual' source and 'owner'/'task-outcome' sourceConfidence.
|
|
67
|
+
*/
|
|
68
|
+
trusted?: boolean;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Result of passing a candidate through the verification gate. */
|
|
72
|
+
export interface GateResult {
|
|
73
|
+
/** What the gate decided. */
|
|
74
|
+
action: 'stored' | 'merged' | 'pending' | 'rejected';
|
|
75
|
+
/**
|
|
76
|
+
* ID of the stored or merged entry.
|
|
77
|
+
* Null when action is 'pending' or 'rejected'.
|
|
78
|
+
*/
|
|
79
|
+
id: string | null;
|
|
80
|
+
/** Human-readable explanation of the decision. */
|
|
81
|
+
reason: string;
|
|
82
|
+
/** Cosine distance to the nearest match (when similarity check ran). */
|
|
83
|
+
similarity?: number;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// ============================================================================
|
|
87
|
+
// Constants
|
|
88
|
+
// ============================================================================
|
|
89
|
+
|
|
90
|
+
/** Cosine distance below which two entries are considered exact duplicates. */
|
|
91
|
+
const DUPLICATE_THRESHOLD = 0.15;
|
|
92
|
+
|
|
93
|
+
/** Cosine distance below which two entries are considered closely related. */
|
|
94
|
+
const SIMILAR_THRESHOLD = 0.3;
|
|
95
|
+
|
|
96
|
+
/** Minimum confidence score required to store an entry. */
|
|
97
|
+
const MINIMUM_CONFIDENCE = 0.4;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Negation markers used in polarity-flip contradiction detection.
|
|
101
|
+
* A contradiction is signalled when exactly one of two related entries
|
|
102
|
+
* contains one of these markers near shared keyword overlap.
|
|
103
|
+
*/
|
|
104
|
+
const NEGATION_MARKERS = [
|
|
105
|
+
'not',
|
|
106
|
+
'never',
|
|
107
|
+
'no longer',
|
|
108
|
+
'deprecated',
|
|
109
|
+
'removed',
|
|
110
|
+
'replaced',
|
|
111
|
+
'broken',
|
|
112
|
+
'avoid',
|
|
113
|
+
'do not',
|
|
114
|
+
"don't",
|
|
115
|
+
'invalid',
|
|
116
|
+
'obsolete',
|
|
117
|
+
];
|
|
118
|
+
|
|
119
|
+
// ============================================================================
|
|
120
|
+
// Helpers
|
|
121
|
+
// ============================================================================
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Compute a short SHA-256 prefix over the normalised text content.
|
|
125
|
+
* Used for exact-duplicate detection without embedding.
|
|
126
|
+
*/
|
|
127
|
+
function contentHashPrefix(text: string): string {
|
|
128
|
+
return createHash('sha256').update(text.trim().toLowerCase()).digest('hex').slice(0, 16);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Polarity-flip contradiction heuristic.
|
|
133
|
+
*
|
|
134
|
+
* Returns true when exactly one of the two texts carries a negation marker
|
|
135
|
+
* AND both texts share at least 3 meaningful keywords (>4 chars).
|
|
136
|
+
*
|
|
137
|
+
* This is intentionally approximate — false positives cause a supersede
|
|
138
|
+
* write (safe), false negatives allow a duplicate (harmless, caught later
|
|
139
|
+
* by cosine merge).
|
|
140
|
+
*/
|
|
141
|
+
function hasContradictingPolarity(existingText: string, newText: string): boolean {
|
|
142
|
+
const existingLower = existingText.toLowerCase();
|
|
143
|
+
const newLower = newText.toLowerCase();
|
|
144
|
+
|
|
145
|
+
const existingNegated = NEGATION_MARKERS.some((m) => existingLower.includes(m));
|
|
146
|
+
const newNegated = NEGATION_MARKERS.some((m) => newLower.includes(m));
|
|
147
|
+
|
|
148
|
+
// Contradiction: exactly one of the two carries negation
|
|
149
|
+
if (existingNegated === newNegated) return false;
|
|
150
|
+
|
|
151
|
+
// Require at least 3 shared meaningful keywords
|
|
152
|
+
const existingWords = new Set(existingLower.split(/\s+/).filter((w) => w.length > 4));
|
|
153
|
+
const newWords = new Set(newLower.split(/\s+/).filter((w) => w.length > 4));
|
|
154
|
+
const overlap = [...newWords].filter((w) => existingWords.has(w));
|
|
155
|
+
|
|
156
|
+
return overlap.length >= 3;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Mark an existing entry as invalid (superseded).
|
|
161
|
+
* Sets the invalid_at column to now on whichever typed table owns the entry.
|
|
162
|
+
*
|
|
163
|
+
* Determined by ID prefix conventions:
|
|
164
|
+
* D... → brain_decisions
|
|
165
|
+
* P... → brain_patterns
|
|
166
|
+
* L... → brain_learnings
|
|
167
|
+
* O... / CM-... → brain_observations
|
|
168
|
+
*/
|
|
169
|
+
async function invalidateEntry(projectRoot: string, entryId: string): Promise<void> {
|
|
170
|
+
const now = new Date().toISOString().replace('T', ' ').slice(0, 19);
|
|
171
|
+
|
|
172
|
+
try {
|
|
173
|
+
const { getBrainNativeDb, getBrainDb } = await import('../store/brain-sqlite.js');
|
|
174
|
+
await getBrainDb(projectRoot);
|
|
175
|
+
const nativeDb = getBrainNativeDb();
|
|
176
|
+
if (!nativeDb) return;
|
|
177
|
+
|
|
178
|
+
// Route by ID prefix to correct table
|
|
179
|
+
if (entryId.startsWith('D-') || /^D\d/.test(entryId)) {
|
|
180
|
+
nativeDb
|
|
181
|
+
.prepare('UPDATE brain_decisions SET invalid_at = ? WHERE id = ? AND invalid_at IS NULL')
|
|
182
|
+
.run(now, entryId);
|
|
183
|
+
} else if (entryId.startsWith('P-') || /^P\d/.test(entryId)) {
|
|
184
|
+
nativeDb
|
|
185
|
+
.prepare('UPDATE brain_patterns SET invalid_at = ? WHERE id = ? AND invalid_at IS NULL')
|
|
186
|
+
.run(now, entryId);
|
|
187
|
+
} else if (entryId.startsWith('L-') || /^L\d/.test(entryId)) {
|
|
188
|
+
nativeDb
|
|
189
|
+
.prepare('UPDATE brain_learnings SET invalid_at = ? WHERE id = ? AND invalid_at IS NULL')
|
|
190
|
+
.run(now, entryId);
|
|
191
|
+
} else {
|
|
192
|
+
// O-, O[base36], CM- → observations
|
|
193
|
+
nativeDb
|
|
194
|
+
.prepare('UPDATE brain_observations SET invalid_at = ? WHERE id = ? AND invalid_at IS NULL')
|
|
195
|
+
.run(now, entryId);
|
|
196
|
+
}
|
|
197
|
+
} catch {
|
|
198
|
+
// Best-effort — invalidation failure must not block the primary write
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Increment the citation_count of an existing entry by 1.
|
|
204
|
+
* Routes by the same ID-prefix convention as invalidateEntry.
|
|
205
|
+
*/
|
|
206
|
+
async function incrementCitationCount(projectRoot: string, entryId: string): Promise<void> {
|
|
207
|
+
try {
|
|
208
|
+
const { getBrainNativeDb, getBrainDb } = await import('../store/brain-sqlite.js');
|
|
209
|
+
await getBrainDb(projectRoot);
|
|
210
|
+
const nativeDb = getBrainNativeDb();
|
|
211
|
+
if (!nativeDb) return;
|
|
212
|
+
|
|
213
|
+
if (entryId.startsWith('D-') || /^D\d/.test(entryId)) {
|
|
214
|
+
nativeDb
|
|
215
|
+
.prepare('UPDATE brain_decisions SET citation_count = citation_count + 1 WHERE id = ?')
|
|
216
|
+
.run(entryId);
|
|
217
|
+
} else if (entryId.startsWith('P-') || /^P\d/.test(entryId)) {
|
|
218
|
+
nativeDb
|
|
219
|
+
.prepare('UPDATE brain_patterns SET citation_count = citation_count + 1 WHERE id = ?')
|
|
220
|
+
.run(entryId);
|
|
221
|
+
} else if (entryId.startsWith('L-') || /^L\d/.test(entryId)) {
|
|
222
|
+
nativeDb
|
|
223
|
+
.prepare('UPDATE brain_learnings SET citation_count = citation_count + 1 WHERE id = ?')
|
|
224
|
+
.run(entryId);
|
|
225
|
+
} else {
|
|
226
|
+
nativeDb
|
|
227
|
+
.prepare('UPDATE brain_observations SET citation_count = citation_count + 1 WHERE id = ?')
|
|
228
|
+
.run(entryId);
|
|
229
|
+
}
|
|
230
|
+
} catch {
|
|
231
|
+
// Best-effort
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Check A (degraded): SHA-256 content-hash deduplication only.
|
|
237
|
+
*
|
|
238
|
+
* Queries brain_observations for a matching content_hash within the last
|
|
239
|
+
* 24 hours. When a match is found, returns 'merged' so the caller avoids
|
|
240
|
+
* a duplicate insert.
|
|
241
|
+
*
|
|
242
|
+
* Only checks brain_observations because it is the only table that stores
|
|
243
|
+
* a content_hash column. For other memory types, hash dedup is not supported
|
|
244
|
+
* and this returns null.
|
|
245
|
+
*/
|
|
246
|
+
async function hashDedupCheck(
|
|
247
|
+
projectRoot: string,
|
|
248
|
+
text: string,
|
|
249
|
+
): Promise<{ matched: true; id: string } | { matched: false }> {
|
|
250
|
+
try {
|
|
251
|
+
const { getBrainNativeDb, getBrainDb } = await import('../store/brain-sqlite.js');
|
|
252
|
+
await getBrainDb(projectRoot);
|
|
253
|
+
const nativeDb = getBrainNativeDb();
|
|
254
|
+
if (!nativeDb) return { matched: false };
|
|
255
|
+
|
|
256
|
+
const hash = contentHashPrefix(text);
|
|
257
|
+
// Search across all observations (no time window — permanent dedup)
|
|
258
|
+
const rows = nativeDb
|
|
259
|
+
.prepare(
|
|
260
|
+
'SELECT id FROM brain_observations WHERE content_hash = ? AND invalid_at IS NULL LIMIT 1',
|
|
261
|
+
)
|
|
262
|
+
.all(hash) as Array<{ id: string }>;
|
|
263
|
+
|
|
264
|
+
if (rows.length > 0) {
|
|
265
|
+
return { matched: true, id: rows[0].id };
|
|
266
|
+
}
|
|
267
|
+
} catch {
|
|
268
|
+
// Degrade gracefully — if dedup check fails, allow the write
|
|
269
|
+
}
|
|
270
|
+
return { matched: false };
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Determine whether the candidate is from a trusted source that bypasses
|
|
275
|
+
* the similarity/contradiction checks (Checks B).
|
|
276
|
+
*
|
|
277
|
+
* Trusted: explicit candidate.trusted flag, source='manual', or
|
|
278
|
+
* sourceConfidence='owner' or 'task-outcome'.
|
|
279
|
+
*/
|
|
280
|
+
function isTrustedSource(candidate: MemoryCandidate): boolean {
|
|
281
|
+
if (candidate.trusted === true) return true;
|
|
282
|
+
if (candidate.source === 'manual') return true;
|
|
283
|
+
if (candidate.sourceConfidence === 'owner' || candidate.sourceConfidence === 'task-outcome') {
|
|
284
|
+
return true;
|
|
285
|
+
}
|
|
286
|
+
return false;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// ============================================================================
|
|
290
|
+
// Core Gate Logic
|
|
291
|
+
// ============================================================================
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Run a MemoryCandidate through the verification gate.
|
|
295
|
+
*
|
|
296
|
+
* Checks (in order):
|
|
297
|
+
* A. Content-hash deduplication (always; degrades to observations-only when DB unavailable)
|
|
298
|
+
* B. Cosine similarity deduplication + contradiction detection (skipped for trusted sources)
|
|
299
|
+
* C. Confidence threshold >= 0.40 (always)
|
|
300
|
+
*
|
|
301
|
+
* The gate NEVER stores the entry itself — it only decides whether the caller
|
|
302
|
+
* should store, merge into an existing entry, queue as pending, or reject.
|
|
303
|
+
*
|
|
304
|
+
* To store after receiving action='stored', call the appropriate storage
|
|
305
|
+
* function (observeBrain, storeLearning, storePattern, storeDecision).
|
|
306
|
+
*
|
|
307
|
+
* @param projectRoot - Project root for brain.db access
|
|
308
|
+
* @param candidate - Candidate to verify
|
|
309
|
+
* @returns GateResult describing what should happen
|
|
310
|
+
*/
|
|
311
|
+
export async function verifyCandidate(
|
|
312
|
+
projectRoot: string,
|
|
313
|
+
candidate: MemoryCandidate,
|
|
314
|
+
): Promise<GateResult> {
|
|
315
|
+
try {
|
|
316
|
+
// -----------------------------------------------------------------------
|
|
317
|
+
// Check A: Content-hash dedup (always, fast)
|
|
318
|
+
// -----------------------------------------------------------------------
|
|
319
|
+
const hashCheck = await hashDedupCheck(projectRoot, candidate.text);
|
|
320
|
+
if (hashCheck.matched) {
|
|
321
|
+
// Bump citation count on the existing entry (fire-and-forget)
|
|
322
|
+
incrementCitationCount(projectRoot, hashCheck.id).catch(() => undefined);
|
|
323
|
+
return {
|
|
324
|
+
action: 'merged',
|
|
325
|
+
id: hashCheck.id,
|
|
326
|
+
reason: `exact-duplicate (hash match) of ${hashCheck.id}`,
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// -----------------------------------------------------------------------
|
|
331
|
+
// Check B: Cosine similarity + contradiction (skip for trusted sources)
|
|
332
|
+
// -----------------------------------------------------------------------
|
|
333
|
+
const trusted = isTrustedSource(candidate);
|
|
334
|
+
|
|
335
|
+
if (!trusted && isEmbeddingAvailable()) {
|
|
336
|
+
try {
|
|
337
|
+
const similar = await searchSimilar(candidate.text, projectRoot, 5);
|
|
338
|
+
|
|
339
|
+
if (similar.length > 0) {
|
|
340
|
+
const nearest = similar[0];
|
|
341
|
+
|
|
342
|
+
if (nearest.distance < DUPLICATE_THRESHOLD) {
|
|
343
|
+
// Near-identical — merge into existing
|
|
344
|
+
incrementCitationCount(projectRoot, nearest.id).catch(() => undefined);
|
|
345
|
+
return {
|
|
346
|
+
action: 'merged',
|
|
347
|
+
id: nearest.id,
|
|
348
|
+
reason: `near-duplicate of ${nearest.id} (cosine distance=${nearest.distance.toFixed(3)})`,
|
|
349
|
+
similarity: nearest.distance,
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
if (nearest.distance < SIMILAR_THRESHOLD) {
|
|
354
|
+
// Related — check for contradiction
|
|
355
|
+
if (hasContradictingPolarity(nearest.text, candidate.text)) {
|
|
356
|
+
// New text supersedes old — invalidate old entry
|
|
357
|
+
await invalidateEntry(projectRoot, nearest.id);
|
|
358
|
+
|
|
359
|
+
// Record supersession graph edge (fire-and-forget)
|
|
360
|
+
// Note: we don't have the new entry's ID yet so we'll skip the edge here.
|
|
361
|
+
// The caller should add the supersedes edge after storage using the returned existingId.
|
|
362
|
+
return {
|
|
363
|
+
action: 'stored',
|
|
364
|
+
id: null,
|
|
365
|
+
reason: `contradiction-supersedes ${nearest.id}`,
|
|
366
|
+
similarity: nearest.distance,
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
// Similar but not contradicting — store as new (link will be added post-storage)
|
|
371
|
+
return {
|
|
372
|
+
action: 'stored',
|
|
373
|
+
id: null,
|
|
374
|
+
reason: `similar-but-distinct to ${nearest.id} (distance=${nearest.distance.toFixed(3)})`,
|
|
375
|
+
similarity: nearest.distance,
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
} catch {
|
|
380
|
+
// Embedding/similarity check failed — degrade to hash-only (already passed above)
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
// -----------------------------------------------------------------------
|
|
385
|
+
// Check C: Confidence threshold
|
|
386
|
+
// -----------------------------------------------------------------------
|
|
387
|
+
if (candidate.confidence < MINIMUM_CONFIDENCE) {
|
|
388
|
+
return {
|
|
389
|
+
action: 'pending',
|
|
390
|
+
id: null,
|
|
391
|
+
reason: `confidence ${candidate.confidence.toFixed(2)} below minimum ${MINIMUM_CONFIDENCE}`,
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
// All checks passed — caller should store
|
|
396
|
+
return {
|
|
397
|
+
action: 'stored',
|
|
398
|
+
id: null,
|
|
399
|
+
reason: 'verified-new',
|
|
400
|
+
};
|
|
401
|
+
} catch (err) {
|
|
402
|
+
// Safety net: gate errors must never block writes.
|
|
403
|
+
// Log a warning and allow the store to proceed.
|
|
404
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
405
|
+
console.warn(`[extraction-gate] verifyCandidate error (allowing store): ${message}`);
|
|
406
|
+
return {
|
|
407
|
+
action: 'stored',
|
|
408
|
+
id: null,
|
|
409
|
+
reason: `gate-error-passthrough: ${message}`,
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Run a batch of candidates through the verification gate sequentially.
|
|
416
|
+
*
|
|
417
|
+
* Sequential (not parallel) so that a 'merged' action on an earlier candidate
|
|
418
|
+
* is visible as an existing entry when later candidates run their similarity checks.
|
|
419
|
+
*
|
|
420
|
+
* @param projectRoot - Project root for brain.db access
|
|
421
|
+
* @param candidates - Array of candidates to verify
|
|
422
|
+
* @returns Array of GateResults in input order
|
|
423
|
+
*/
|
|
424
|
+
export async function verifyBatch(
|
|
425
|
+
projectRoot: string,
|
|
426
|
+
candidates: MemoryCandidate[],
|
|
427
|
+
): Promise<GateResult[]> {
|
|
428
|
+
const results: GateResult[] = [];
|
|
429
|
+
for (const candidate of candidates) {
|
|
430
|
+
results.push(await verifyCandidate(projectRoot, candidate));
|
|
431
|
+
}
|
|
432
|
+
return results;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
// ============================================================================
|
|
436
|
+
// Storage Routing
|
|
437
|
+
// ============================================================================
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* Store a verified candidate in the appropriate BRAIN table based on memoryType.
|
|
441
|
+
*
|
|
442
|
+
* Routes:
|
|
443
|
+
* semantic → brain_learnings (storeLearning)
|
|
444
|
+
* episodic → brain_observations (observeBrain)
|
|
445
|
+
* procedural → brain_patterns (storePattern)
|
|
446
|
+
*
|
|
447
|
+
* Called only after verifyCandidate returns action='stored'.
|
|
448
|
+
*
|
|
449
|
+
* @param projectRoot - Project root for brain.db access
|
|
450
|
+
* @param candidate - Verified candidate to store
|
|
451
|
+
* @returns ID of the newly created entry
|
|
452
|
+
*/
|
|
453
|
+
export async function storeVerifiedCandidate(
|
|
454
|
+
projectRoot: string,
|
|
455
|
+
candidate: MemoryCandidate,
|
|
456
|
+
): Promise<string> {
|
|
457
|
+
const title = candidate.title ?? candidate.text.slice(0, 120);
|
|
458
|
+
|
|
459
|
+
switch (candidate.memoryType) {
|
|
460
|
+
case 'semantic': {
|
|
461
|
+
const { storeLearning } = await import('./learnings.js');
|
|
462
|
+
const row = await storeLearning(projectRoot, {
|
|
463
|
+
insight: candidate.text,
|
|
464
|
+
source: candidate.source,
|
|
465
|
+
confidence: candidate.confidence,
|
|
466
|
+
actionable: candidate.source === 'task-completion',
|
|
467
|
+
});
|
|
468
|
+
return row.id;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
case 'episodic': {
|
|
472
|
+
const { observeBrain } = await import('./brain-retrieval.js');
|
|
473
|
+
const result = await observeBrain(projectRoot, {
|
|
474
|
+
text: candidate.text,
|
|
475
|
+
title,
|
|
476
|
+
sourceSessionId: candidate.sourceSessionId,
|
|
477
|
+
sourceType: candidate.source === 'manual' ? 'manual' : 'agent',
|
|
478
|
+
});
|
|
479
|
+
return result.id;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
case 'procedural': {
|
|
483
|
+
const { storePattern } = await import('./patterns.js');
|
|
484
|
+
const row = await storePattern(projectRoot, {
|
|
485
|
+
type: 'workflow',
|
|
486
|
+
pattern: candidate.text,
|
|
487
|
+
context: title,
|
|
488
|
+
});
|
|
489
|
+
return row.id;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
default: {
|
|
493
|
+
// Exhaustive fallback — should never reach here with correct types
|
|
494
|
+
const { observeBrain } = await import('./brain-retrieval.js');
|
|
495
|
+
const result = await observeBrain(projectRoot, {
|
|
496
|
+
text: candidate.text,
|
|
497
|
+
title,
|
|
498
|
+
sourceSessionId: candidate.sourceSessionId,
|
|
499
|
+
sourceType: candidate.source === 'manual' ? 'manual' : 'agent',
|
|
500
|
+
});
|
|
501
|
+
return result.id;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* Full gate-and-store pipeline for a single candidate.
|
|
508
|
+
*
|
|
509
|
+
* Runs verifyCandidate then calls storeVerifiedCandidate when action='stored'.
|
|
510
|
+
* For 'merged', increments the existing entry's citation_count (already done inside verifyCandidate).
|
|
511
|
+
* For 'pending' and 'rejected', returns the GateResult with no storage.
|
|
512
|
+
*
|
|
513
|
+
* After storage, adds a supersedes edge when the gate returned a contradiction reason.
|
|
514
|
+
*
|
|
515
|
+
* @param projectRoot - Project root for brain.db access
|
|
516
|
+
* @param candidate - Candidate to verify and store
|
|
517
|
+
* @returns Final GateResult with the stored/merged entry ID populated
|
|
518
|
+
*/
|
|
519
|
+
export async function verifyAndStore(
|
|
520
|
+
projectRoot: string,
|
|
521
|
+
candidate: MemoryCandidate,
|
|
522
|
+
): Promise<GateResult> {
|
|
523
|
+
const gateResult = await verifyCandidate(projectRoot, candidate);
|
|
524
|
+
|
|
525
|
+
if (gateResult.action !== 'stored') {
|
|
526
|
+
return gateResult;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
try {
|
|
530
|
+
const newId = await storeVerifiedCandidate(projectRoot, candidate);
|
|
531
|
+
|
|
532
|
+
// If this was a contradiction supersession, add a graph edge (best-effort)
|
|
533
|
+
if (gateResult.reason.startsWith('contradiction-supersedes ')) {
|
|
534
|
+
const oldId = gateResult.reason.replace('contradiction-supersedes ', '');
|
|
535
|
+
addGraphEdge(
|
|
536
|
+
projectRoot,
|
|
537
|
+
`observation:${newId}`,
|
|
538
|
+
`observation:${oldId}`,
|
|
539
|
+
'supersedes',
|
|
540
|
+
1.0,
|
|
541
|
+
'extraction-gate',
|
|
542
|
+
).catch(() => undefined);
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
return { ...gateResult, id: newId };
|
|
546
|
+
} catch (err) {
|
|
547
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
548
|
+
return {
|
|
549
|
+
action: 'rejected',
|
|
550
|
+
id: null,
|
|
551
|
+
reason: `storage-error: ${message}`,
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* Full gate-and-store pipeline for a batch of candidates.
|
|
558
|
+
*
|
|
559
|
+
* Sequential execution ensures that earlier stores are visible to later similarity checks.
|
|
560
|
+
*
|
|
561
|
+
* @param projectRoot - Project root for brain.db access
|
|
562
|
+
* @param candidates - Array of candidates to verify and store
|
|
563
|
+
* @returns Array of final GateResults in input order
|
|
564
|
+
*/
|
|
565
|
+
export async function verifyAndStoreBatch(
|
|
566
|
+
projectRoot: string,
|
|
567
|
+
candidates: MemoryCandidate[],
|
|
568
|
+
): Promise<GateResult[]> {
|
|
569
|
+
const results: GateResult[] = [];
|
|
570
|
+
for (const candidate of candidates) {
|
|
571
|
+
results.push(await verifyAndStore(projectRoot, candidate));
|
|
572
|
+
}
|
|
573
|
+
return results;
|
|
574
|
+
}
|
package/src/memory/index.ts
CHANGED
|
@@ -1490,15 +1490,19 @@ export async function validateManifestEntries(
|
|
|
1490
1490
|
};
|
|
1491
1491
|
}
|
|
1492
1492
|
|
|
1493
|
-
// ===
|
|
1493
|
+
// === T549 Wave 3: Consolidator (contradiction detection) ===
|
|
1494
|
+
export * from './brain-consolidator.js';
|
|
1495
|
+
// === BRAIN Lifecycle (temporal decay, consolidation, tier promotion) ===
|
|
1494
1496
|
export * from './brain-lifecycle.js';
|
|
1495
1497
|
export * from './brain-links.js';
|
|
1496
1498
|
export * from './brain-migration.js';
|
|
1497
|
-
// === BRAIN Retrieval functions (3-layer pattern) ===
|
|
1499
|
+
// === BRAIN Retrieval functions (3-layer pattern + budget-aware) ===
|
|
1498
1500
|
export * from './brain-retrieval.js';
|
|
1499
1501
|
export * from './brain-search.js';
|
|
1500
1502
|
// === BRAIN Memory modules (brain.db backed) ===
|
|
1501
1503
|
export * from './decisions.js';
|
|
1504
|
+
// === T549 Wave 2: Extraction Gate ===
|
|
1505
|
+
export * from './extraction-gate.js';
|
|
1502
1506
|
export * from './learnings.js';
|
|
1503
1507
|
// === JSONL Memory modules (legacy, still active) ===
|
|
1504
1508
|
export * from './patterns.js';
|
package/src/memory/learnings.ts
CHANGED
|
@@ -93,12 +93,40 @@ export async function storeLearning(projectRoot: string, params: StoreLearningPa
|
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
//
|
|
96
|
+
// T549 Wave 1-A: Tier routing for learnings.
|
|
97
|
+
// Learnings are short-term semantic entries — they start unverified and must earn promotion.
|
|
98
|
+
// sourceConfidence routing (spec §4.1 Decision Tree):
|
|
99
|
+
// - source contains 'manual' → 'owner' (manually entered learnings are owner-stated)
|
|
100
|
+
// - source contains 'transcript:ses_' → 'speculative' (transcript-extracted, low confidence)
|
|
101
|
+
// - otherwise → 'agent' (agent-generated during session grading, hooks, etc.)
|
|
102
|
+
// memoryTier routing:
|
|
103
|
+
// - source contains 'manual' → 'medium' (owner-stated facts skip short-term)
|
|
104
|
+
// - otherwise → 'short' (auto/agent learnings start short-term, consolidator promotes)
|
|
105
|
+
// memoryType routing (spec §4.1 Decision Tree for memoryType):
|
|
106
|
+
// - source contains 'transcript:ses_' → 'episodic' (event-specific insight)
|
|
107
|
+
// - otherwise → 'semantic' (declarative factual learning)
|
|
108
|
+
// Owner-stated learnings are ground truth (auto-verified).
|
|
109
|
+
// Transcript-extracted and agent-inferred start unverified — consolidator promotes.
|
|
110
|
+
const isManual = params.source.includes('manual') || params.source.includes('owner');
|
|
111
|
+
const isTranscript = params.source.includes('transcript:ses_');
|
|
112
|
+
const sourceConfidence = isManual
|
|
113
|
+
? ('owner' as const)
|
|
114
|
+
: isTranscript
|
|
115
|
+
? ('speculative' as const)
|
|
116
|
+
: ('agent' as const);
|
|
117
|
+
const memoryTier = isManual ? ('medium' as const) : ('short' as const);
|
|
118
|
+
const memoryType = isTranscript ? ('episodic' as const) : ('semantic' as const);
|
|
119
|
+
const verified = isManual;
|
|
120
|
+
|
|
121
|
+
// Compute quality score from confidence, actionability, content richness,
|
|
122
|
+
// and T549 source multiplier.
|
|
97
123
|
const qualityScore = computeLearningQuality({
|
|
98
124
|
confidence: params.confidence,
|
|
99
125
|
actionable: params.actionable ?? false,
|
|
100
126
|
insight: params.insight.trim(),
|
|
101
127
|
application: params.application ?? null,
|
|
128
|
+
sourceConfidence,
|
|
129
|
+
memoryTier,
|
|
102
130
|
});
|
|
103
131
|
|
|
104
132
|
// Create new entry
|
|
@@ -111,6 +139,11 @@ export async function storeLearning(projectRoot: string, params: StoreLearningPa
|
|
|
111
139
|
application: params.application ?? null,
|
|
112
140
|
applicableTypesJson: params.applicableTypes ? JSON.stringify(params.applicableTypes) : '[]',
|
|
113
141
|
qualityScore,
|
|
142
|
+
// T549 Wave 1-A: tier/type/confidence assigned at write time
|
|
143
|
+
memoryTier,
|
|
144
|
+
memoryType,
|
|
145
|
+
sourceConfidence,
|
|
146
|
+
verified,
|
|
114
147
|
};
|
|
115
148
|
|
|
116
149
|
const saved = await accessor.addLearning(entry);
|