Commit graph

8 commits

Author SHA1 Message Date
Bryan Helmkamp
2bdec7e8e6 Add README.md for each crate with usage examples
Create comprehensive READMEs for unified-llm, unified-llm-cli, and
coding-agent-loop crates, and expand the attractor README from a
one-liner into full documentation covering key concepts, API usage,
and code examples.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 14:12:21 -04:00
Bryan Helmkamp
db32f00cd0 Simplify coding-agent-loop: deduplicate mocks, narrow traits, type events
- Extract shared test infrastructure (MockExecutionEnvironment, TestProfile,
  MockLlmProvider) replacing 11 duplicate mock implementations across tests
- Deduplicate tool execution logic between sequential and parallel paths
- Narrow ProviderProfile trait from 14 to 7 required methods via
  ProfileCapabilities struct and default implementations
- Replace stringly-typed HashMap event data with typed EventData enum
- Extract shared assemble_system_prompt helper and register_subagent_tools
  default method, eliminating copy-paste across all 3 profiles
- Replace fragile shell-based glob with glob crate, fix rg detection
- Add delete_file to ExecutionEnvironment, wire git context into env block
- Remove dead code (AgentError::Io, count_turns, trivial derived-trait tests)
- Use match-based lookups in truncation instead of per-call HashMap allocation

Net reduction: -1,401 lines across 20 files. All 180 tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 16:34:29 -04:00
Bryan Helmkamp
1ffc954a0f Add knowledge_cutoff to ProviderProfile, fix subagent default max_turns
- Add knowledge_cutoff() method to ProviderProfile trait so session can
  populate EnvContext from the profile instead of leaving it empty
- Set subagent default max_turns to 50 per spec (was using session
  factory default which could be 0/unlimited)
- Add corrected spec compliance review after manual verification found
  the initial 5-agent review was largely false positives

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 16:02:20 -04:00
Bryan Helmkamp
8ff36fa900 Close spec compliance gaps in coding-agent-loop
Fix all gaps identified by spec review against docs/specs/coding-agent-loop-spec.md:

- Replace placeholder system prompts with substantial provider-aligned prompts
  for OpenAI (codex-rs style), Anthropic (Claude Code style), and Gemini
  (gemini-cli style) covering identity, tool usage, and coding best practices
- Fix ExecutionEnvironment trait: add offset/limit to read_file, depth to
  list_directory, path to glob, remove separate args from exec_command
- LocalEnv: use /bin/bash -c, spawn process groups with setsid, SIGTERM to
  -pid, use ripgrep with grep fallback, add env var safelist
- Add environment context block with <environment> XML tags including git
  branch, date, model, and knowledge cutoff fields
- Capture git context snapshot (branch, status, recent commits) on init
- Add user_instructions to SessionConfig, appended as final prompt layer
- Emit AssistantTextStart before LLM calls, SESSION_END on abort path
- Fix truncation messages to match spec wording exactly
- Implement provider_options() for all profiles (reasoning, beta headers,
  safety settings)
- Add Gemini-specific tools: read_many_files, list_dir, web_search, web_fetch
- Wire spawn_agent max_turns parameter
- Fall back to working_dir for project doc discovery outside git repos

All 188 tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 15:22:10 -04:00
Bryan Helmkamp
99db2753ca Add user instructions, env context, expanded profiles to coding-agent-loop
Close spec compliance gaps:
- Add user_instructions to SessionConfig and ProviderProfile trait (spec Section 6.1 layer 5)
- Populate EnvContext with git branch, date, model name during Session::initialize()
- Expand all three profile system prompts with identity, tool guidance, coding practices
- Implement provider_options: Anthropic beta headers, OpenAI reasoning effort, Gemini safety settings
- Add register_subagent_tools() to all profiles for spawn_agent/send_input/wait/close_agent
- Add list_dir tool to Gemini profile (spec Section 3.6)
- Add chrono dependency for date formatting

20 new tests (170 → 190), all passing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 14:51:13 -04:00
Bryan Helmkamp
010d09a03a Close remaining spec compliance gaps in coding-agent-loop
- Abort now transitions to CLOSED state and returns Err(Aborted)
- Closed sessions no longer emit SessionStart before rejecting input
- Add set_reasoning_effort() for mid-session reasoning effort changes
- Fix spawn_agent truncation limit from 30k to spec-required 20k
- Add JSON Schema validation of tool arguments before execution

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 14:05:16 -04:00
Bryan Helmkamp
a8c576deba Close spec compliance gaps in coding-agent-loop
Replace all stub tools in profiles with real make_*_tool() factories,
wire up project docs discovery in session, add missing events
(SessionStart, SteeringInjected, Error), enrich environment context
block, fix per-tool truncation modes, improve loop detection to check
all groups, add SIGTERM-before-SIGKILL on timeout, and update subagent
with SubAgentResult struct.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 13:54:50 -04:00
Bryan Helmkamp
6a53634b05 Implement coding-agent-loop crate: tools, profiles, subagents, parallel execution
Add the core infrastructure for a programmable agentic coding loop:

- Core tool executors (read_file, write_file, edit_file, shell, grep, glob)
- Project doc discovery (AGENTS.md, provider-specific files, 32KB budget)
- Provider profiles: Anthropic (200K ctx), OpenAI (128K ctx, v4a apply_patch),
  Gemini (1M ctx) with provider-specific system prompts
- Subagent system with spawn/wait/close, depth limiting
- Parallel tool execution via futures::join_all when provider supports it
- Context window awareness with 80% threshold warning events

163 tests passing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 12:57:49 -04:00