Skip to content

feat(cli): agentdiff init — zero-config wizard - #34

Merged
lostmartian merged 5 commits into
mainfrom
feat/agentdiff-init
Aug 31, 2026
Merged

lostmartian merged 5 commits into
mainfrom
feat/agentdiff-init

Conversation

@lostmartian

Copy link
Copy Markdown
Collaborator

What

Pillar 4 of 0.5.0: agentdiff init auto-detects the agent framework (LangGraph → CrewAI → OpenAI Agents SDK → OpenTelemetry/OpenInference → generic) from installed packages and writes a production-ready agentdiff.toml (v0.5 statistical spec: [scenario.*] + hard invariants + tolerances) plus a GitHub Actions gate workflow — a working gate in seconds.

Why

PRD pain point P4: hand-writing TOML + workflow YAML before first value is an onboarding wall. The PRD's Pillar 4 promises a production-ready setup in <10s; init is the front door for the whole release.

How

  • init_wizard.py: detect_framework() probes importlib.util.find_spec in moat-priority order; write_config() renders the TOML + workflow templates (GitHub expressions escaped correctly); FileExistsError without --force (idempotent, never clobbers silently)
  • CLI init subcommand: --scenario, --runs, --adapter override, --force; prints detection verdict + next steps (record envelope → commit → open PR)
  • Workflow template: pull_request trigger, --fail-on-regression gate, PR report step, record target marked EDIT ME (init cannot know the user's callable)

Testing

  • 14 new tests (test_init_wizard.py): detection priority/fallback/override, file generation, valid-TOML parse, GitHub-expression survival, clobber protection, --force, CLI exit codes
  • Full suite 415 green; make lint clean

Checklist

  • make lint + full suite green
  • CHANGELOG [Unreleased] entry
  • No non-goal violations

Links to context/ROADMAP.md Phase M / 0.5.0 (SPEC-0.5.0 Pillar 4). Stacked on #33 (which is stacked on #32).

…illar 2)

Severity-aware gate evaluation shared by CLI, assertions, and suites:
HARD violations block CI (exit 1); SOFT warnings render everywhere but
never flip the exit code. New cyclical-tool-loop invariant (identical
inputs + stagnant outputs, non-consecutive included, on by default) and
opt-in max-tool-repeats cap. Path drift renders as a non-blocking note.
Provenance (G7) and threshold flagging (G6) cover the new knobs.
…, commutative equivalence (Pillar 1)

Baselines capture N >= 2 runs into a versioned envelope artifact
(schema 2.0.0, additive — AgentTrace schema untouched). Statistical
compare judges a candidate against normal variance: min-TDI-of-N
alignment, step-count and cost bands (mean ± k·sigma, cost ceiling =
max of relative cap and variance band), divergence ceiling. Hard
invariants flow through. v1 single-trace baselines load as strict
envelopes — full back-compat.

Topological equivalence: independent same-work reorders ([A->B] vs
[B->A]) merge to matched_commutative with zero TDI penalty; dependent
swaps, changed args, and changed outcomes stay real divergence.

[scenario.*] config (PRD v0.5 spec), record --runs N, rolling-window
envelope rotation, N=3/5 benchmarks (cost linear in N).
Detects the agent framework (LangGraph, CrewAI, OpenAI Agents SDK,
OpenTelemetry/OpenInference, or generic) from installed packages and
writes a production-ready agentdiff.toml (v0.5 statistical spec) plus
a GitHub Actions gate workflow. Idempotent (--force to overwrite);
--adapter/--scenario/--runs parameterize the output. Next-steps output
closes the loop: record envelope -> commit -> open a PR.
@lostmartian
lostmartian changed the base branch from feat/statistical-envelope to main August 31, 2026 18:32
@lostmartian
lostmartian merged commit b79cf75 into main Aug 31, 2026
7 checks passed
@lostmartian
lostmartian deleted the feat/agentdiff-init branch August 31, 2026 18:44
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