9 Commits

Author SHA1 Message Date
16d79df421 fix: empty response handling, /no_think model gating, per-model profiles
- Detect empty LLM responses (no content, no tool calls) instead of
  silently treating them as task completion. Retries once without tools
  before warning the user.
- Gate /no_think system message and chat_template_kwargs to Qwen/QwQ
  models only — sending /no_think to llama3.x caused empty responses.
- Add model_profiles config section for per-model overrides (token
  budget, thinking, temperature, max_tokens) matched by name prefix.
  Applied at startup and on /model switch.
- Update SessionManager on /model switch so session files record the
  correct model.
- Add NDJSON fallback in SSE stream parser for Ollama compatibility.
- Improve read_file error to suggest find_files on FileNotFoundError.
- Add diagnostic logging for empty streams and empty results.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 23:09:04 -05:00
d829e6553c feat: add tool-level file cache with LRU eviction and mtime invalidation
Introduces FileCache (OrderedDict LRU, st_mtime_ns validation) to avoid
redundant disk reads and duplicate content in conversation context.
Read tools return a short "[Cached]" message on cache hit instead of
resending unchanged file content, saving tokens. Write/edit/delete tools
invalidate affected paths; str_replace pre-warms the cache after edits.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 22:26:51 -05:00
133bcbda57 feat: re-echo condensed user prompt in chat log
Shows user input as a compact one-liner ("You: prompt text") instead of
a full panel. Multi-line input is collapsed to the first line with a
"(+N lines)" suffix, and long lines are truncated at 120 chars.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 20:05:10 -05:00
cc03f76593 fix: render markdown in assistant panels and speed up reasoning-only recovery
Assistant message panels now use Markdown() instead of raw strings, so
bold/italic/lists render properly. Also nudge the model immediately after
tool errors instead of wasting 2 retry iterations in reasoning-only mode.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 18:21:51 -05:00
8335978583 feat: add render functions and DisplayAdapter for TUI display
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 12:41:04 -05:00
08da2c542a feat: add TUI-safe logging mode that disables RichHandler
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 12:41:03 -05:00
273da21ef6 Fix doubled workspace path when LLM passes absolute-style relative paths
resolve_safe_path now detects when the LLM passes the workspace root as
a relative path (e.g. "home/user/project/file.py") and strips the prefix
before joining. Also updated the system prompt to explicitly instruct the
model to use relative paths for all tool arguments.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 08:47:57 -05:00
91187a0728 Add Phase 5: ReAct-style agent loop with tool execution
Implement the core autonomy layer — AgentLoop streams LLM responses,
parses tool calls, executes them with permission checks, feeds results
back, and repeats until the task completes or finish is called.

- Add FinishTool for explicit loop termination
- Add tools parameter to LLMClient.stream_chat() for function calling
- Add compact tool result display (status line, not full output)
- Refactor REPL to delegate to AgentLoop.run_turn()
- Fix Ollama null content rejection (always send content as string)
- Add finish to auto_approve permissions
- 9 unit tests for agent loop (34 total, zero regressions)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 08:37:22 -05:00
5aff2183d6 init commit 2026-03-11 07:21:21 -05:00