Commit Graph

54 Commits

Author SHA1 Message Date
Ollie Agent 3f8c8df38a Improve workflow-aware tool ranking 2026-08-20 19:01:21 +02:00
Ollie Agent 4bf46ae85d Load hinted tools through the agent namespace 2026-08-20 18:29:10 +02:00
Levi Neely 07dcd60d19 skills: add embedding-based skill matching
Add semantic skill matching using all-MiniLM-L6-v2 sentence embeddings.
Skills are automatically injected into user turns based on relevance.

New packages:
- embedding: ONNX-based text embedding with MiniLM model
- skills: skill discovery, embedding cache, and semantic matching

Integration:
- InitSkillIndex called at startup in fs.NewRoot
- matchSkills called per-turn in executeTurn
- Matched skills injected in <context> block alongside user prompts

Makefile:
- install-models target downloads model and ONNX runtime
- Model files stored in ~/.local/share/ollie/models/

Config:
- Threshold: 0.2 cosine similarity
- Limit: 3 skills per turn
- Skill dirs: ~/.kiro/skills (user), ~/.config/ollie/skills (installed)
2026-08-20 15:54:43 +02:00
Levi Neely cd9da5ed27 quirks: reject shell calls to native tools
- Add quirks package for stupid model behavior workarounds
- ShellInvokesNativeTool blocks shell(cmd="tool_name") patterns
- Add client_9p tool: native wrapper for ollie-9p operations
- Block ollie-9p in shell — use client_9p instead
- Update all prompts to use client_9p, not shell+ollie-9p
- Clarify 9P namespace is complete (tools are NOT in 9P)
- Registry.All() lists all available tools for validation
2026-08-20 14:08:53 +02:00
Levi Neely 4ff37741e2 subagent: fix timeout and premature response issues
Timeout fix:
- Add Timeout field to ToolInfo (protocol) and MetaFile (metadata)
- proc.go respects tool-declared timeout before falling back to 30s default
- subagent_spawn.meta declares timeout=0 (no timeout) so the tool is
  never killed prematurely while waiting for the sub-agent to finish
- Tool schema declares timeout with 'do not set' guidance to prevent
  the LLM from adding a short timeout

Premature response fix:
- Inject behavioral prefix into sub-agent prompt: complete all work
  before responding, report results not intentions
- Sub-agent's final text is returned to parent; this instruction ensures
  it contains accomplished work, not a plan
2026-08-20 10:59:23 +02:00
Levi Neely a73ef13fb5 tools: remove old individual cmd/ binaries
All tool logic lives in the multicall main.go at each family root.
Move .meta files to data/tools/ (single canonical location).
Expand test-core to cover all tools.
2026-08-19 13:56:21 +02:00
Levi Neely b4baddd826 Memory tools: never expose raw memo commands to agents
- Add MEMO_TOOLS=1 env var to memo script; when set, all printed
  instructions reference native tool names instead of memo paths
- Set MEMO_TOOLS=1 in all memory tool .meta wrappers
- Add memory_nap tool for compressions
- Add memory_zoom tool for tree navigation
- Add part/T pagination args to memory_wake
- Update system prompt to use memory_zoom tool call
- Fix inject ctl: submit as user message when agent is idle
2026-08-19 10:13:02 +02:00
Ollie Agent 94b4c4be3f Integrate OptMem wake into agent memory prompting 2026-08-18 14:01:18 +02:00
Ollie Agent 35c6ee6b44 Simplify file tool interfaces 2026-08-18 08:19:48 +02:00
Ollie Agent 9bd9539b6a Simplify file read ranges 2026-08-18 08:15:18 +02:00
Ollie Agent d90bd77fa0 Make file read integer arguments explicit 2026-08-18 08:07:59 +02:00
Levi Neely a17dd683df Split session/idx and agent/idx, fix sub-agent tree display
Server:
- session/idx now outputs: session-id, session-name, paused, connected, remote, cwd
- session/{s}/agent/idx now outputs: session-id, agent-id, agent-name, parent-id, depth, state
- Add error if parent agent not found during sub-agent spawn

GUI:
- refreshSessions() reads session index, then agent/idx per session
- Auto-select first top-level agent (depth 0) instead of first in list
- SessionModel tracks agent expansion separately from session expansion
- Agents with children show expand/collapse arrows and are collapsible
- Add hasChildren role to SessionModel

Tools:
- subagent_spawn now passes parent= argument for proper depth tracking
- Remove hardcoded max_depth=5, use server default of 1
- Makefile installs shell script tools from data/tools/

KRunner:
- Update to parse new session/idx format
2026-08-17 13:03:26 +02:00
Levi Neely 74ba5ae7ac remove maxSteps and ResetsCounter entirely
The step budget mechanism is gone. Agents run until they finish,
are interrupted by the user, or (for sub-agents) hit the timeout.

No replacement. The human is the kill switch.
2026-08-17 09:48:58 +02:00
Levi Neely da0ee4456f sub-agent guardrails: depth, parallelism, timeout
Enforce three limits on sub-agent spawning:
- depth (default 1): sub-agents cannot spawn their own sub-agents
- parallelism (default unlimited): cap concurrent children per parent
- timeout (default 600s): sub-agents are killed after 10 minutes

Top-level agents are never constrained by timeout.

Also: refactored parseAgentNewRequest to return a struct instead of
4 positional values. Added depth/activeChildren fields to Agent.
OLLIE_SUBAGENT_DEPTH env var set on sub-agents.

Deferred: remove maxSteps (replace entirely with timeout).
2026-08-17 09:37:59 +02:00
Ollie Agent 7182db56cf fix GUI dialog contrast and focus behavior 2026-08-16 23:55:43 +02:00
Ollie Agent f82b36ea80 Integrate OptMem memory backend 2026-08-16 11:10:50 +02:00
Ollie Agent e5eab98699 remove logseq tool 2026-08-16 10:42:05 +02:00
Ollie Agent 36649367eb remove obsolete process tools 2026-08-16 10:41:42 +02:00
Ollie Agent 8567ddaa36 replace file tools with Go binaries and add tests 2026-08-16 10:39:45 +02:00
Ollie Agent 929b94e34d Clarify workspace path placeholders 2026-08-16 10:30:56 +02:00
Ollie Agent 50e465336e Add Tree-sitter code intelligence tools 2026-08-15 21:13:40 +02:00
Ollie Agent 57427b5c93 Add web fetch Markdown tool 2026-08-15 20:32:28 +02:00
Levi Neely 617bb5586a subagent: inherit parent context via parent= parameter
Sub-agents now clone the parent agent's conversation history into
their initial context. The tool script passes parent=$OLLIE_UNAME
automatically. Mechanically identical to session restore — uses
RestoreHistoryFromMessages on the parent's Messages().
2026-08-14 15:12:16 +02:00
Levi Neely 961d5ca3bf remove subagent_generate: obsolete JIT profile mechanism 2026-08-14 14:56:05 +02:00
Levi Neely 165725fea8 subagent_spawn: rewrite to use 9P agent/new rdwr
Replace D-Bus fire-and-forget with blocking ollie-9p rdwr to
agent/new. The tool now:
- Blocks until the sub-agent completes
- Returns the sub-agent's reply directly
- Scope: read (multiple spawns run in parallel)
- Tier: hot

Removed: D-Bus dependency, session renaming, JIT config cleanup.
2026-08-14 14:55:17 +02:00
Levi Neely a1e78bca80 remove tool_load: use ctl directly
tool_load was a built-in intercept in the agent loop — the only
'tool' that didn't run in toolsrv. Removed entirely:
- Intercept in loop.go (25 lines)
- Script + .meta in data/tools/
- autoLoad references in agent configs

Loading tools is now exclusively via ctl (which already existed):
  echo 'tool_load X' | ollie-9p write .../ctl

System prompt updated to show the ctl pattern.
2026-08-13 21:44:46 +02:00
Levi Neely 83b0b59a0a prompts: remove /home/user path examples that bias tilde expansion
- file_grep.meta: replace /home/user/project with /abs/path
- system_prompt.md: use $XDG_CONFIG_HOME instead of ~
- agent-copilot.md: use relative path in code block example
2026-08-13 12:02:27 +02:00
Levi Neely 9bb3cd76b8 Remove sudo mechanism from bypass system
The sudo credential broker was never functional and added complexity
without value. This removes:

- Sudo field from bypass Request structs (broker, client, toolsrv)
- Sudo parameter from EvaluateRequest interface and implementations
- Sudo/ResetsCounter fields from MetaFile and Variant structs
- sudo: true from system_logs.meta variants
- All sudo documentation from writing-tools.md, tool-registry.md,
  core.md, evolution.md, and misc.md

Bypass remains fully functional for sandbox escapes. Tools that need
elevated privileges should handle that internally or be run manually.
2026-08-12 08:58:41 +02:00
Ollie Agent 97c208fa39 toolsrv: kill all procs on shutdown, add Pdeathsig
- KillAll(): sends SIGKILL to all running proc groups on clean shutdown
- Pdeathsig: SIGKILL ensures child procs die if toolsrv crashes
- Shell tool: use subshell + set +e for streaming without exit propagation
- Fix integration test to match new error format

This is the connection-based ownership model: toolsrv death = proc death.
The session owns the toolsrv process, so session death cascades to all procs.
2026-08-11 10:02:53 +02:00
Ollie Agent 0d1eeaa46b fix: background process lifecycle, streaming output, and connection deadlocks
- Timeout: timeout=0 means no deadline (was defaulting to 30s)
- Signal: send to process group (-pgid) not just process; SIGTERM no longer
  cancels context (only SIGKILL does); cmd.Cancel sends SIGTERM with 5s WaitDelay
- Streaming: background procs stream output in real-time via procWriter;
  shell tool no longer buffers all output into a bash variable
- Proc tree: olliesrv exposes proc/{id}/out, proc/{id}/ctl, proc/{id}/status
  as proper 9P directory (was broken flat file)
- Connection: proc handlers dial fresh toolsrv conn per request via
  Session.DialToolServer() to avoid deadlocking the agent's blocked conn
- Stat format: key=value (exited=true, exit_code=N, id=N) matching client parser
- GC: procs auto-removed 10min after LastRead (exited procs only)
- Rename: PID -> ID throughout (synthetic, not OS PID)
- Ctl commands: term (SIGTERM), kill (SIGKILL), signal <n>, dismiss
- System prompt: correct ollie-9p commands for proc management
2026-08-11 09:44:08 +02:00
Ollie Agent a098fbff0c agent: inject dispatch flags (bypass, timeout, sandbox, background) into all tool schemas
Dispatch-level flags are now injected into every tool's JSON schema
at runtime via injectDispatchFlags(). No need to declare them in
individual .meta files — they're universal.

Removed redundant declarations from shell.meta (now injected globally).
2026-08-11 08:26:14 +02:00
Ollie Agent 308ebbbd22 shell: add background flag to tool schema 2026-08-11 08:24:47 +02:00
Ollie Agent 2870da593d agent: default unset scope to global (safe by default)
Only tools that explicitly declare scope="write" get path-based
parallelism. Unset scope is now global (full barrier), avoiding the
"path is a lie" problem where a tool has a path arg but modifies
other files (e.g., lsp_rename).

Tools must opt in to parallelism:
- scope=read: never conflicts
- scope=write: conflicts on same path only
- scope=global (or unset): serialization barrier

Added scope=write to file_edit.meta and file_write.meta.
2026-08-11 07:57:22 +02:00
Ollie Agent 586edc1332 agent: replace ReadOnly with explicit scope field (read/write/global)
Rename ToolInfo.ReadOnly bool → ToolInfo.Scope string with three values:
- "read"  — path-scoped read, never conflicts (always parallel)
- "write" — path-scoped write, conflicts on same file path only
- "global" — full serialization barrier, runs alone

Tools declare scope in their .meta file. If unset, inferred from path
arg presence (write if path exists, global otherwise).

This correctly classifies lsp_rename as global (cross-file workspace
edits) despite having a path argument. The path arg in lsp_rename is
a symbol coordinate, not a resource scope.

All .meta files updated: readOnly:true → scope:read,
readOnly:false → scope:global, lsp_rename gets scope:global.
2026-08-11 07:56:00 +02:00
Levi Neely d292f2aa59 feat: make tool_load a built-in tool
tool_load must be handled specially by the agent runtime because tools
run inside toolsrv's sandbox and cannot load other tools into
themselves. The runtime now intercepts tool_load calls and directly
invokes ToolServer.LoadTool().

This is the only built-in tool - all others are external scripts.
2026-08-10 20:37:37 +02:00
Ollie Agent c7aea0db59 rename elevate→bypass throughout
The sandbox escape mechanism is a bypass, not privilege elevation.
The old name caused the agent to confuse it with sudo.

- elevate/ → bypass/ (package, types, tests)
- elevate_notify.go → bypass_notify.go
- Namespace: /elevate → /bypass, session/*/elevate → session/*/bypass
- Tool arg: "elevated" → "bypass"
- Env: OLLIE_ELEVATE_SOCKET → OLLIE_BYPASS_SOCKET
- File: elevate-policy.yaml → bypass-policy.yaml
- All docs, prompts, and scripts updated
2026-08-09 02:22:39 +02:00
Levi Neely e84b4ffef7 feat: add resetsCounter tool property to reset step budget on active progress
Tools like file_write, file_edit, and shell now reset the agent's step
counter when called successfully. This allows the agent to continue
working without hitting the soft step-budget guardrail as long as it's
making active progress (writing files, running commands) rather than
looping on research/reading.

Changes:
- Add ResetsCounter bool to ToolInfo and MetaFile structs
- Parse resetsCounter from .meta JSON files
- Reset step counter in agent loop when ResetsCounter tool succeeds
- Add resetsCounter: true to file_write, file_edit, shell
- Reduce maxSteps from 50 to 25 (resetsCounter makes this safe)
2026-08-07 17:13:14 +02:00
Ollie Agent d80a87eb86 clean up OLLIE_* env vars: replace with XDG conventions
- Remove all OLLIE_*_PATH vars (TOOLS_PATH, CFG_PATH, DATA_PATH, etc.)
  Use XDG_CONFIG_HOME/ollie/* and XDG_DATA_HOME/ollie/* instead
- Replace OLLIE_<TAG>_LOG per-component logging with single OLLIE_LOG={level}
- Replace OLLIE_USAGE_LOG with XDG_DATA_HOME-based path
- Replace OLLIE_OLLAMA_URL with standard OLLAMA_HOST (or omit entirely)
- Rename protocol markers: OLLIE_LISTEN_READY → ListenReady, OLLIE_9P_OPEN → Open
- Remove freeloader hooks from agent configs
- Update sandbox YAMLs to use XDG paths instead of OLLIE_*_PATH tokens
- Update shell tools to use $(dirname "$0") fallback instead of OLLIE_TOOLS_PATH
- Update docs and prompts accordingly
2026-08-07 07:11:53 +02:00
Ollie Agent fc0c368e91 Good idea fairy cleanup: ~960 lines removed
Phase 1:
- agent/hooks.go (entire hooks engine, 237 lines)
- backend/noop.go (unused test backend)
- backend/oneshot.go: Route/RouteRequest/RouteResult + /route 9P file
- cmd/ollie-9p/mount/ (FUSE mount, 336 lines)
- toolsrv/schema.go (ParseToolInfo, zero callers)
- toolsrv/discover.go: ToolPrompt/ReadTool (zero callers)
- agent/commands.go: CompactionSnapshot + history.go: PreCompactionSnapshot
- data/tools/route.meta + justfile route install

Phase 2:
- detach/process.go: stripped Signal(), Cmd field, unused imports
- SignalDetached reimplemented with syscall.Kill directly

24 files changed, 19 insertions, ~980 deletions
2026-08-05 21:51:55 +02:00
Ollie Agent 4ebcdf24b9 Remove dead data/tools/route (replaced by 9P /route file) 2026-08-05 19:45:58 +02:00
Levi Neely 9e07821c26 shell: always print exit code, even on success
Ensures tool output is never blank - at minimum shows 'exit: 0'.
2026-08-05 08:25:41 +02:00
Levi Neely cee5e9fefe remove D-Bus session management, 9P is the only control plane
- Remove OperationalModel function and OpModel prompt layer (dead code)
- Update session-9p.md: remove D-Bus preference mention
- Update desktop file: remove X-DBUS-* entries
- Update systemd service: remove dbus.service dependency
- Rewrite route, process_output, process_signal tools to use 9P

D-Bus is still used for:
- Desktop notifications (org.freedesktop.Notifications) for elevation prompts
- KDE tools (gui_windows, etc.) talking to KWin - not ollie's D-Bus
2026-08-05 08:20:04 +02:00
Ollie Agent eaf0a83a57 move LSP .meta files to live alongside their Go code
Each lsp_*.meta now lives in tools/lsp/cmd/<name>/ alongside
main.go, rather than in data/tools/. The lsp-tools just target
was updated to install both the binary and its .meta sidecar.

AGENTS.md updated to document the pattern for compiled tools.
2026-08-03 01:03:27 +02:00
Ollie Agent 7beef106e0 tool_load: add dynamic tool loader with bash script
Add a tool_load tool that writes a tool name to the session's 9P
tools file via ollie-9p, enabling on-demand tool loading.

Reduce autoLoad lists in default.json and theo.json to bare
essentials — everything else is loaded via tool_load.
2026-08-03 00:15:36 +02:00
Ollie Agent d3860304af Add formatted tool output fences 2026-08-02 22:57:17 +02:00
Ollie Agent e25157ffcd multiplex toolsrv, wip zero-tool server 2026-08-02 19:18:39 +02:00
Levi Neely 9f8a1130cf skills: replace built-in handlers with external shell scripts
skill_list and skill_load are now simple shell scripts that read
SKILL.md files from OLLIE_SKILLS_PATH. No built-in registry needed.
skill_load returns the file body as tool result (tier:hot, survives compaction).
skill_active dropped — model uses skill_list instead.
2026-07-31 16:42:49 +02:00
Levi Neely 1c7087d0bf logseq.meta: full API documentation with all commands and args 2026-07-31 15:08:46 +02:00
Levi Neely 0790dc7e4e logseq tool: use REST API instead of broken MCP endpoint
Logseq 2.0.1 has bug #12413 where POST /mcp always returns 400.
Switched to the REST API at POST /api which works correctly.
Requires OLLIE_LOGSEQ_TOKEN env var.

Commands: listPages, getPage, searchBlocks, listTags, listProperties,
upsertNodes, getCurrentGraph
2026-07-31 15:07:40 +02:00
Levi Neely c75dc6f6c7 add logseq tool: query/modify Logseq DB graph via built-in MCP server
- data/tools/logseq: Python wrapper (same pattern as atlassian_cli)
- data/tools/logseq.meta: tool metadata with full prompt
- data/scripts/logseq-cli: shell bridge using mcp-to-command + mcp-remote
- justfile: install logseq tool + logseq-cli script

Commands: listPages, getPage, searchBlocks, listTags, listProperties, upsertNodes
Transport: streamable-http to http://127.0.0.1:12315/mcp (Logseq 2 DB built-in)
2026-07-31 15:01:20 +02:00