Joseph M OBrien joe
  • Joined on 2026-03-15

devloop-baml (0.2.0)

Published 2026-05-31 14:25:04 -05:00 by joe

Installation

[registry]
default = "gitea"

[registries.gitea]
index = "sparse+" # Sparse index
# index = "" # Git

[net]
git-fetch-with-cli = true
cargo add devloop-baml@0.2.0

About this package

devloop-baml

BAML-powered AI analysis layer for the devloop workspace, providing structured LLM output for git branch analysis, council-style multi-role insights, and session parsing.

What it does

This crate defines BAML schemas and exposes a generated Rust client (baml_client) for calling LLM functions with structured, type-safe return values. It drives all AI analysis in devloop: branch health scoring, multi-role council synthesis, timeline Q&A, and Claude session parsing. The lib.rs re-exports the generated client and guards retry-policy correctness via a schema lint test.

Public API (BAML functions)

All functions are exposed through devloop_baml::baml_client::BamlClient.

Branch analysis (branch_insights.baml)

Function Input Output
AnalyzeBranch branch name, commits, sessions, counts BranchInsight (summary, health score, recommendations, patterns)
AnalyzeBranchWithCodeStructure above + GKG definitions/references/repo map UnifiedBranchInsight (adds code structure, architectural impact)
ExtractUserIntent raw session entry text UserIntent (parsed message, task type, skip flag)
AnswerTimelineQuestion natural-language question + timeline context TimelineAnswer (answer, confidence, related commits)

Council analysis (council_insights.baml)

Multi-role branch analysis. Each role produces a typed insight struct; a meta-analyst synthesizes them into a CouncilInsight.

Role function Client
AnalyzeBranch_StrictCritic CustomGPT5Mini
AnalyzeBranch_CreativeExplorer CustomGPT5Mini
AnalyzeBranch_GeneralAnalyst CustomGPT5Mini
AnalyzeBranch_SecurityReviewer CustomGPT5Mini
AnalyzeBranch_PerformanceAnalyst CustomGPT5Mini
SynthesizeCouncilInsights CustomGPT5 (big model)

LLM clients (clients.baml)

Client Pool Used for
CustomGPT5 OpenAI_GPT5Anthropic_Sonnet4 Synthesis, complex reasoning
CustomGPT5Mini OpenAI_GPT5MiniAnthropic_Haiku Lightweight tasks, council roles
CustomFast round-robin Mini/Haiku Load distribution

Both CustomGPT5 and CustomGPT5Mini have retry_policy Exponential (max 2 retries, 300ms base, 1.5× multiplier) to handle 429s from parallel council execution. A schema lint test in lib.rs guards this invariant.

Environment variables

Variable Required Purpose
OPENAI_API_KEY one of the two OpenAI provider access
ANTHROPIC_API_KEY one of the two Anthropic provider access

Regenerating the client

The generated code lives in baml_client/ and must not be edited manually.

# From crates/baml/
uvx --from baml-py@0.218.0 baml-cli generate

The generators.baml output_dir is set to "../" so the client lands at crates/baml/baml_client/. Pin the version to 0.218.0 to match baml = "0.218.0" in Cargo.toml.

Running tests

# Schema lint only (no API key required)
cargo test -p devloop-baml

# Full integration tests (requires API key)
cargo nextest run -p devloop-baml --release

Dependencies

ID Version
baml ^0.218.0
serde_json ^1.0
chrono ^0.4
criterion ^0.5
tokio ^1
Details
Cargo
2026-05-31 14:25:04 -05:00
1
MIT
135 KiB
Assets (1)
Versions (1) View all
0.2.0 2026-05-31