-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Parent Epic
Part of #692 (Operational Skill Store)
Summary
When learn query finds a matching CapturedProcedure with confidence > 0.8, offer to replay it instead of re-planning from scratch. This is the core token-saving mechanism -- proven workflows skip LLM reasoning entirely.
What Changes
New replay subcommand in terraphim_agent
terraphim-agent learn replay "deploy terraphim-llm-proxy config"Behaviour:
- Match query against stored procedures (Aho-Corasick + tag matching)
- Display matched procedure with steps, confidence, and replay count
- Dry-run by default -- show steps, require confirmation
- Execute step-by-step with validation:
- Check exit code against
expected_exit_code - Optionally match output against
expected_output_pattern - Respect per-step
timeout_secs
- Check exit code against
- On divergence (unexpected exit code or output), halt and report
- Update procedure's
success_countorfailure_countafter completion - Recalculate
confidencescore
Integration point for ADF agents
Expose replay as a library function so terraphim_orchestrator agents can call it programmatically:
pub async fn replay_procedure(
procedure_id: &str,
dry_run: bool,
on_step: impl Fn(&ProcedureStep, StepResult) -> ReplayDecision,
) -> Result<ReplayOutcome, ReplayError>;Affected Crates
terraphim_agent(new replay subcommand + library API)
Dependencies
- Phase 1 (Phase 1: Success capture -- extend CapturedLearning with procedural memory #693) -- procedures must exist to replay
Acceptance Criteria
-
learn replaymatches and displays procedures - Dry-run mode shows steps without executing
- Step-by-step execution with exit code validation
- Halts on divergence with clear error message
- Updates confidence score after each replay
- Library API available for programmatic replay
- Integration tests with mock commands
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request