Skip to content

feat(orchestrator): wire learning store into agent lifecycle#849

Merged
AlexMikhalev merged 3 commits intomainfrom
task/813-learning-wiring
Apr 24, 2026
Merged

feat(orchestrator): wire learning store into agent lifecycle#849
AlexMikhalev merged 3 commits intomainfrom
task/813-learning-wiring

Conversation

@AlexMikhalev
Copy link
Copy Markdown
Contributor

Summary

Wires SharedLearningStore into AgentOrchestrator so agents receive prior learnings at spawn time and exit outcomes flow back as validation evidence.

Changes

  • Config: LearningConfig struct added to OrchestratorConfig (disabled by default, opt-in via learning.enabled = true)
  • Orchestrator fields: learning_store, learning_config, injected_learning_ids
  • Spawn-time injection: render_lessons_section() queries store and appends "Prior Lessons" section to agent prompt
  • Exit-time feedback: exit classification (Success/EmptySuccess -> record_effective, failure variants -> record_applied)
  • Tick-time archival: periodic archive_stale() during reconcile_tick() (configurable interval)

Test plan

  • cargo test -p terraphim_orchestrator -- 521 tests pass (3 new)
  • cargo clippy -p terraphim_orchestrator -- -D warnings -- clean
  • test_learning_config_default_disabled -- defaults verified
  • test_render_lessons_section_empty_store -- no crash when disabled
  • test_render_lessons_section_with_learnings -- section rendered correctly

Refs #813
Depends on #848

Adds sync LearningStore trait impl on orchestrator's SharedLearningStore
with sync-to-async bridge via tokio::task::block_in_place.

Refs #813
Injects prior lessons into agent prompts at spawn time, records exit
outcomes as learning validation evidence, and archives stale learnings
periodically during reconciliation ticks.

- Add LearningConfig to OrchestratorConfig (disabled by default)
- Add learning_store, learning_config, injected_learning_ids fields
- render_lessons_section() generates Prior Lessons prompt section
- Exit classification feeds back to record_effective/record_applied
- Periodic archive_stale during reconcile_tick

Refs #813
Clippy suggests sort_by_key over sort_by for key-based sorting.

Refs #813
@AlexMikhalev AlexMikhalev merged commit 19bb282 into main Apr 24, 2026
21 of 24 checks passed
@AlexMikhalev AlexMikhalev deleted the task/813-learning-wiring branch April 24, 2026 08:10
AlexMikhalev added a commit that referenced this pull request Apr 25, 2026
* feat(orchestrator): impl LearningStore on SharedLearningStore

Adds sync LearningStore trait impl on orchestrator's SharedLearningStore
with sync-to-async bridge via tokio::task::block_in_place.

Refs #813

* feat(orchestrator): wire learning store into agent lifecycle

Injects prior lessons into agent prompts at spawn time, records exit
outcomes as learning validation evidence, and archives stale learnings
periodically during reconciliation ticks.

- Add LearningConfig to OrchestratorConfig (disabled by default)
- Add learning_store, learning_config, injected_learning_ids fields
- render_lessons_section() generates Prior Lessons prompt section
- Exit classification feeds back to record_effective/record_applied
- Periodic archive_stale during reconcile_tick

Refs #813

* fix(types): use sort_by_key in InMemoryLearningStore

Clippy suggests sort_by_key over sort_by for key-based sorting.

Refs #813
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant