Phase 4: Nightly extraction -- automated workflow crystallisation via ADF

未关闭
#696 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
rust
领域
ai, backend, cli

调研方向

Start with the existing structures in terraphim_orchestrator, terraphim_sessions, and terraphim_agent, then trace the sessions and learn subcommands used by the nightly workflow. Implement the procedure-crystalliser configuration, successful-sequence extraction, classification, deduplication, health checks, and daily report, and validate the result with integration tests using sample session data.

由索引模型根据 Issue 内容生成。

描述

enhancement

Parent Epic

Part of #692 (Operational Skill Store)

Summary

Add a new Core-tier ADF agent that runs nightly to automatically discover and crystallise successful multi-step workflows from session history into reusable procedures. This closes the loop -- instead of manual capture-success, the system learns from its own history.

What Changes

New ADF agent: procedure-crystalliser

Tier: Core (cron-scheduled, runs nightly)
CLI: terraphim-agent (uses sessions + learn subcommands)

Nightly workflow:

  1. terraphim-agent sessions import -- refresh session cache
  2. Scan recent sessions for successful multi-step sequences (exit code 0 chains)
  3. Classify sequences by task type using KG concept matching
  4. Deduplicate against existing procedures (Aho-Corasick)
  5. Store novel sequences as new CapturedProcedure entries
  6. Run learn health across all procedures
  7. Generate daily report: new procedures, degraded procedures, statistics
Orchestrator config addition
[[agents]]
name = "procedure-crystalliser"
tier = "Core"
cli = "terraphim-agent"
schedule = "0 2 * * *"   # 02:00 daily
working_dir = "/home/alex/terraphim-ai"
Session extraction API in terraphim_sessions
pub async fn extract_successful_sequences(
    since: DateTime<Utc>,
    min_steps: usize,
) -> Vec<CommandSequence>;

Affected Crates

  • terraphim_orchestrator (new agent config)
  • terraphim_sessions (extraction API)
  • terraphim_agent (orchestration entry point)

Dependencies

  • Phase 1 (#693) -- CapturedProcedure type
  • Phase 3 (#695) -- health monitoring
  • #637 Paperclip leverage into ADF (orchestrator infrastructure)
  • #639 Session persistence for Claude Code agents
  • #683 Tree-structured session storage

Acceptance Criteria

  • procedure-crystalliser agent defined in orchestrator config
  • Session extraction API returns successful command sequences
  • KG-based task type classification for discovered sequences
  • Aho-Corasick deduplication prevents storing known procedures
  • Daily report generated with new/degraded procedure counts
  • Integration test with sample session data
主要语言
Rust
星标
62
派生
5
平均合并
2 小时 27 分钟
30 天内合并 PR
1

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

terraphim/terraphim-ai 的其他 Issue

查看 terraphim/terraphim-ai 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。