- 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>
Use exact first-word matching instead of startswith() for /models and
/mode command routing. Accept /model as an alias for /models.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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>
StreamHandler.reset() was clearing on_content, on_thinking, and on_done
callbacks after every LLM response, but they were only set once per turn.
This caused the thinking indicator and streaming display to stop working
after the first tool call in a multi-step agent turn.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reduces LLM round-trips by allowing multiple files to be read in a
single tool call. Uses best-effort error handling so partial failures
still return successful reads.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace built-in Header with a custom HeaderPanel showing model name,
mode badge, and live token usage. Add AgentMode enum (normal/plan/auto)
with mode-aware permission gating — Plan mode restricts to read-only
tools, Auto mode auto-approves everything. Includes /mode slash command
and Ctrl+P keybinding to cycle modes.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Bug 1: Assistant text content was silently dropped when the LLM response
included both content and tool calls (e.g. finish with a summary). Now
content is displayed before tool call execution regardless.
Bug 2: Shell redirect operators (>, >>, <<) allowed bypassing file-write
permissions when the base command (e.g. cat) was in the allowed list.
Redirects now require explicit user approval in permissions, and the
shell tool itself blocks them as defense-in-depth.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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>
The /no_think directive was appended directly to the user's message text,
causing the LLM to interpret it as user input (e.g., referencing it as a
directory path). Now injected as a separate system message after the last
user message. Also adds which, jq, type, and file to shell allowed_commands
(were mistakenly placed in permissions.auto_approve).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds `llm.thinking` config option (default: true) that when disabled:
- Injects /no_think into the last user message for Qwen 3.x compatibility
- Sends chat_template_kwargs in API payload for backends that support it
- Silently and immediately nudges on reasoning-only responses instead of
showing warnings and wasting retry iterations
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Allows passing arbitrary parameters (e.g., enable_thinking, reasoning_effort)
to the LLM API request body via config.yaml, solving reasoning-only response
loops with models like Qwen 3.x without requiring code changes per model.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add a skill package system where each skill is a directory with a skill.yaml
manifest and prompt markdown files. Skills support /command triggers, scoped
config overrides (temperature, max_tokens, tool filtering), chain dependencies
with cycle-safe resolution, and a finish_skill completion signal.
Includes four built-in skills: explore, brainstorm, write-document, and plan.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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>
push_screen_wait requires a worker context, but on_mount is a plain
lifecycle callback. Extract session resume logic into a @work-decorated
method so the modal can be awaited without triggering NoActiveWorker.
The streaming widget shows content during streaming then hides on
completion, but nobody was writing the final response to the RichLog.
The assistant message flashed briefly then disappeared.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The App base class uses _registry (WeakSet) for DOM node tracking.
Our _registry attribute for the tool registry was shadowing it with None,
causing a TypeError during shutdown.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implement 6 new agent tools — write_file, make_dir, delete_file,
str_replace, patch_apply, run_command — bringing the agent from
read-only observer to active code modifier. All write/shell operations
are gated through the existing permissions service.
Also fix a bug where qwen3.5 thinking mode produces reasoning tokens
but no content after tool results, causing the agent to silently exit.
The loop now detects reasoning-only responses, retries twice, then
injects a nudge message to break the model out of its thinking loop.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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>
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>
Wire the REPL to a local Ollama instance via streaming HTTP (SSE).
LLMClient handles async streaming chat, StreamHandler renders live
Markdown via Rich and accumulates tool call fragments. Startup now
runs a preflight check that verifies Ollama is reachable and the
configured model is pulled, exiting with a clear message on failure.
Also adds .gitignore and updates config to use qwen3.5.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>