Commit Graph

2490 Commits

Author SHA1 Message Date
Ollie Agent 72239fe3d5 kde: remove KF5/Qt5 support, build KF6/Qt6 only
Drop the OLLIE_KF5 CMake option and the entire Qt5/KF5 build branch;
delete KF5-only assets (99-ollie-kf5.sh, ollie-actions-kf5.desktop);
collapse all QT_VERSION_MAJOR and KTEXTEDITOR_VERSION_MAJOR conditionals
to the KF6 path in the KRunner, Kate, KIO, and GUI sources; update
Makefile, README, and docs. Verified: KF6 configure + full build of
ollie-gui, krunner_ollie, ollie_kate, kio_ollie.
2026-09-29 16:44:12 +02:00
Levi Neely 50b02b7a1e sandbox: skip sockets and FIFOs in Landlock rules
Landlock cannot add rules for sockets (S_IFSOCK) or FIFOs (S_IFIFO).
Previously, attempting to add a path like /run/user/1000/wayland-0
would fail with EINVAL.

Now these special file types are detected and skipped gracefully.
2026-09-25 16:33:39 +02:00
Levi Neely f88b5fcc32 kiro: only set additionalModelRequestFields for supported models
The field is rejected by models that don't support thinking/reasoning
configuration. Check model name before setting the field; 'auto' and
unknown models skip it to avoid ValidationException errors.
2026-09-21 14:40:30 +02:00
Levi Neely 48bd852594 kde/gui: add Yes/No to templates menu 2026-09-21 14:20:07 +02:00
Ollie Agent 6b745aaad1 AGENTS.md: document experimental/unstable stability policy
Ollie is experimental and unstable; optimize for a clean minimal
codebase over preserving behavior. No backward-compatibility shims,
deprecation aliases, or legacy fallbacks — change things fully and
delete the old form. Standing preference, applied without asking, so
agent behavior doesn't need per-task course correction.
2026-09-07 13:56:55 +02:00
Ollie Agent 42cae9ee2e human-friendliness: self-describing ctl, structured errors, status, overview
Make the namespace explain itself instead of requiring prior knowledge.

- ctl is self-describing: reading it (empty write) or writing 'help'
  returns the valid verbs with one-line descriptions; an unknown verb
  errors with the valid list. Refactor dispatch to an ordered []ctlCmd
  carrying descriptions; drop the undocumented '.' alias and the
  drift-prone hardcoded help verb. Keep 'i' (drop 'inject') for fast
  injects. o's ctl usage now reads the live listing.
- Errors carry severity + remediation. backend.ClassifyError maps the
  typed errors to transient/config/fatal with a one-line fix; the error
  event renders [[[error:<severity>]]] and a 'remediation:' line so a
  human knows whether to wait or intervene.
- Add a human status file: 'thinking · 12s', 'calling shell · 3s',
  'idle' — distinct from the machine-facing raw state. Wire the TUI bar
  to it.
- Bare 'o' shows an overview of running sessions/agents with status, so
  you don't need to know any names to get oriented.

Tests: dispatch help/unknown/routing, ClassifyError severity table.
2026-09-07 13:55:45 +02:00
Ollie Agent f3933e21e7 backend: make reasoningEffort the primary knob with documented thresholds
reasoningEffort (low|medium|high) is now the single human-facing control
for model deliberation. Backends that speak a discrete level (OpenAI,
OpenRouter, Copilot, Gemini, Kiro) send it verbatim; Anthropic, which
needs a numeric budget, translates via documented thresholds
(low=4096, medium=8192, high=16384). thinkingBudget remains an advanced
explicit override that wins when set.

- Add EffortLow/Medium/High, threshold consts, ValidReasoningEffort,
  EffortThinkingBudget, and GenerationParams.ResolvedThinkingBudget.
- Anthropic: derive budget from effort, grow max_tokens above the budget
  (Anthropic requires budget < max_tokens), and force temperature=1 when
  thinking is enabled (both are Anthropic requirements).
- Validate reasoningEffort at config load so typos fail loudly instead
  of silently no-opping.
- theo: drop explicit thinkingBudget/inflated maxTokens; reasoningEffort
  high now implies the 16384 budget.
- Document thresholds and per-backend behavior in data/agents/README.md;
  fix stale autoLoad/maxSteps references.
- Add unit tests for the mapping and Anthropic thinking behavior.
2026-09-07 13:34:58 +02:00
Ollie Agent a9fe03eb71 agents: raise theo reasoning to high with thinking budget
Theo is a security auditor reasoning about injection, TOCTOU races,
crypto misuse, and confused-deputy problems — adversarial edge-case work
that needs deep deliberation, not the low effort it was set to. Bump to
reasoningEffort=high and add thinkingBudget=16384 so depth carries over
to Anthropic extended thinking. Raise maxTokens to 24576 so it stays
above the thinking budget (Anthropic requires budget < max_tokens).
2026-09-07 13:28:45 +02:00
Ollie Agent 6c7e5864c4 agents: set reasoningEffort per profile; rename thinkingBudget tag
Reasoning effort is part of an agent's behavior definition, so set it
on all 14 profiles keyed to role (planning/review high, general medium,
lightweight assist low). Also rename the ThinkingBudget json tag from
the confusing bare "reasoning" to "thinkingBudget", distinct from the
reasoningEffort string knob. No config migration needed — no profile or
backends.conf used the old "reasoning" key.
2026-09-07 13:27:33 +02:00
Ollie Agent 9395a0e07b config: rename agent autoLoad field to tools
The autoLoad name implied an automatic tool-loading path that no longer
exists; tools now come only from agent config plus the /tool_load ctl
command. Rename the AgentConfig.AutoLoad field (json autoLoad) to Tools
(json tools), rename LoadAutoLoadTools to LoadTools, and update all 14
agent JSON profiles and the tool-not-loaded error message.
2026-09-07 13:23:17 +02:00
Ollie Agent eff0880737 backend: test that no tools loaded omits tools field
Regression guard for tool-free model compatibility: an agent with an
empty tool set must produce requests with no "tools"/"tool_choice"
field. Covers OpenAI, OpenRouter, Ollama, and Anthropic.
2026-09-07 13:19:35 +02:00
Ollie Agent 86db9c797b agents: autoload all memory tools 2026-09-05 11:58:12 +02:00
Ollie Agent 2e30b0ddab fs: show OpenRouter cache pricing for selected models 2026-09-05 11:56:04 +02:00
Ollie Agent 3ca84487c5 toolsrv: neutralize repo-controlled core.fsmonitor in tool env
GitSpawn class (Sep 2026): a repo's .git/config can set core.fsmonitor to
a command that executes on any git index refresh, silently and as the
user. Ollie never spawns git in its own plumbing (repo detection is
os.Stat), but model-run git inside a malicious repo would fire it.

- exec: force core.fsmonitor=false via GIT_CONFIG_* in sandboxed tool env
- turn: wrap repo AGENTS.md in <context> markers (untrusted data,
  filtered by KDE chat rendering)
- AGENTS.md: document the no-git-in-plumbing invariant (lesson 16)
2026-09-05 11:42:38 +02:00
Levi Neely 989aa0400d o: fix tmux session name handling for dots
Session names like 'r7.20' caused 'duplicate session' errors because
tmux interprets dots as window.pane separators.

Fix: Use '=' prefix for exact match in all tmux -t arguments.
From tmux(1): 'If the session name is prefixed with an =, only an
exact match is accepted.'
2026-09-04 15:35:21 +02:00
Levi Neely b25b99be4d kde/gui: add Acme-style mouse chording to prompt input
Implement proper Plan 9/Acme mouse chording in the input area:
- B1 = select (TextArea default)
- B2 = execute selection as prompt
- B3 = plumb selection or context menu
- B1+B2 = cut (chord while selecting)
- B1+B3 = paste (chord while selecting)

Uses MouseArea overlay that detects when B1 is held while B2/B3
is pressed to trigger chord actions. Context menu items now show
the chord shortcuts (Cut B1+B2, Paste B1+B3).

Placeholder text shows the mouse action reference.
2026-09-04 14:23:58 +02:00
Levi Neely eb12627ea0 kde/gui: fix binding loop and Column anchor errors
- Remove chatPane property from delegate (was shadowing id, causing binding loop)
- Remove contentArea MouseArea from inside Column (invalid anchor)
- Simplify hovered property to use only headerArea
- Edit button now copies to clipboard instead of trying to access chatPane
2026-09-04 14:20:40 +02:00
Levi Neely 75a2da080e kde/gui: Acme-style mouse actions and one-handed workflow
Add Plan 9/Acme-inspired mouse interaction:
- B2 (middle-click): Execute selected text as prompt
- B3 (right-click): Plumb selection via plan9port, fallback to context menu

Plumber integration (plumber.h/cpp):
- Wraps plan9port's plumb command for context-aware actions
- Auto-detects plumb binary in common plan9port locations
- Graceful fallback when plumber not available

Block tag line (ChatBlockDelegate):
- Hover-visible action buttons: Copy, Retry, Continue, Edit
- Per-block-type actions (Retry for assistant/error, Edit for user)

Action toolbar (ChatPane):
- Stop, Compact, Copy Last, Templates dropdown
- Mouse-first workflow without keyboard shortcuts

Input area improvements:
- Larger touch targets (48px send button, 32px toggle)
- Clear and Paste buttons
- B2/B3 mouse actions in prompt input
- Placeholder text explains mouse actions

Context menus now include:
- Execute Selection (B2)
- Plumb Selection (B3)
- Standard Cut/Copy/Paste/Select All
2026-09-04 13:47:51 +02:00
Levi Neely 5f68871c65 kde/gui: render markdown tables in chat view
Add table rendering support to ChatBlockModel:
- isTableLine(): detect pipe-delimited table rows
- renderTable(): convert table lines to HTML <table>
- renderProse(): split prose into text/table segments
- incrementalAppend: handle table state transitions during streaming

Tables render with header row detection (before |---|---| separator)
and proper incremental updates as content streams in.
2026-09-04 13:28:06 +02:00
Levi Neely 065e399444 models: add pricing info with cache rates and static estimates
Add per-model pricing to /models output. Format:
  backend<tab>model[<tab>in<tab>out<tab>cache_read<tab>cache_write]

Pricing sources:
- Anthropic: hardcoded from official pricing, includes cache rates
- OpenRouter: parsed from API response pricing field
- Other backends: static lookup table fallback, marked with (e)

Changes:
- backend: Add ModelPricing/ModelInfo types, ModelLister interface,
  static price table (Claude, GPT, Gemini, DeepSeek), LookupStaticPricing()
- openai: Parse pricing from API, implement ModelsInfo()
- anthropic: Implement ModelsInfo() with hardcoded cache rates
- fs/cache: Use ModelsInfo when available, fall back to static lookup,
  format prices per 1M tokens with (e) suffix for estimates
- agent/cost: Use shared LookupStaticPricing instead of duplicate table
2026-09-04 13:26:48 +02:00
Levi Neely 307687542c gui: add submit button to prompt input
Add a ▶ button next to the text area for mouse-based submission.
Extract shared doSubmit() on the input RowLayout. Button uses
focusPolicy: Qt.NoFocus so it doesn't steal focus from the TextArea.
2026-08-28 13:40:14 +02:00
Levi Neely 9829498d57 gui: fix text selection in prompt box
Replace MouseArea overlay with TapHandler inside TextArea.
The MouseArea sat on top and intercepted left-button press events,
blocking click-and-drag text selection. TapHandler cooperates with
the TextArea's built-in selection handling.
2026-08-28 13:25:54 +02:00
Levi Neely 9307cc86de o: set tmux mouse option globally
Use -g instead of -t to apply mouse support to all tmux sessions.
2026-08-27 16:26:08 +02:00
Levi Neely 3a39041e26 o tui: drop tmux -CC, enable mouse support 2026-08-27 15:04:14 +02:00
Levi Neely a3dfbcefc1 o: strip ANSI escapes on dumb terminals
Detect TERM=dumb or non-tty stdout and use plain '> ' prompt
instead of bold ANSI escape sequences.
2026-08-27 14:46:18 +02:00
Levi Neely 765e8b9d05 add file-level doc comments and improve AGENTS.md navigation
Agent package files now have descriptive header comments explaining
their purpose:
- dispatch.go: tool execution, batching, conflict detection
- turn.go: turn orchestration and Submit entry point
- state.go: agent state machine and notifications
- history.go: message history and token tracking
- compact.go: context compaction and cold summarization
- cache.go: tool result caching with staleness detection
- retry.go: error tracking and transient retry logic
- runtime.go: preamble assembly and tool schema management
- text_parse.go: text-based tool call parsing
- chatlog.go: chat output formatting
- chat.go: chat log storage and streaming
- workflow.go: workflow classification for discovery
- skill_match.go: semantic skill discovery
- tool_match.go: semantic tool discovery
- commands.go: slash command interception
- feed.go: feed value storage with dedup
- fifo.go: buffered prompt queue
- peer.go: peer agent management
- subagent.go: sub-agent depth and child tracking
- cost.go: cost calculation and audit logging
- prompt_resolver.go: prompt file resolution
- local_summary.go: non-LLM text summarization
- agent_config.go: configuration types

AGENTS.md improvements:
- Add 'Where to Start' section with entry points by concern
- Expand Key Files table with cache, retry, text_parse, tool_match,
  skill_match, chatlog, local_summary, workflow, and proc files
2026-08-27 10:23:26 +02:00
Levi Neely 1159bd700a update AGENTS.md and architecture-core.md for agent package reorganization
AGENTS.md:
- Update Architecture section with detailed agent package file list
- Update Key Files table with new agent package files
- Add lesson 15: split by concern, not size

architecture-core.md:
- Update Package Map diagram with new files
- Add file responsibility table in Agent Loop section
- Reference compact.go in Session & Context section
2026-08-27 10:15:31 +02:00
Levi Neely c8ccc2c450 add CONTRIBUTING.md; document Agent struct fields
- CONTRIBUTING.md: development workflow, code style, testing, conventions
- agent.go: add comments to warnedContext, resultCache, chatLog, chatStart,
  chatVers, chatCond, chatSignalCh, plan
2026-08-27 10:13:24 +02:00
Levi Neely 785c27c450 extract compaction logic from history.go
compact.go (379 lines): compact(), buildCompactedHistory(), summarizeMessage(),
  flattenToolMessages(), cacheSummary(), pendingColdSummaryStats(), stripCold(),
  resolveCompactionModel()

history.go (636 → 279 lines): core History struct, message operations,
  usage tracking
2026-08-27 10:11:54 +02:00
Levi Neely 2ae41bdd29 decompose loop.go by concern
Extract from loop.go (902 → 308 lines):
- cache.go (109 lines): resultCache, cachedResult, file staleness detection
- dispatch.go (376 lines): execToolCalls, execBatch, execOne, conflict detection, background helpers
- retry.go (126 lines): errorState, trackErrors, transientWait, retryCountdown

loop.go now contains only the core loop: run(), autoCompact(), streamResponse()
2026-08-27 10:09:05 +02:00
Levi Neely 9b7de31a07 add doc.go files; decompose agent package
doc.go:
- agent, backend, session, fs, bypass, toolclient (olliesrv)
- server, sandbox, registry (toolsrv)
- protocol, metadata (toolsrv shared)
- log, util, skills

agent package decomposition:
- chat.go: chat log, streaming, plan methods
- state.go: State, Reply, WaitChange, SignalCh, emit
- peer.go: AddPeer, RemovePeer, Peers
- subagent.go: Depth, IncChildren, DecChildren, ActiveChildren
- agent.go: 881 → 638 lines (core struct, identity, backend, runtime)
2026-08-27 10:03:58 +02:00
Levi Neely fa219e06aa quirks: only reject shell calls with tools in command position
The old word-boundary check falsely triggered when tool names appeared
in arguments (e.g., git commit messages mentioning native tools).

New logic: split on shell separators and only flag when a tool is the
first token of a sub-command or a path ending with /toolname.
2026-08-26 14:00:21 +02:00
Levi Neely 89dd021a93 session: prevent duplicate sessions and agents
- CreateEmpty: atomic check-and-insert under write lock prevents TOCTOU race
- AddAgent: reject duplicate agent names, return error
- CreateAgentWithParams: propagate AddAgent error, close orphan on conflict
- persist: handle AddAgent errors during restore (log and skip)
2026-08-26 13:57:14 +02:00
Levi Neely 59c19cace9 acme-ollie-ensure: use PWD (acme sets it), tag fallback for HOME
Confirmed acme calls threadspawnd with window dir.
Added tag-based fallback when PWD is HOME (top-level window).
2026-08-24 15:29:55 +02:00
Levi Neely 53baa43203 acme-ollie-ensure: update session cwd on every invocation 2026-08-24 15:26:06 +02:00
Levi Neely 89db742a04 Redesign acme sessions: one session per project, not per agent
Model: acme-{hash} (session with project cwd) / assistant (agent)
- Git worktree aware (uses --show-toplevel)
- CWD set on session, not agent
- Agent always named 'assistant'
2026-08-24 15:23:24 +02:00
Levi Neely 3511fdc6eb Install acme scripts and fix proc path in system prompt
- Add acme-ollie-ensure and acme commands to install-data
- Fix system prompt: proc commands use ctl, not file paths
2026-08-24 15:17:04 +02:00
Levi Neely aae861adae Fix acme-ollie-ensure: use existing namespace paths
session/$S/id and agent/$A/id don't exist in the 9P namespace.
Use env and cfg which do exist, fixing OllieHere and all acme scripts.
2026-08-24 15:14:51 +02:00
Levi Neely c6c4651446 sandbox: allow rw access to memory dir 2026-08-24 13:59:21 +02:00
Levi Neely 39ccfe8aa3 Add detach ctl command for agent
Allows user to background the current foreground tool process
by writing 'detach' to the agent ctl file. The agent can then
continue working without waiting for the tool to complete.
2026-08-24 13:56:15 +02:00
Levi Neely 67edfdf58b Code quality fixes from review
toolsrv:
- Remove dead 'var _ = os.Args' in sandbox/native_linux.go
- Fix stale comment in server.go (said 'spec.go')
- Fix misleading test comment in proc_test.go
- Add outputLimit constant in exec.go (was magic number)
- Handle error from registry.New() in main.go
- Change startup log from Warn to Info

olliesrv:
- Remove duplicate normalizeWorkflow() call in tool_match.go
- Consolidate duplicate nil checks in runtime.go
- Remove reimplemented stdlib functions in toolclient/toolsrv.go
- Simplify cacheSummary() - remove unused variable capture

-27 lines
2026-08-21 19:16:44 +02:00
Levi Neely 9b9c1a9539 Remove redundant code and obsolete streaming mechanism
- Extract inject helper for inject/i ctl handlers (dedup)
- Remove duplicate metrics file nodes at session/agent level
- Remove obsolete StreamFunc/streamWriter from toolsrv exec
- Remove stream field from limitedWriter

-68 lines
2026-08-21 17:46:11 +02:00
Levi Neely 4a037c0bbe refactor: remove dead code from embedding/virtfs/skills (-108 lines)
embedding/embedding.go:
- Remove EmbedBatch() (never called in production, test updated to use Embed)
- Remove padID field (written but never read)

embedding/index.go:
- Remove Index.mu mutex (Index is immutable after construction)

skills/skills.go:
- Remove Index.All() (never called)
- Remove Index.Reload() (never called)

virtfs/decl.go:
- Remove RemoveNode() NodeOption (never used)
- Remove RenameNode() NodeOption (never used)
- Remove Alias() NodeOption (aliases set directly on struct)

virtfs/tree.go:
- Remove Tree.Data field (never used)
- Remove Tree.Mount() (never called in production)
- Remove Tree.Child() (never called in production)
- Remove Tree.Children() (never called in production)
- Replace indexOf() with strings.IndexByte

Tests updated to directly manipulate internal children map where needed.
2026-08-21 17:20:13 +02:00
Levi Neely 2b59409845 refactor: remove dead code across packages (-220 lines)
Dead code removal based on code review:

fs/spec.go:
- Remove unused Perm* constant aliases

fs/support.go:
- Remove unused agentCwd() function

session/registry.go:
- Remove unused CreateAgent() (callers use CreateAgentWithParams directly)

session/session.go:
- Remove unused sweepStaleTmpDirs() and sweepTmpOnce
- Remove unused Session.LoadTool() (callers use LoadToolOnConn directly)
- Simplify Resume() by removing dead else branch (Pause() always nils Keeper)

toolsrv/server/proc.go:
- Remove unused globalProcCounter
- Remove unused ListProcsWithState()

toolsrv/server/server.go:
- Remove unused Mode* constants

toolsrv/bypass/bypass.go:
- Remove unused PendingCount()

toolsrv/sandbox/config.go:
- Remove unused checkPath() and pathUnder()

backend/new.go:
- Remove unused newBackend() (callers use NewWithName)

agent/loop.go:
- Remove unused contextBudget()

agent/agent.go + turn.go + runtime.go:
- Remove unused startupMessages, StartupMsgs, Runtime.Messages

agent/agent_config.go:
- Remove unused Tools *bool field and ToolsEnabled() (tools always enabled)
2026-08-21 16:41:42 +02:00
Levi Neely 600fedf1e5 doc: note architecture completeness in README
Ollie's core is feature-complete. Every capability (browser automation,
audio, RAG, scheduling, databases, external services) is achievable by
writing a tool. There are no architectural gaps — missing features are
missing tools.
2026-08-21 15:51:42 +02:00
Levi Neely 2a34c4719a fix(virtfs): support Each() with non-template directory names
Each('peer', ...) creates a named directory whose children come from
Bindings(). Previously, listDir and findChild only checked Bindings
for template names like {foo}. Now they also handle directories that
have Bindings but no Children.

This fixes the peer/ directory in olliesrv which was listing empty
even though peers were configured via peeradd.

Added test for the non-template Each pattern.
2026-08-21 13:11:46 +02:00
Levi Neely 8960fb73fd feat: refresh autoLoad tools on agent profile switch
When the 'agent <profile>' ctl command switches profiles, the tool
registry now clears old tools and loads the new profile's autoLoad
list. Previously, switching profiles left the old tools loaded.

Changes:
- registry: add ClearAgent(agentID) to remove all tools for an agent
- server/proc: add ClearAgent wrapper and 'clear <agentID>' ctl command
- toolclient: add ClearTools() method to ToolsrvConn
- agent: SwitchProfile now returns *AgentConfig for tool reload
- fs/spec: agent ctl handler clears and reloads tools after switch
2026-08-21 10:57:59 +02:00
Levi Neely e0ac54c0fb doc: update architecture docs for explicit tool autoLoad
- architecture-embedding.md: skills.Index → generic embedding.Index[T],
  tool index now per-turn from loaded tools, split source map entries
- architecture-tools.md: explain explicit autoLoad requirement, remove
  lazy loading mention
- evolution.md: add Phase 37 (lazy loading reversal, generic index,
  agent config alignment), add 4 dead-end entries
- lessons-learned.md: add 'Lazy tool loading is a dead end' section
- README.md: update line 88 to reflect explicit autoLoad

Reflects the removal of load-on-call tool loading (Phase 36 reversal)
and the separation of embedding/index.go as a generic type.
2026-08-21 10:43:58 +02:00
Levi Neely 6b5d3fd0b6 agents: align autoLoad with agent roles
Each agent now has tools matching its purpose:

- Read-only agents (explorer, navigator, observer, theo, copilot):
  No shell, file_write, file_edit. Code analysis tools only.

- Workflow agents (author, reviewer, panelist, foreman):
  9p client for peer messaging and goalstatus.
  Analysis tools for verification.

- Orchestration agents (conductor):
  subagent_spawn, 9p client, analysis tools.
  No direct file editing (delegates to sub-agents).

- Full coding agents (default, driver):
  Complete toolset including shell, file ops, LSP, code intel.

- Support agents (librarian, taskmanager):
  Scoped to their domain (docs, task files).

Removed tools that violate agent constraints.
2026-08-21 10:14:42 +02:00
Levi Neely fef6cdc307 tool loading: require explicit autoLoad, clean package structure
Remove lazy tool loading (load-on-call). Tools must now be explicitly
listed in the agent's autoLoad config. Calling an unloaded tool fails
with a clear error message.

Package structure improvements:
- embedding/index.go: generic Index type for semantic matching
- skills/skills.go: uses embedding.Index internally, keeps Skill type
- agent/skill_match.go: matchSkills() for skill discovery
- agent/tool_match.go: matchTools() for tool hints (new file)

Tool hints now match only loaded tools, not all tools on disk.
This makes agent capabilities explicit and auditable.
2026-08-21 10:11:51 +02:00