feat: DistillerModule + ReferenceCognitiveBus (DEC-003 OS adapter)#11
feat: DistillerModule + ReferenceCognitiveBus (DEC-003 OS adapter)#11ManniTheRaccoon merged 1 commit intomainfrom
Conversation
- ReferenceCognitiveBus: simple event emitter implementing CognitiveBus interface - Supports on/off/once/emit with error isolation per handler - Async handlers are fire-and-forget with error logging - DistillerModule: wraps ReferenceKnowledgeDistiller as a CognitiveModule - Registers as processor capability - Subscribes to 'episodes.batch', emits 'fact.created' per distilled fact - Graceful degradation: emits 'module.degraded' on errors - Updated ROADMAP.md: checked off completed OS foundation items - Fixed skeleton tsconfig.json: added composite:true for project references - 19 tests passing (8 new for bus + module)
|
@ManniTheRaccoon Review request for PR #11: Code Verification:
Code Content Validation:
Action:
|
|
👋 Friendly follow-up — this PR has been open ~24h and CI is all green (Build+Typecheck ✅, Secret Detection ✅). No merge conflicts. Ready for review whenever you have a moment, @ManniTheRaccoon! |
ManniTheRaccoon
left a comment
There was a problem hiding this comment.
Review: DistillerModule + ReferenceCognitiveBus
✅ Verification
- Types: Implements
CognitiveBusandCognitiveModulefrom@ami/skeletoncorrectly - Tests: 8 new tests (4 bus, 4 module) — solid coverage including error isolation, once semantics, lifecycle, and graceful degradation
- tsconfig fix:
composite: trueis required for project references — correct - No regressions: Existing 11 KnowledgeDistiller tests untouched
- Exports: Both new classes properly exported from
index.ts
✅ Validation
PR matches description: Yes — wraps KnowledgeDistiller as event-driven CognitiveModule, exactly as described.
Roadmap alignment: Checks off 4 items correctly. New item (CognitiveRegistry ref impl) is the logical next step per DEC-003.
Architecture Notes
- Error isolation in bus is well done — handlers can't crash each other, async errors are caught. Good foundation
- WeakSet for once handlers — clever, prevents memory leaks if handler is removed before firing
- Iterate over copy (
[...subscribers]) — correct, allows safe unsubscribe during dispatch - Fire-and-forget async — appropriate for an in-process bus. Production might want backpressure but that's future scope
- Graceful degradation —
status: 'degraded'" +module.degraded` event is exactly what DEC-003 calls for
Clean implementation. 👍
|
Self-Review (kann eigene PRs nicht approven): ✅ ReferenceCognitiveBus — WeakSet für once-Handler, Error isolation, copy-on-iterate für safe unsubscribe Ready for review @ManniTheRaccoon 👓 |
Summary
First concrete implementation of the DEC-003 capability-based OS architecture. Wraps the existing KnowledgeDistiller as a
CognitiveModulethat communicates exclusively through the event bus — no direct calls.Changes
New:
ReferenceCognitiveBus(cognitive-bus.ts)CognitiveBusinterface from skeletonon/off/once/emitwith error isolation per handlerNew:
DistillerModule(distiller-module.ts)CognitiveModuleinterface (id, name, capabilities, status, init, destroy)processorcapabilityinit: subscribes toepisodes.batchevents on the busReferenceKnowledgeDistillerpipelinefact.createdfor each distilled factdegradedand emitsmodule.degraded(graceful degradation per DEC-003)Updated:
ROADMAP.mdCognitiveRegistryreference implementationFix:
skeleton/tsconfig.jsoncomposite: trueto fix TypeScript project referencesTests
Architecture Note
This is the pattern all future cognitive modules should follow:
CognitiveModulefrom@ami/skeletoninit(), unsubscribe indestroy()Next Step
Implement
ReferenceCognitiveRegistry— the module that discovers, initializes, and manages all registeredCognitiveModuleinstances.