Commit Graph

2654 Commits

Author SHA1 Message Date
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
Ollie Agent 263ea51d29 restored autoload tools 2026-08-20 19:07:27 +02:00
Ollie Agent 3f8c8df38a Improve workflow-aware tool ranking 2026-08-20 19:01:21 +02:00
Ollie Agent d33549eca1 Document one-tool capability bootstrap 2026-08-20 18:31:31 +02:00
Ollie Agent 4bf46ae85d Load hinted tools through the agent namespace 2026-08-20 18:29:10 +02:00
Ollie Agent 28c76a76d4 Record architecture over prompting lesson 2026-08-20 17:45:29 +02:00
Ollie Agent a0636b88aa Document lessons from embedding discovery 2026-08-20 17:44:40 +02:00
Ollie Agent f407fa2604 Move embedding discovery to evolution log end 2026-08-20 17:42:54 +02:00
Ollie Agent ba91920a88 Document embedding discovery architecture 2026-08-20 17:41:56 +02:00
Ollie Agent 7bf9b6da9b Document embedding-guided discovery architecture 2026-08-20 17:38:13 +02:00
Ollie Agent bb6df3a073 Hide context blocks in KDE chat 2026-08-20 17:34:53 +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 ade1092fab prompts: clarify skill_list() must be called, not grepped 2026-08-20 14:10:24 +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 ec6db39722 toolclient: add tools/ dir to toolsrv search path 2026-08-20 13:23:50 +02:00
Levi Neely a23ff15d5c prompt: require exhausting tools/skills before giving up
Add explicit guidance to Autonomous Operation section:
- New unacceptable behaviors: giving up before checking skill_list or trying to load tools
- New checklist: must check skills, try loading tools, attempt even uncertain options before reporting failure
2026-08-20 12:19:23 +02:00
Levi Neely 4750966048 toolsrv: auto-load tools on first use
When an agent calls a tool that exists but isn't loaded, toolsrv now
automatically loads it instead of returning an error. This eliminates
the round-trip of a separate load call.

- Remove Registry.Exists() (superseded by auto-load logic)
- Fire OnToolsChanged callback after auto-load so olliesrv can update
  tool definitions for subsequent turns
2026-08-20 12:16:01 +02:00
Levi Neely b1a59e3e84 tweak user prefs 2026-08-20 12:07:28 +02:00
Levi Neely 7f9ff18132 chat: strip <context>...</context> blocks in filtered output
chat.raw includes everything; chat strips:
- [[[...]]] markers
- fence delimiters
- <context>...</context> blocks (user prompts)

Text clients get clean output; GUI clients use chat.raw for full control.
2026-08-20 12:01:45 +02:00
Levi Neely c602238835 agent: wrap user prompts in <context> tags for rendering 2026-08-20 11:59:15 +02:00
Levi Neely 013a669e9d build: simplify Makefile, add uninstall target
Reduced from 18 targets to 10:
  all, build, go, tools, kde, install, install-data, test, clean, uninstall

Key changes:
- Build to build/ dir first, install only after tests pass
- Merged ninep+core into 'go' (builds olliesrv, ollie-9p, toolsrv)
- Removed build-kf5/install-kf5/kde-kf5 (cmake auto-detects)
- Merged test-core+test-9p into 'test'
- Removed 'client' target (lib9p now built by cmake as custom command)
- Added 'uninstall' target

CMakeLists.txt changes:
- lib9p built via add_custom_command instead of requiring pre-built .so
- add_dependencies ensures lib9p built before KDE targets need it
2026-08-20 11:56:00 +02:00
Levi Neely aad9c4f6e5 agents: move user-preferences to userPrompts
user-preferences.md is meant to be prepended to every user message,
not part of the system prompt. Moved from 'prompt' to 'userPrompts'
in: author, conductor, default, foreman, panelist, reviewer.

Other agents already had it in the correct location.
2026-08-20 11:48:10 +02:00
Levi Neely 468887a9c1 prompts: concrete skill triggers, no vague 'confidence' 2026-08-20 11:14:52 +02:00
Levi Neely 31b9b13286 prompts: load skills BEFORE guessing
Expanded skills section:
- Explicit 'when to load' triggers (unfamiliar API, guess didn't work,
  specific domain, unfamiliar system)
- Bold directive: 'Load skills BEFORE guessing. One skill load beats
  five failed attempts.'
- 'Skills are cheap; failed attempts are expensive.'
2026-08-20 11:14:16 +02:00
Levi Neely da872e51f3 prompts: call tools, don't just mention them
Added explicit unacceptable behaviors:
- Mentioning a tool without calling it
- Acknowledging a tool exists but not using it

Added bold statement: 'Knowing a tool exists is not the same as using it.
Your response should contain tool calls, not descriptions of tools you
could call.'
2026-08-20 11:13:37 +02:00
Levi Neely fe9d39a142 prompts: explicit WRONG/RIGHT examples for tool vs shell
Agents were using shell to invoke tools (cat, grep, ollie-9p) instead of
calling the actual tools. Added unmistakable WRONG/RIGHT code blocks
showing the correct pattern. Shell is ONLY for git, make, npm, etc.
2026-08-20 11:09:50 +02:00
Levi Neely ce8287e3ea prompts: aggressive autonomous operation directives
Rewrote system prompt to enforce immediate tool use:
- New 'Autonomous Operation' section: act first, report results
- Explicit list of unacceptable behaviors (narrating intentions, asking
  permission for routine ops, producing text when tools should be called)
- Tools section: 'Use them without hesitation', concrete examples
- Skills section: 'if the task needs it, load it' — no asking
- Stronger sub-agent prefix: 'Do NOT respond with a plan. Call tools.'
2026-08-20 11:06:24 +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 24621294b0 kde: use embedded octopus icon directly, not fromTheme
QIcon::fromTheme("ollie") was finding a stale brain SVG at
/usr/share/icons/ instead of the octopus. Now the app uses the
embedded resource for both window icon and systray, and sets
app.setWindowIcon() explicitly.

Also fixed the .desktop file to use the theme name 'ollie' instead
of a hardcoded absolute path.
2026-08-20 08:59:04 +02:00
Ollie Agent 19971be343 Support runtime backend switching via ctl 2026-08-19 20:06:20 +02:00
Levi Neely 5a8f7e394e Fix session settings not populating: use baseName not displayName
killTargetSessionName was set to item.name (displayName, e.g. 'ollie (1)')
instead of item.baseName (the actual 9P path component 'ollie').
This caused readSessionConfig() to read from a non-existent path.
Also fixes the Goal dialog which had the same latent bug.
2026-08-19 18:15:20 +02:00
Levi Neely a7b8c4c2ce Add 'none' workflow option as the default (no-op on goal set)
- Workflow() no longer defaults to 'conductor' when empty
- runWorkflow() returns immediately for '' or 'none'
- 'none' listed first in the workflows file output
- QML dropdowns default to 'none' instead of 'conductor'
- C++ fallback uses 'none' when server unreachable
2026-08-19 18:09:09 +02:00
Levi Neely 9f1aec1384 Add session settings dialog (edit mode for NewSessionDialog)
- Add session-level cfg file (read: name/cwd/remote/workflow/variant/yolo;
  write: workflow, variant, cwd)
- Add readSessionConfig() and updateSessionConfig() to C++ client
- NewSessionDialog supports editMode: pre-populates fields from session cfg,
  title becomes 'Session Settings', button becomes 'Save'
- Name and Remote fields disabled in edit mode (non-reconfigurable)
- YOLO checkbox hidden in edit mode
- Only changed values are written back on save
- Add 'Settings...' to session context menu in SessionTree
- Wire sessionSettingsRequested signal through to dialog
2026-08-19 18:07:25 +02:00
Levi Neely 620cd6c66e Split workflow/variant into two dropdowns in NewSessionDialog
- loadWorkflows() parses tab-separated 'name<TAB>variants' format
- Add variantsForWorkflow() to return variant list for a workflow
- Add m_workflowVariants map to cache per-workflow variant lists
- createSession() accepts variant parameter, passes to server
- QML: separate Workflow and Variant ComboBoxes
- Variant dropdown repopulates on workflow selection change
- 'default' always present; non-default variants pass through to launcher
2026-08-19 18:01:36 +02:00
Levi Neely 5fdd80c26c Implement workflow variants system
- runWorkflow accepts a variant parameter; sources {workflow}-{variant}.conf
  as env vars before exec'ing the script
- Session stores variant; persisted and restored
- session/new accepts variant= parameter
- 'run' ctl command accepts optional variant as second arg
- workflows file now lists variants: name<TAB>default,variant1,...
- review workflow reads AUTHOR_PROFILE/REVIEWER_PROFILE env vars
- Add review-code.conf and review-writing.conf example variants
2026-08-19 17:57:22 +02:00
Levi Neely 59f729f591 Add review workflow: iterative author/reviewer refinement loop 2026-08-19 17:41:24 +02:00
Levi Neely 42685e1e93 docs: add Phase 34 (peers + consensus) to evolution.md 2026-08-19 17:32:33 +02:00