Copy 14 DOT workflow files from the kilroy project and add tests proving
arc can parse them. 11 files parse successfully, exercising features
including subgraphs, fan-out/fan-in, conditional routing, goal gates,
model stylesheets, and large 40+ node workflows.
3 batch test files (batch_*.dot) document a parser gap: arc requires
quoted values for strings with hyphens/dots (e.g., "gpt-5.2") while
kilroy's parser accepts them unquoted.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Aligns with the kilroy implementation of the Attractor spec. A default
of 50 retries is far too aggressive for most workflows.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add Provider::ALL constant for iterating all variants in tests
- Add catalog guardrail tests: every provider has models, provider strings
round-trip, as_str round-trips through from_str
- Add arc-agent guardrail tests: every default_model exists in catalog,
profile context_window matches catalog for default models
- Fix context window drift: profiles now look up catalog instead of
hardcoding sizes, with conservative fallbacks for unknown models
- Add #[serde(deny_unknown_fields)] to config structs so typos like
[lmm] instead of [llm] produce parse errors
- Extract DEFAULT_BASE_URL constant in OpenAI adapter
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- all_conditional_edges (ERROR): fires when a node has outgoing edges but
all are conditional with no unconditional fallback, preventing silent
fall-through to arbitrary edge selection.
- orphan_custom_outcome (WARNING): fires when outcome-based routing lacks
an unconditional fallback edge, catching typos in outcome values.
- Enhanced condition_syntax rule to also validate via parse_condition(),
catching malformed expressions that pass static checks (e.g. empty key).
- Updated integration test graph to use unconditional fallback edge.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Spawn failures (binary not found) and timeouts are infrastructure issues,
not domain failures. Return them as Err(AttractorError::Handler(...)) so
the engine can distinguish them from script exit-code failures and
potentially retry.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Register Inception Labs' Mercury diffusion LLM as a new provider using
the OpenAI-compatible adapter at api.inceptionlabs.ai. Adds mercury and
mercury-coder to the model catalog and wires up all exhaustive match
arms across arc-llm, arc-agent, and arc-attractor.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Warn when DOT reserved keywords (graph, digraph, subgraph, node, edge,
strict, if) are used as node IDs since they cause silent routing failures.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Three separate binaries are replaced by a single `arc` CLI with subcommands:
arc llm prompt/models, arc agent, arc run, arc validate, arc serve
Extract public CLI modules (arc_llm::cli, arc_agent::cli::AgentArgs/run_with_args)
so the new arc-cli crate can dispatch to each library. Integration tests migrate
to crates/arc-cli/tests/cli.rs.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Per-stage diff.patch files only capture incremental changes between
checkpoints. This adds a comprehensive final.patch covering all changes
from the run's base SHA to the final HEAD, written to logs_root for all
execution environments. Especially important for Daytona where the
sandbox is destroyed after the run.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Git checkpoint commits (stage-level snapshots, diff.patch, GitCheckpoint
events) previously only ran for Local execution. This extends support to
Docker (bind-mount uses host git, same as Local) and Daytona (runs git
commands remotely via exec_command).
- Add GitCheckpointMode enum (Host/Remote) replacing RunConfig.work_dir
- Extract git_checkpoint_host/git_diff_host helpers from inline code
- Add git_checkpoint_remote/git_diff_remote using exec_command
- Enable git_clean check for Docker alongside Local
- Add setup_daytona_git to create run branch in remote sandbox
- Switch Daytona wrap_bash_command from quote-escaping to base64 encoding
(matches TypeScript/Python/Ruby Daytona SDKs, avoids nested quote issues)
- Add e2e tests for both Host mode and Remote mode (Daytona, live-tested)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ULIDs are lexicographically sortable by creation time, making log
directories and run lists naturally ordered without extra metadata.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Make RunConfig.run_id required (String instead of Option<String>) so the
caller always provides the ID. This eliminates the duplicate UUID that
was generated: one in the HTTP server / CLI and a second inside the
engine fallback.
Also fixes a bug in preamble.rs where context key "run_id" was read but
the engine stores it as "internal.run_id", so the run ID always showed
as "unknown" in preambles.
Renames PipelineStarted.id to PipelineStarted.run_id for consistency.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add git observability to match Kilroy parity: base_sha, run_branch,
worktree_dir on PipelineStarted; GitCheckpoint events with commit SHAs;
final_git_commit_sha on PipelineCompleted/PipelineFailed; run_branch in
manifest.json; final_git_commit_sha in final.json; diff.patch per node;
and git::diff_against helper.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Create a dedicated git branch + worktree per pipeline run (Local env only)
and commit after every node checkpoint. This gives each run an isolated
working directory and a full git trail of changes per stage.
New module: git.rs with ensure_clean, head_sha, create_branch,
add/remove_worktree, and checkpoint_commit (using arc identity).
Engine changes: RunConfig gains run_id and work_dir fields; after each
checkpoint save, a git commit is created in the worktree and the SHA
is stored in checkpoint.git_commit_sha.
CLI changes: for Local execution, the repo cleanliness is verified
before any log files are written, then a worktree is created on branch
arc/run/{uuid}, cwd is switched into it, and cleanup runs after the
engine completes.
Handler changes: run_hook() accepts work_dir so hooks execute in the
worktree.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Rename crate directories, package names, binary names, path
dependencies, use statements, qualified paths, clap command names,
and string literals across the workspace.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
All three providers use the OpenAI Chat Completions protocol via
OpenAiCompatibleAdapter:
- Kimi (KIMI_API_KEY) → api.moonshot.ai/v1
- Z.AI (ZAI_API_KEY) → api.z.ai/api/coding/paas/v4
- Minimax (MINIMAX_API_KEY) → api.minimax.io/v1
Key changes:
- Extend Provider enum with Kimi, Zai, Minimax variants
- Add with_name() to AnthropicAdapter for non-Anthropic providers
using the Messages protocol (conditional Bearer vs x-api-key auth)
- Add complete_via_stream() for providers requiring stream=true
- Add with_provider() to AnthropicProfile and OpenAiProfile so the
session routes requests to the correct adapter
- Add kimi-k2.5, glm-4.7, minimax-m2.5 to model catalog
- Handle reasoning_content in OpenAI compatible adapter (capture in
stream, store as ContentPart::Thinking, echo back in assistant
messages) — required by Kimi for multi-turn tool use
- Handle missing [DONE] sentinel in SSE streams (Minimax omits it)
- Wire up all exhaustive Provider matches across agent and attractor
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace scattered provider string literals ("anthropic", "openai", "gemini")
with a Provider enum and ModelId struct in the llm crate. This prevents
bugs like routing an OpenAI model to Anthropic's API (the bug fixed in
3263d0c) by making the provider identity a compile-time checked value.
Key changes:
- Add Provider enum (Anthropic, OpenAi, Gemini) with as_str/Display/FromStr
- Add ModelId struct bundling Provider + model name
- Replace WebFetchSummarizer's separate model+provider fields with ModelId
- Replace BaseProfile.id: &'static str with BaseProfile.provider: Provider
- Replace ProviderProfile::id() -> &str with provider() -> Provider
- Parse --provider CLI strings to Provider early via FromStr
- Update AgentBackend and CliBackend to use Provider instead of String/Option
Serialization boundaries (Request.provider, Response.provider, Client HashMap
keys) remain as strings, converted via provider.as_str().
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The WebFetchSummarizer was sending requests without specifying a
provider, so they always routed to the default (Anthropic). When using
the OpenAI or Gemini profile, the summarizer model (e.g. gpt-4o-mini)
was rejected by Anthropic with a 404.
Add a `provider` field to WebFetchSummarizer so the summarization
request routes to the correct provider. Also improve the error message
to include the model name, and relax the parity test assertion to
accept summarized content.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The 8 params are all distinct concerns freshly extracted from Session;
bundling them into a struct would add indirection without clarity.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move the tool execution subsystem (~250 lines) into a dedicated module:
- execute_tool_calls: dispatches to parallel or sequential execution
- execute_and_emit_one_tool: wraps execution with event emission
- execute_one_tool: registry lookup, validation, and execution
- validate_tool_args: JSON schema validation for tool arguments
- truncate_tool_result: output truncation for history storage
These functions have zero dependency on Session's history, state machine,
or LLM interaction. Session now calls the extracted free functions,
passing needed context as parameters.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Bundle the execution parameters (env, cancel) into a single
ToolContext struct, reducing the ToolExecutor closure signature
from 3 parameters to 2. This makes the type alias simpler and
means future parameters won't change the signature.
Key changes:
- Add ToolContext { env, cancel } in tool_registry.rs
- Update ToolExecutor type alias: Fn(Value, ToolContext) -> ...
- Update all tool factories in tools.rs, v4a_patch.rs,
subagent.rs, mcp_integration.rs, and skills.rs
- Update all call sites in session.rs and tool_execution.rs
- Update test helpers and test call sites
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The compaction.rs module was created and session.rs was updated to use
it in the previous commit, but the module was not registered in lib.rs.
Add `pub mod compaction;` to complete the extraction.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ReadBeforeWriteEnvironment had 9 pass-through methods that just forwarded
to self.inner. The new delegate_execution_env! macro generates these
automatically, so only the 4 customized methods (read_file, write_file,
delete_file, grep) need to be written explicitly.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove the standalone `reasoning: Option<String>` field from
Turn::Assistant. Reasoning/thinking text is now stored exclusively
in `provider_parts` as `ContentPart::Thinking` blocks, eliminating
the dual-storage reconciliation logic in `convert_to_messages`.
Add `Turn::reasoning_text() -> Option<&str>` accessor that extracts
the first non-redacted thinking text from provider_parts.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
All three provider profiles (Anthropic, OpenAI, Gemini) independently
registered the same 7 core tools (read_file, write_file, shell, grep,
glob, web_search, web_fetch). Extract a shared register_core_tools()
function in tools.rs that accepts a ToolRegistry, SessionConfig (for
shell timeout customization), and optional WebFetchSummarizer.
Each profile now calls register_core_tools() then adds its
profile-specific tools:
- Anthropic: edit_file (with 120s shell timeout via config)
- OpenAI: apply_patch (default 10s shell timeout)
- Gemini: edit_file, read_many_files, list_dir (default 10s shell timeout)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The parser, applicator, types, and tool factory had no dependency on the
OpenAI profile. Moving them to `v4a_patch.rs` makes them independently
testable, reusable by other profiles, and cuts `openai.rs` nearly in half.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extract duplicated ToolCallStarted/ToolCallOutputDelta/ToolCallCompleted
emission and output truncation from both sequential and parallel paths
into a single shared function.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
New `mcp` crate using rmcp v0.15.0 with stdio and HTTP transports.
MCP tools are registered as regular `RegisteredTool` instances in the
agent's `ToolRegistry`, sharing the same `execute_one_tool` path as
built-in tools. Tools are namespaced as `mcp__{server}__{tool}`.
Includes end-to-end test: real MCP server subprocess (Python echo
server) → mock LLM issues tool call → MCP bridge executes → result
flows back through the session loop.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
After compaction, the agent previously lost awareness of which files it
touched. This adds a FileTracker that records file operations from tool
calls (read_file, write_file, edit_file, apply_patch) and injects a
## File Operations section into the structured compaction prompt so file
context survives across compaction cycles.
- FileTracker: BTreeMap-based tracker with record_from_tool_calls()
- Structured compaction prompt with Goal/Progress/Key Decisions/
Failed Approaches/Open Issues/Next Steps sections
- tracked_file_count field on CompactionCompleted event
- File tracker accumulates monotonically (never reset)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
web_fetch now converts HTML responses to clean markdown using the htmd
crate (stripping script/style tags), and supports an optional prompt
parameter that makes a secondary LLM call to answer questions about the
fetched content. Each provider profile picks a cheap/fast summarizer
model (Haiku, gpt-4o-mini, gemini-2.0-flash).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Let the agent autonomously load skill templates when it recognizes a
matching task, instead of requiring users to type /skill-name. The
system prompt now instructs the agent to call `use_skill` and skill
names use backtick formatting.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Enables machine-readable output from the agent CLI by streaming
SessionEvent objects as newline-delimited JSON to stdout. This
unlocks scripting, integration testing, and UI integration.
- Make SessionEvent serializable with ISO-8601 timestamps via chrono
- Add OutputFormat enum (text/json) and --output-format CLI flag
- JSON mode: each event is one JSON line to stdout, flushed per line
- JSON mode: skip print_output/print_summary (all info in event stream)
- Text mode (default): behavior unchanged
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add gpt-5.3-codex to catalog (API model, 1047576 context, 128K output)
- Move "codex" alias from gpt-5.2-codex to gpt-5.3-codex
- Add e2e integration test for gpt-5.3-codex via OpenAI API
- Remove gpt-5.3-codex-spark (not yet available)
- Empty CLI_ONLY_MODELS list and update related tests
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Test both tools across all three providers (Anthropic, OpenAI, Gemini).
web_fetch fetches example.com and asserts content is written to a file.
web_search searches for "Rust programming language" and asserts results
are saved.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the placeholder web_fetch tool with a working implementation
that executes curl within the execution environment, respecting
Docker/Daytona network sandboxing.
- Build curl command with shell-escaped URL, follow redirects, custom
user agent, and configurable timeout (default 30s, max 60s)
- Validate URL scheme (http/https only) to prevent misuse
- Truncate responses exceeding 100KB to protect context window
- Register web_fetch in Anthropic and OpenAI profiles (was Gemini-only)
- Add web_fetch guidance to all three profile system prompts
- Add captured_command to MockExecutionEnvironment for test assertions
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add SubAgentSpawned/Completed/Failed/Closed/Event variants to AgentEvent
with a deferred callback mechanism on SubAgentManager. Child session
events are subscribed to at spawn time and forwarded as wrapped
SubAgentEvent (skipping streaming noise). Wired in both the standalone
CLI and the pipeline AgentBackend.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The rg availability probe (rg --version / which rg) was running on every
grep() call. Cache the result in a OnceLock/OnceCell per environment so
the probe runs at most once. Also add grep -rn fallback to Daytona env,
matching the pattern already used by local and Docker envs.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Moves build_system_prompt() from run_single_input() to initialize(),
storing the result as a Session field. This makes the prompt's
static-ness explicit and guarantees Anthropic cache breakpoint 1
always hits. Internal methods (build_request, check_context_usage,
compact_context, estimate_token_count) no longer take a system_prompt
parameter.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the placeholder web_search tool with a real implementation backed
by the Brave Search API. Register it in all three profiles (Anthropic,
OpenAI, Gemini) so every provider has web search capability.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add ToolResult::success()/error() constructors, replacing 16 manual
construction sites across tools.rs, session.rs, history.rs, generate.rs
- Collapse ContentPart::RedactedThinking into Thinking (use redacted field)
- Extract HttpApi base struct shared by all 4 provider adapters
- Extract LineReader into common.rs for shared SSE byte buffering and
timeout handling; convert Anthropic/OpenAI from BoxStream to Response
- Replace manual delegation methods on GenerateResult/StepResult with
Deref<Target=Response>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Merges two small utility crates into a single `util` crate to reduce
workspace clutter. No behavioral changes.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove unused items that have no callers outside their own tests:
middleware wrap_stream_with_middleware/process_stream_event,
common ApiMessage/send_and_read_body, types ProviderEvent variant,
lib CancellationToken re-export, tools execute_all_tools, and
catalog get_latest_model.
Add --schema/-S flag to `ullm prompt` so generate_object() and
stream_object() are exercisable end-to-end. Includes unit test for
invalid JSON rejection and two ignored integration tests.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Register spawn_agent, send_input, wait, and close_agent tools in both
AgentBackend::create_session and the agent CLI run() so subagents are
available outside of tests. Child sessions inherit the parent's
tool_approval callback but omit subagent tools to prevent recursive
spawning.
Also classifies subagent tools as auto-approved at all permission levels
and removes unused id/depth fields from SubAgent.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace eager Regex compilation in GitleaksEngine::build() with
OnceLock-based lazy compilation. Individual regexes (rule patterns,
allowlist patterns, global allowlist patterns) are now compiled on
first use rather than at startup. This drops dry-run time from ~1.4s
to ~0.5s since the common no-match path never compiles any regexes.
Also removes the warm_up() pre-loading function and its callers since
lazy compilation makes it unnecessary.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When a pipeline revisits a node (goal gate retries, loops), each visit
now gets a distinct stage directory instead of silently overwriting the
previous one. First visit keeps the clean `nodes/{id}/` path; visit 2+
produces `nodes/{id}-attempt_{n}/`.
The engine always tracks visit counts and sets
`internal.node_visit_count` in context. Handlers read the count via
`visit_from_context()` and pass it to the updated `node_dir()`.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Runs the pipeline engine with a live Daytona sandbox: handler produces
150KB output, engine offloads to local artifact store, syncs to the
sandbox, and the checkpoint pointer references the remote path. Verifies
the file is readable in the sandbox.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>