Skip to content

feat: chainweaver record — auto-suggest flows from a live agent tool trace (on-ramp for #78) #226

@dgenio

Description

@dgenio

Why

This is the feature that justifies the project's existence and is the clearest differentiator. Today a user must already know their deterministic path and hand-author a Flow. The high-value, low-friction on-ramp is the reverse: point ChainWeaver at an agent's tool-call trace and have it propose compiled flows automatically. This productizes ChainAnalyzer + the runtime observer (#78) into a single user-facing command.

Proposal

A chainweaver record / chainweaver suggest-from-trace path that:

  1. Ingests a sequence of observed tool calls (a JSONL trace, or a thin recorder wrapper around an existing agent loop / MCP proxy).
  2. Detects repeated, schema-compatible sub-sequences via ChainAnalyzer.
  3. Emits ready-to-register candidate Flow objects as .flow.yaml, ranked by frequency × estimated LLM-calls-avoided.
  4. Reports, per candidate: occurrences, the tools involved, and the projected cost/latency saving.

This should be offline and deterministic (no LLM), consistent with the project's core invariant.

Acceptance criteria

  • A documented CLI command turns a recorded tool trace into one or more candidate .flow.yaml files.
  • Candidates are ranked and annotated with occurrence count + projected savings.
  • A runnable example under examples/ demonstrates record → suggest → register → execute on a sample trace.
  • Works without any LLM dependency.
  • Docs cookbook page added; README hero links to it as the flagship workflow.

Builds on: #78 (runtime observer), #100/#28 (optional LLM optimizers — out of scope here; this must stay LLM-free).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions