BMAD-METHOD/bmad-agent/templates/context-persistence-configu...

468 lines
11 KiB
Markdown

## Template Usage Methodology
**This is a methodology template, not application code.** Use this template to:
1. **Configure Your AI Environment**: Adapt these patterns to your specific AI platform
2. **Establish Standards**: Use as organizational standards for context persistence
3. **Guide Implementation**: Follow these patterns when implementing persistence
4. **Validate Quality**: Use these criteria to validate any implementation
### Platform-Specific Application
#### For Claude/Anthropic Users
- Apply file-based persistence patterns
- Use conversation export/import methodology
- Configure privacy protection patterns
#### For ChatGPT/OpenAI Users
- Apply conversation history methodology
- Use custom instructions persistence patterns
- Configure cross-session continuity
#### For v0/Vercel Users
- Apply browser storage methodology
- Use project persistence patterns
- Configure workspace continuity
#### For IDE-Based AI (Cursor, etc.)
- Apply workspace persistence patterns
- Use project context methodology
- Configure development workflow integration
# Context Persistence Configuration Template
## Configuration Overview
**Configuration Type:** Context Persistence Engine
**Target Environment:** [IDE Environment - Claude Code/Cursor AI/V0/JetBrains/etc.]
**Configuration Version:** 1.0
**Last Updated:** [Date]
## Storage Configuration
### Storage Tier Configuration
\```yaml
storage_tiers:
hot_storage:
enabled: true
technology: "[in_memory_cache|redis|memcached]"
capacity_limit: "[memory_limit_mb]"
access_time_target: "10ms"
retention_policy: "session_duration"
warm_storage:
enabled: true
technology: "[ssd_database|local_filesystem|distributed_cache]"
capacity_limit: "[storage_limit_gb]"
access_time_target: "100ms"
retention_policy: "30_days"
cold_storage:
enabled: true
technology: "[object_storage|compressed_archives|cloud_storage]"
capacity_limit: "[storage_limit_tb]"
access_time_target: "1000ms"
retention_policy: "1_year"
\```
### Storage Location Configuration
\```yaml
storage_locations:
file_system:
base_path: "[base_storage_path]"
directory_structure:
- "contexts/"
- "contexts/hot/"
- "contexts/warm/"
- "contexts/cold/"
- "contexts/archive/"
database:
connection_string: "[database_connection]"
table_prefix: "bmad_context_"
schema_version: "1.0"
cloud_storage:
provider: "[aws_s3|azure_blob|gcp_storage]"
bucket_name: "[storage_bucket]"
region: "[storage_region]"
credentials: "[credential_configuration]"
\```
## Serialization Configuration
### Serialization Strategy
\```yaml
serialization:
default_strategy: "[structured|binary|hybrid]"
structured_serialization:
format: "json"
schema_validation: true
pretty_print: false
compression: "gzip"
binary_serialization:
format: "msgpack"
compression: "lz4"
type_preservation: true
hybrid_serialization:
metadata_format: "json"
content_format: "binary"
threshold_size: "1mb"
\```
### Compression Configuration
\```yaml
compression:
enabled: true
algorithm: "[gzip|lz4|zstd|brotli]"
compression_level: "[1-9]"
minimum_size_threshold: "1kb"
per_tier_settings:
hot_storage:
compression: false
warm_storage:
compression: true
algorithm: "lz4"
cold_storage:
compression: true
algorithm: "zstd"
level: 6
\```
## Security Configuration
### Encryption Settings
\```yaml
encryption:
enabled: true
default_algorithm: "[AES-256|ChaCha20|AES-128]"
encryption_levels:
none:
description: "No encryption applied"
use_cases: ["public_data", "non_sensitive_context"]
standard:
description: "Standard encryption for general data"
algorithm: "AES-256"
key_derivation: "PBKDF2"
high:
description: "High security encryption for sensitive data"
algorithm: "ChaCha20"
key_derivation: "Argon2"
additional_protection: "key_rotation"
\```
### Access Control Configuration
\```yaml
access_control:
enabled: true
default_policy: "deny"
permission_levels:
read:
description: "Read access to context data"
validation: "user_authentication"
write:
description: "Modify context data"
validation: "ownership_or_delegation"
share:
description: "Share context with others"
validation: "sharing_permissions"
delete:
description: "Delete context data"
validation: "ownership_and_confirmation"
\```
## Performance Configuration
### Caching Settings
\```yaml
caching:
enabled: true
memory_cache:
size_limit: "[cache_size_mb]"
eviction_policy: "lru"
ttl: "5_minutes"
query_cache:
enabled: true
size_limit: "[query_cache_size]"
ttl: "10_minutes"
index_cache:
enabled: true
preload_common_indices: true
refresh_interval: "1_hour"
\```
### Performance Targets
\```yaml
performance_targets:
serialization_time: "50ms"
deserialization_time: "100ms"
storage_write_latency: "200ms"
storage_read_latency: "100ms"
restoration_time: "500ms"
throughput_targets:
contexts_per_second: 100
storage_operations_per_second: 500
concurrent_users: 50
\```
## Lifecycle Configuration
### Expiration Policies
\```yaml
expiration_policies:
default_policy: "time_based"
time_based_expiration:
working_memory: "session_end"
short_term_memory: "7_days"
episodic_memory: "30_days"
semantic_memory: "1_year"
procedural_memory: "permanent"
long_term_memory: "permanent"
usage_based_expiration:
enabled: true
access_frequency_threshold: 0.1
relevance_score_threshold: 0.3
size_based_expiration:
enabled: true
storage_limit_threshold: "80%"
cleanup_target: "60%"
\```
### Cleanup Configuration
\```yaml
cleanup:
enabled: true
schedule: "daily_at_2am"
cleanup_actions:
archive:
enabled: true
criteria: "older_than_90_days"
compression: true
delete:
enabled: true
criteria: "older_than_1_year"
confirmation_required: true
compress:
enabled: true
criteria: "older_than_7_days"
algorithm: "zstd"
\```
## Monitoring Configuration
### Metrics Collection
\```yaml
monitoring:
enabled: true
metrics:
performance_metrics:
- "serialization_time"
- "storage_latency"
- "restoration_time"
- "cache_hit_ratio"
system_metrics:
- "storage_usage"
- "memory_usage"
- "error_rates"
- "availability"
business_metrics:
- "context_creation_rate"
- "restoration_success_rate"
- "user_satisfaction"
\```
### Alerting Configuration
\```yaml
alerting:
enabled: true
alert_rules:
high_error_rate:
threshold: "5%"
duration: "5_minutes"
severity: "warning"
storage_full:
threshold: "90%"
duration: "1_minute"
severity: "critical"
performance_degradation:
threshold: "2x_baseline"
duration: "10_minutes"
severity: "warning"
\```
## Integration Configuration
### Memory Architecture Integration
\```yaml
memory_integration:
enabled: true
coordination_settings:
immediate_persistence: ["critical_contexts", "user_preferences"]
deferred_persistence: ["working_memory", "temporary_artifacts"]
no_persistence: ["system_cache", "computed_values"]
event_handling:
memory_created: "evaluate_persistence_need"
memory_updated: "update_persistent_copy"
memory_deleted: "cleanup_persistent_copy"
\```
### Orchestrator Integration
\```yaml
orchestrator_integration:
enabled: true
event_publishing:
context_persisted: true
context_restored: true
context_expired: true
workflow_integration:
session_start: "restore_user_context"
session_end: "persist_session_state"
project_switch: "save_and_restore_context"
\```
## Environment-Specific Configuration
### IDE Environment Settings
\```yaml
ide_environment:
type: "[claude_code|cursor_ai|v0|jetbrains|vscode]"
claude_code:
storage_mechanism: "file_system"
base_path: ".claude/bmad/contexts/"
format: "markdown_with_yaml_frontmatter"
cursor_ai:
storage_mechanism: "workspace_storage"
api_integration: "cursor_storage_api"
format: "json"
v0:
storage_mechanism: "browser_storage"
primary_storage: "indexeddb"
fallback_storage: "localstorage"
jetbrains:
storage_mechanism: "plugin_storage"
configuration_location: ".idea/bmad/"
format: "xml"
\```
## Backup and Recovery Configuration
### Backup Settings
\```yaml
backup:
enabled: true
schedule: "daily_at_1am"
backup_strategy:
full_backup: "weekly"
incremental_backup: "daily"
retention_period: "30_days"
backup_location:
primary: "[primary_backup_location]"
secondary: "[secondary_backup_location]"
cloud_backup: "[cloud_backup_configuration]"
\```
### Recovery Settings
\```yaml
recovery:
enabled: true
recovery_options:
point_in_time_recovery: true
selective_recovery: true
cross_environment_recovery: true
recovery_testing:
schedule: "monthly"
validation: "automated_testing"
documentation: "recovery_procedures"
\```
## Configuration Validation
### Validation Rules
\```yaml
validation:
required_fields:
- "storage_tiers.warm_storage.technology"
- "serialization.default_strategy"
- "security.encryption.enabled"
- "performance_targets.restoration_time"
validation_rules:
- "storage_capacity_limits_are_positive"
- "performance_targets_are_achievable"
- "encryption_algorithms_are_supported"
- "backup_locations_are_accessible"
\```
### Configuration Testing
\```yaml
testing:
configuration_validation: true
connectivity_testing: true
performance_benchmarking: true
security_validation: true
test_schedule:
validation: "on_configuration_change"
connectivity: "daily"
performance: "weekly"
security: "monthly"
\```
---
## Configuration Instructions
1. **Copy this template** to your BMAD Method configuration directory
2. **Customize the values** in brackets `[value]` for your specific environment
3. **Validate the configuration** using the provided validation rules
4. **Test the configuration** before deploying to production
5. **Document any customizations** for future reference
## Support and Troubleshooting
For configuration support:
- Review the Context Persistence Engine documentation
- Check the troubleshooting guide for common issues
- Validate configuration syntax and values
- Test configuration in a development environment first
This template provides a comprehensive configuration framework for implementing context persistence within your specific BMAD Method environment.