feat: comprehensive metadata namespace architecture and cleanup system

BREAKING CHANGE: Remove hard delete option from deleteVerb() for consistent API

- Add complete metadata namespace architecture with O(1) soft delete performance
- Implement periodic cleanup system for old soft-deleted items
- Add restore methods for both nouns and verbs
- Require metadata contracts for all augmentations
- Eliminate namespace collisions with clean separation (_brainy, _augmentations, _audit)
- Optimize index performance using flattened dot-notation for O(1) lookups
- Add comprehensive augmentation safety system with type-safe access control
- Maintain full backward compatibility for existing data
- Add enterprise-grade cleanup with configurable age thresholds and batch processing

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
David Snelling 2025-08-27 15:38:48 -07:00
parent 9220ca6748
commit 7e243b6f2b
35 changed files with 2700 additions and 125 deletions

View file

@ -0,0 +1,63 @@
#!/bin/bash
# Script to update all augmentations with metadata declarations
echo "📝 Updating augmentations with metadata declarations..."
# Category 1: No metadata access ('none')
echo "🚫 Updating 'none' metadata augmentations..."
# RequestDeduplicatorAugmentation
sed -i "/export class RequestDeduplicatorAugmentation extends BaseAugmentation {/a\\
readonly metadata = 'none' as const // Doesn't access metadata" \
src/augmentations/requestDeduplicatorAugmentation.ts
# ConnectionPoolAugmentation
sed -i "/export class ConnectionPoolAugmentation extends BaseAugmentation {/a\\
readonly metadata = 'none' as const // Doesn't access metadata" \
src/augmentations/connectionPoolAugmentation.ts
# StorageAugmentation (abstract class)
sed -i "/export abstract class StorageAugmentation extends BaseAugmentation/a\\
readonly metadata = 'none' as const // Storage doesn't directly access metadata" \
src/augmentations/storageAugmentation.ts
# Category 2: Read-only access ('readonly')
echo "👁 Updating 'readonly' metadata augmentations..."
# WALAugmentation
sed -i "/export class WALAugmentation extends BaseAugmentation {/a\\
readonly metadata = 'readonly' as const // Reads metadata for logging" \
src/augmentations/walAugmentation.ts
# IndexAugmentation
sed -i "/export class IndexAugmentation extends BaseAugmentation {/a\\
readonly metadata = 'readonly' as const // Reads metadata to build indexes" \
src/augmentations/indexAugmentation.ts
# MonitoringAugmentation
sed -i "/export class MonitoringAugmentation extends BaseAugmentation {/a\\
readonly metadata = 'readonly' as const // Reads metadata for monitoring" \
src/augmentations/monitoringAugmentation.ts
# MetricsAugmentation
sed -i "/export class MetricsAugmentation extends BaseAugmentation {/a\\
readonly metadata = 'readonly' as const // Reads metadata for metrics" \
src/augmentations/metricsAugmentation.ts
# BatchProcessingAugmentation
sed -i "/export class BatchProcessingAugmentation extends BaseAugmentation {/a\\
readonly metadata = 'readonly' as const // Reads metadata for batching decisions" \
src/augmentations/batchProcessingAugmentation.ts
# EntityRegistryAugmentation
sed -i "/export class EntityRegistryAugmentation extends BaseAugmentation {/a\\
readonly metadata = 'readonly' as const // Reads metadata to register entities" \
src/augmentations/entityRegistryAugmentation.ts
# AutoRegisterEntitiesAugmentation
sed -i "/export class AutoRegisterEntitiesAugmentation extends BaseAugmentation {/a\\
readonly metadata = 'readonly' as const // Reads metadata for auto-registration" \
src/augmentations/entityRegistryAugmentation.ts
echo "✅ Done updating augmentations!"