31 Commits

Author SHA1 Message Date
Dhanji R. Prasanna
edbae60ff3 Add rulespec extensions: new predicate rules, when conditions, null handling, solon agent
Features:
- New predicate rules: NotContains, AnyOf, NoneOf
- Conditional predicates via when clauses (WhenCondition/CompiledWhenCondition)
- Null handling: YAML null treated as absent for exists/not_exists
- Solon agent for rulespec authoring (agents/solon.md)
- Rulespec schema documentation (prompts/schemas/rulespec.schema.md)

Bugfix:
- Fixed when condition evaluation in datalog path: catch-all branch did
  naive string contains instead of delegating to evaluate_predicate_datalog().
  Rules like matches (regex) were silently ignored, causing vacuous pass
  and letting violations through. Now delegates to evaluate_predicate_datalog()
  which handles all 12 rule types correctly.

Tests: 34 new tests covering all new rules, null handling, when conditions,
and the when+matches bugfix (butler rulespec pattern).
2026-02-07 16:38:27 +11:00
Dhanji R. Prasanna
f9e0b94cc1 tiny tweak 2026-01-29 12:02:11 +11:00
Dhanji R. Prasanna
1bff9b0025 huffman tweak to cover more ground 2026-01-29 11:36:09 +11:00
Dhanji R. Prasanna
1bff9d5dcc tiny tweaks to huffman 2026-01-29 11:31:17 +11:00
Dhanji R. Prasanna
570a824780 Rename archivist agent to huffman
Named after David Huffman, inventor of Huffman coding -
compression that preserves information with fewer bits.

Fits the agent's purpose: compact memory, preserve semantics.
2026-01-29 11:22:59 +11:00
Dhanji R. Prasanna
b45ff37b68 Add archivist agent for memory compaction and signal optimization
New agent that maintains workspace memory quality:
- Deduplicates entries within memory
- Tightens verbose phrasing to terse declarations
- Collapses log-style narratives to current-state facts
- Removes AGENTS.md ↔ Memory duplication
- Ports code locations from AGENTS.md to Memory

Goal: increase signal, reduce noise, preserve all semantic information.

Agent: archivist
2026-01-29 11:19:47 +11:00
Dhanji R. Prasanna
ffea6b5fac Tighten fowler prompt 2026-01-27 11:54:21 +11:00
Dhanji R. Prasanna
96899230a4 Tweak hopper to encourage mocks and stubbing 2026-01-27 10:44:48 +11:00
Dhanji R. Prasanna
bd756307f1 fowler doesnt need to explicity read README/AGENTS 2026-01-13 16:16:27 +05:30
Dhanji R. Prasanna
2fbdac7aa9 Fix extra newlines before tool calls in JSON filter
The JSON tool call filter was outputting newlines immediately as they
were encountered. When the LLM output contained multiple newlines before
a tool call, each newline was output before the tool call JSON was
detected and suppressed, leaving orphaned blank lines in the output.

Changes:
- Add pending_newlines field to FilterState to buffer newlines at line start
- First newline after content is output immediately, subsequent ones buffered
- When tool call confirmed, pending_newlines cleared (suppressing extra blanks)
- When not a tool call, pending_newlines output with the buffer
- Add flush_json_tool_filter() to flush pending content at end of streaming
- Update tests to reflect new behavior
- Add tests for newline suppression behavior
2026-01-11 17:04:27 +05:30
Dhanji R. Prasanna
7da21d7e81 Updated scout search engine order 2026-01-10 20:33:23 +11:00
Dhanji R. Prasanna
0aa1287ca6 Remove final_output tool and improve scout report handback
final_output removal:
- Remove final_output from tool definitions and dispatch
- Update system prompts to request summaries as regular text
- Remove final_output_called field from StreamingState
- Update auto_continue tests to remove final_output_called parameter
- Remove final_output test from tool_execution_test.rs
- Update planner and flock prompts to not reference final_output
- Keep backwards-compat code in feedback_extraction.rs and task_result.rs

Scout report handback:
- Change from file-based to delimiter-based report extraction
- Scout outputs report between ---SCOUT_REPORT_START/END--- markers
- Research tool extracts content between markers, strips ANSI codes
- Add comprehensive tests for extraction and ANSI stripping

657 tests pass.
2026-01-10 13:43:04 +11:00
Dhanji R. Prasanna
91239ae2ca modified scout to be more HTML aggressive for content 2026-01-09 20:37:21 +11:00
Dhanji R. Prasanna
c88ffa2431 Remove final_output tool, improve scout agent
- Remove final_output tool to allow LLM responses to stream naturally
- Update system prompts to request summaries instead of tool calls
- Rename final_output_summary to summary in session continuation
- Update tool count tests (12→11 core tools, 27→26 total)
- Delete obsolete final_output tests

Scout agent improvements:
- Simplify WebDriver usage instructions
- Prefer DuckDuckGo/Brave/Bing over Google
- Support passing task directly to agent mode
- Suppress completion message for scout (needs clean output for research tool)
2026-01-09 20:30:00 +11:00
Dhanji R. Prasanna
22d1ac8096 Move WebDriver instructions from main prompt to scout agent
Simplified the main system prompt's web research section to just direct
users to the research tool. Moved the detailed WebDriver usage instructions
to scout.md where they belong, since the scout agent is the one that
actually uses WebDriver for research.

Main prompt now simply says: use the research tool for web research.
Scout agent now has the full WebDriver best practices documentation.
2026-01-09 16:01:47 +11:00
Dhanji R. Prasanna
33e5705fc3 Add research tool for web-based research via scout agent
New tool that spawns a scout agent to perform web research and return
a structured research brief. The scout agent uses webdriver to browse
the web and returns a decision-ready report.

Changes:
- Added 'research' tool definition (12 core tools total)
- Added research tool dispatch in tool_dispatch.rs
- Created tools/research.rs implementation:
  - Spawns 'g3 --agent scout <query>' as subprocess
  - Captures stdout and extracts last line (report file path)
  - Reads and returns the report file contents
- Added exclude_research flag to ToolConfig
- Scout agent (agent_name == 'scout') does NOT have access to research
  tool to prevent infinite recursion
- Updated system prompts to describe when to use research tool
- Added scout.md agent prompt with research brief output contract

The research tool is preferred for complex research tasks (APIs, SDKs,
libraries, approaches, bugs). WebDriver can still be used directly for
simple lookups or fine-grained control.
2026-01-09 15:59:19 +11:00
Dhanji R. Prasanna
5bfaee8dd5 use consistent naming for compaction 2026-01-08 12:54:03 +11:00
Dhanji R. Prasanna
2bf475960c refactor: extract shared streaming utilities module
Agent: carmack

Create crates/g3-providers/src/streaming.rs with shared helpers:
- decode_utf8_streaming(): Handle incomplete UTF-8 sequences in SSE streams
- is_incomplete_json_error(): Detect incomplete vs malformed JSON
- make_final_chunk(): Create finished completion chunks
- make_text_chunk(): Create text content chunks
- make_tool_chunk(): Create tool call chunks

Refactor anthropic.rs:
- Use shared decode_utf8_streaming (removes 15 lines of inline UTF-8 handling)
- Use make_final_chunk, make_text_chunk, make_tool_chunk helpers
- Reduces verbose CompletionChunk constructions throughout

Refactor databricks.rs:
- Remove local copies of streaming helpers (now uses shared module)
- Reduces duplication between providers

Net reduction: 118 lines removed, 16 lines added (including new module)
All tests pass. Behavior unchanged.
2026-01-07 12:48:07 +11:00
Dhanji R. Prasanna
532ed132f7 Few shot prompts for carmack 2026-01-07 12:33:11 +11:00
Dhanji R. Prasanna
189fdec006 Carmack agent 2026-01-07 11:18:27 +11:00
Dhanji R. Prasanna
a553764e93 docs(agents): add git authorship rule to all agent prompts
Ensure agents never override git author/email and instead put their
identity in the commit message body.

Agent: fowler
2026-01-07 10:27:44 +11:00
Dhanji R. Prasanna
ff08a622eb ask all agents to commit their work 2026-01-07 09:31:02 +11:00
Dhanji R. Prasanna
9cb6282719 update lamport 2026-01-07 09:07:29 +11:00
Dhanji R. Prasanna
311b3bd75a added hopper testing agent and updated fowler to use euler 2026-01-07 09:06:46 +11:00
Dhanji R. Prasanna
2592fee5d5 Generalize lamport.md examples to be language-agnostic
- Changed Rust-specific examples to generic ones:
  - 'Tool calls must be valid JSON' → 'API responses must be valid JSON'
  - 'Never block the async runtime' → 'Never block the event loop'
  - 'Crate/module' → 'Module/package'
  - 'run cargo test' → 'basic commands'
2026-01-06 12:49:00 +11:00
Dhanji R. Prasanna
e2fffaab94 Slim down AGENTS.md and update lamport.md for machine-specific output
AGENTS.md changes:
- Removed redundant sections that duplicated README.md:
  - System Overview (crate table)
  - File Structure Quick Reference
  - Testing Strategy
  - Pointers to Documentation
  - Architecture Decisions
- Kept unique machine-specific sections:
  - Critical Invariants (merged Performance Constraints)
  - Recommended Entry Points
  - Dangerous/Subtle Code Paths
  - Do's and Don'ts for Automated Changes
  - Common Incorrect Assumptions
  - Dependency Analysis Artifacts
- Reduced from ~220 lines to ~116 lines

lamport.md changes:
- Rewrote AGENTS.md section with explicit instructions
- Added REQUIRED sections list (5 sections only)
- Added DO NOT include list to prevent README duplication
- AGENTS.md now points to README for architecture/usage
2026-01-06 12:46:40 +11:00
Dhanji R. Prasanna
6d2cab93f5 Extend euler.md to require AGENTS.md updates
The Euler agent must now update AGENTS.md after generating artifacts:
- Add/update 'Dependency Analysis Artifacts' section
- Table listing each file in analysis/deps/ with one-line descriptions
- No findings, metrics, or recommendations in AGENTS.md
2026-01-06 12:35:12 +11:00
Dhanji R. Prasanna
f4a1bf5e93 fix agent-mode session resumption bug 2026-01-03 16:44:58 +11:00
Dhanji R. Prasanna
8d071d5eed fix: fowler agent now respects --workspace flag and reads project docs
- Fixed run_agent_mode to call std::env::set_current_dir with workspace_dir
- Updated fowler.md to read README.md and AGENTS.md as part of Triage & Understanding step
2025-12-26 15:24:20 +11:00
Dhanji R. Prasanna
fbf31e5f68 Fix continuation errors: auto-continue when final_output not called
- Add final_output_called flag to track if LLM properly completed
- Auto-continue with prompt if tools executed but final_output missing
- Remove unused last_action_was_tool and any_text_response variables
- Simplifies previous complex incomplete response detection logic
2025-12-20 15:32:12 +11:00
Dhanji R. Prasanna
e771382bd0 agent mode + fowler bot 2025-12-19 16:14:03 +11:00