Harden SCM lifecycle behavior across public surfaces - #4
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens SCM’s lifecycle behavior across its public surfaces (SDK, CLI, MCP server, REST, demo) by routing them through a shared lifecycle engine builder, improving state-transition/versioning handling, and making wake/sleep outputs more structured and diagnosable (including optional provider setup guidance).
Changes:
- Centralized engine construction via
build_lifecycle_engineso all surfaces consistently enable lifecycle features (sleep orchestration, schema extraction, wake summaries) and offline fallback. - Improved explicit “from X to Y” handling: contradiction detection + transition term extraction + normalization so former values don’t remain active in current memory/version lineage.
- Made wake-summary insights JSON-structured (dicts) and expanded regression tests + docs for optional OpenAI(-compatible) provider setup and doctor diagnostics.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_scm_sdk.py | Adds offline schema-extraction + structured wake-summary regression coverage. |
| tests/test_product_runtime_api.py | Tightens REST wake-summary contract to require structured insights. |
| tests/test_llm_transition_normalization.py | Verifies transition normalization drops former-state concepts and promotes current-state to fact. |
| tests/test_event_compiler.py | Adds “from→to” contradiction + term extraction tests. |
| tests/test_contradiction_versioning.py | Ensures explicit transition terms trigger version supersession correctly. |
| tests/test_cli_doctor.py | Adds CLI doctor checks for optional provider configuration. |
| src/sleep/sleep_cycle.py | Renames/extends curiosity-engine builder and wires schema stats into sleep cycle stats. |
| src/sleep/deep_sleep.py | Filters schema extraction to user episodes and emits schemas_formed metric. |
| src/runtime_factory.py | Introduces shared lifecycle engine builder used by all public surfaces. |
| src/llm/init.py | Adds transition normalization, improves provider install error guidance, and applies normalization to JSON extraction. |
| src/integrations/tools.py | Makes wake-summary insights structured and updates time handling + legacy stat aliasing. |
| src/integrations/mcp_server.py | Routes MCP engine creation through the shared lifecycle factory. |
| src/core/long_term_memory.py | Uses explicit transition terms to improve version-candidate selection and supersession behavior. |
| src/core/event_compiler.py | Adds explicit transition parsing and treats transitions as contradictions. |
| src/cli/main.py | Routes CLI engine build through factory; adds provider-configuration doctor check. |
| src/chat/engine.py | Plumbs transition term tags into stored concepts; surfaces schema/contradiction stats in sleep results. |
| src/api/main.py | Bumps API version to 0.9.2. |
| src/api/demo_router.py | Routes demo engine creation through the shared lifecycle factory. |
| scm/runtime.py | Routes SDK engine creation through the shared lifecycle factory and keeps wake/sleep routed through tool handlers. |
| scm/init.py | Adds scm.__version__ and includes it in exports. |
| README.md | Documents optional provider setup and explicit opt-in for LLM-backed curiosity filling. |
| pyproject.toml | Bumps package version to 0.9.2. |
| docs/GETTING_STARTED.md | Documents optional provider + curiosity opt-in environment variables. |
| CHANGELOG.md | Adds v0.9.2 release notes matching lifecycle parity and transition/versioning changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
385
to
388
| "narrative": getattr(summary, "narrative", "") or "", | ||
| "insights": [str(i) for i in insights[:20]], | ||
| "insights": [serialize_insight(insight) for insight in insights[:20]], | ||
| "schemas_formed": getattr(summary, "schemas_formed_count", len(insights)), | ||
| } |
| schema_extractor=SchemaExtractor( | ||
| config=SchemaExtractorConfig( | ||
| enabled=True, | ||
| min_repetitions=max(2, int(schema_min_repetitions)), |
| min_repetitions=max(2, int(schema_min_repetitions)), | ||
| ) | ||
| ), | ||
| enable_paraphrase=True, |
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
Validation
twine checkgpt-5.4-minipaper gate passed 6/6 with sanitized artifacts