feat: add observability, memory, resilience, and guidance modules#329
Open
reh3376 wants to merge 2 commits intokarpathy:masterfrom
Open
feat: add observability, memory, resilience, and guidance modules#329reh3376 wants to merge 2 commits intokarpathy:masterfrom
reh3376 wants to merge 2 commits intokarpathy:masterfrom
Conversation
Inspired by mdemg's production-grade AI memory infrastructure, adds four optional modules that improve experiment effectiveness without modifying the core train.py loop: - monitor.py: Prometheus-compatible metrics, loss curve tracking, alerting - memory.py: Hebbian association learning across experiment sessions - resilience.py: circuit breakers, anomaly detection, VRAM backpressure - guidance.py: proactive experiment suggestions (Jiminy-style inner voice) Updates program.md with full integration documentation and enhances analysis.ipynb with category effectiveness charts and guidance reports. Authored-by: reh3376
… work Comprehensive handoff document covering completed work (research, implementation, documentation), suggested future work prioritized by impact, architecture reference, module dependency graph, and onboarding reading order. Authored-by: reh3376
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds four optional, non-breaking Python modules that improve the effectiveness of autonomous experiment runs by bringing production-grade observability, learning, and resilience patterns to autoresearch. Inspired by mdemg — a persistent memory system for AI coding agents built on Neo4j, Hebbian learning, and Prometheus metrics.
Key principle: These modules enhance the infrastructure around the experiment loop — they never touch
train.pyorprepare.py. The core 5-minute experiment loop works exactly as before. All modules use only Python stdlib (json,time,math,dataclasses) — zero new dependencies.New Modules
monitor.py— Experiment Metrics & ObservabilityInspired by mdemg's
internal/metrics/Prometheus pipeline and 10-panel Grafana dashboardstart_experiment→record_step→end_experiment)get_prometheus_text()) — compatible with node_exporter textfile collector or direct scrapingformat_dashboard()) for quick-glance session statusmemory.py— Cross-Session Experiment Memory with Hebbian LearningInspired by mdemg's Conversation Memory System (
internal/conversation/) and Hebbian learning engine (internal/learning/)w = wmax * tanh((w + eta * signal) / wmax)) — smooth saturation instead of hard clamping, allowing continuous learning near weight limitsarchitecture,attention,activation,optimizer,learning_rate,schedule,batch_size,initialization,regularization,normalization,embedding,numerical,simplification,combination,radicalget_promising_directions()— ranked categories blending Hebbian weight with exploration bonusget_dead_ends()— categories that consistently fail (agent should avoid)get_plateaus()— velocity-based plateau detection comparing recent vs earlier improvement ratesget_surprise_highlights()— most unexpected results for investigation.autoresearch/memory/memory.jsonresilience.py— Circuit Breakers & Anomaly DetectionInspired by mdemg's
internal/circuitbreaker/,internal/anomaly/, andinternal/backpressure/pre_experiment()→ checks circuit breaker, VRAM pressure, anomalies → returnsPreExperimentVerdictwithallowed,blocked,warnings,suggestionspost_experiment()→ updates all safety systems.autoresearch/resilience/state.jsonguidance.py— Proactive Experiment SuggestionsInspired by mdemg's Jiminy inner voice (
internal/jiminy/) and RSIC (internal/ape/)exploring|exploiting|plateaued|recoveringget_guidance()["formatted"]): human-readable text block designed for injection into agent context before each experiment decisionModified Files
program.mdanalysis.ipynb.gitignore.autoresearch/to exclude module state directories from version controlDesign Decisions
pyproject.toml.train.pyorprepare.py. They observe and advise.monitor.pywithoutmemory.py, etc.Test plan
train.pyandprepare.pyare completely unmodified (zero diff)pyproject.tomlpython -c "import monitor",import memory", etc.ExperimentTrackerlifecycle:start_experiment→record_step→end_experimentExperimentMemory.store_experiment()and verify.autoresearch/memory/memory.jsonis createdCircuitBreakerthrough CLOSED → OPEN → HALF_OPEN → CLOSED transitionExperimentAdvisor.get_guidance()and verify formatted outputanalysis.ipynbcells (original cells unchanged, new cells gracefully handle missing data).autoresearch/is gitignoredAuthored-by: reh3376