Skip to content

Phase 1: Success capture -- extend CapturedLearning with procedural memory #693

@AlexMikhalev

Description

@AlexMikhalev

Parent Epic

Part of #692 (Operational Skill Store)

Summary

Extend terraphim-agent learn from failure-only capture to also record successful multi-step workflows as reusable CapturedProcedure entries.

What Changes

New types in terraphim_types

  • CapturedProcedure -- ordered list of steps with preconditions, postconditions, and confidence score
  • ProcedureStep -- individual command with expected exit code, output pattern, timeout, required env vars

New capture path in terraphim_agent/src/learnings/

  • Add capture_successful_procedure() alongside existing capture_failed_command()
  • Accept session ID or manual step list as input
  • Store as markdown (matching existing format) with structured frontmatter
  • Index via RoleGraph (same as failure learnings)

CLI extensions

terraphim-agent learn capture-success "task-type" --steps-from-session <id>
terraphim-agent learn capture-success "task-type" --steps "cmd1" "cmd2" "cmd3"
terraphim-agent learn procedures
terraphim-agent learn procedures --task-type "deploy"

Affected Crates

  • terraphim_agent (learnings module)
  • terraphim_types (new types)

Dependencies

Acceptance Criteria

  • CapturedProcedure type defined with serde + Persistable
  • capture-success subcommand stores procedure to learnings directory
  • procedures subcommand lists stored procedures with confidence scores
  • Existing learn list and learn query also surface procedures
  • Aho-Corasick deduplication prevents storing near-identical procedures
  • Unit tests for capture, storage, and query paths

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions