Commit Graph

63 Commits

Author SHA1 Message Date
Levi Neely 6c26f15840 o: support root-relative paths with leading /
Paths starting with / are treated as root-relative, ignoring
the current context prefix. This allows accessing root-level
files/directories even when in a session or agent context.

Example: o myproj/coding ls /bypass  # list root bypass/ dir
2026-08-10 13:47:10 +02:00
Levi Neely d621e7322a o: use session/agent slash syntax for context
Simplify context parsing:
- o <cmd>                   Root level
- o <session> <cmd>         Session level
- o <session>/<agent> <cmd> Agent level

The slash disambiguates between session and agent context,
eliminating the need for 'session' and 'agent' keywords.

Examples:
  o myproj ls               # session level
  o myproj/coding prompt    # agent level
2026-08-10 13:40:26 +02:00
Levi Neely 14a52236c8 o: hierarchical context selectors
Refactor o CLI to use explicit context selectors:
- o <cmd>                       Root level
- o session <sname> <cmd>       Session level
- o agent <sname> <aname> <cmd> Agent level

Environment variables $session and $agent can substitute for
positional args for backwards compatibility.

Update acme scripts to use new interface:
  o agent $OLLIE_SESSION $OLLIE_AGENT prompt
2026-08-10 13:37:29 +02:00
Levi Neely 6937dda94a acme: auto-create session/agent like kate plugin
Add acme-ollie-ensure helper that:
- Creates 'acme' session if it doesn't exist
- Creates agent named by cwd hash (like kate's approach)
- Updates agent cwd if it already exists

All acme commands now call acme-ollie-ensure before sending
prompts, so they work without manual session setup.
2026-08-10 11:37:38 +02:00
Levi Neely e667689729 Revert "acme: use o generate instead of o prompt"
This reverts commit 9d7230452c.
2026-08-10 11:36:08 +02:00
Levi Neely 9d7230452c acme: use o generate instead of o prompt
One-shot generation doesn't require session/agent context.
2026-08-10 11:33:57 +02:00
Levi Neely abbd718e6a acme: add ollie integration commands
Add acme scripts for interacting with ollie:
- AskFile: describe the current file
- Explain: explain selected code
- Document: add documentation comments
- Fix: fix selected code
- Refactor: refactor selected code
- AddTests: write unit tests for selection
- SendVerbatim: send selection as-is

Scripts use the acme 9P filesystem to read selections and pipe
prompts to ollie via 'o prompt'.

Also update justfile to install/uninstall the acme scripts.
2026-08-10 11:29:59 +02:00
Levi Neely 46524d37dd kiro: wire session CWD through to EnvState; o: add new command
- backend: add CWD field to GenerationParams for environment state
- kiro: pass session CWD to kiroCurrentEnvState instead of hardcoded '/'
- agent/runtime: set GenParams.CWD from session cwd in BuildRuntime
- o new: create sessions and agents via 9P filesystem
- o prompt: support piped stdin for non-interactive use
2026-08-10 09:10:13 +02:00
Ollie Agent 25924d0909 fs: add /help ctl command — returns command reference 2026-08-09 03:32:21 +02:00
Ollie Agent cbfc08875b fs: unify ctl — all levels use rdwrHandler + rdwrDispatch
Root, session, and agent ctl files all share the same dispatch
mechanism: rdwrHandler map → rdwrDispatch → Request (rdwr).

- ctlHandler/ctlDispatch (write-only) removed
- Root and session ctl upgraded to Request (rdwr), return 'ok'
- systemprompt moved to agent ctl command
- nopRead removed (dead)
2026-08-09 02:58:09 +02:00
Ollie Agent 993d5a812a fs: move tools to ctl commands, remove tools file
/tools        — lists loaded tools
/tool_load X  — loads a tool by name

System prompt updated to instruct the agent to use ctl for tool
management instead of writing to a tools file.
2026-08-09 02:52:06 +02:00
Ollie Agent 94088ccc94 fs: move cwd to ctl command, remove cwd file
/cwd returns current directory, /cwd X changes it (with stat check).
One fewer file in the agent namespace.
2026-08-09 02:48:50 +02:00
Ollie Agent 2561e01574 fs: move per-agent models to ctl command, remove models file
/models now lists available models for the agent's backend via ctl.
One fewer file in the agent namespace. The root-level models file
(all backends) remains unchanged.
2026-08-09 02:47:26 +02:00
Ollie Agent c05f4d1ef0 fs: agent ctl becomes rdwr (request-response)
The ctl file is now a Request handler: write a command, read the
response. Commands with no args return current state:

  /model        → prints current model
  /agent        → prints current profile
  /cwd          → prints working directory
  /name         → prints agent name
  /model X      → switches model, returns new model
  /compact      → compacts, returns 'ok'

o ctl now uses 'ollie-9p rdwr' to get the response.
This enables /model (no args) to show the current model from
any frontend.
2026-08-09 02:44:21 +02:00
Ollie Agent a4e5f7c9c5 unify commands: / == o ctl, all operations are ctl commands
The slash prefix in prompts now routes directly to the agent's ctl
file. No special-cased commands in the agent — the ctl handler is the
single command surface:

  /stop, /compact, /clear, /model X, /inject X, /agent X, /cwd X

New ctl commands:
  inject <text>  — overwrites any pending inject (replaces /i and /irw)
  agent <name>   — switch agent profile (moved from commands.go)

Agent methods added: Compact(), Clear(), SwitchProfile() — called by
the ctl handler, testable independently.

HandleCommand is now a thin trampoline: strip /, run 'o ctl <rest>'.
commands.go reduced from 155 to 50 lines.

REPL: / → o ctl, !q/!quit → exit TUI.
2026-08-09 02:40:48 +02:00
Ollie Agent 1bc438771f agent: replace 12 slash commands with ! prefix
! runs 'o' with session/agent context, giving access to the entire
namespace from any frontend (TUI, GUI, Emacs). Examples:
  !ctl compact       — compact context
  !ctl stop          — stop agent
  !read stats        — show usage/cost/ctxsz
  !read models       — list models

Kept: /i (inject mid-turn), /irw (rewrite inject), /agent (profile switch).
Removed: /backend, /models, /model, /maxsteps, /agents, /compact,
/context, /cost, /usage, /history, /clear, /sp.

Also simplified the o prompt REPL: slash commands reduced to /i and
/quit. Everything else via !<cmd>.

Dead code removed: contextDebug() in history.go.
2026-08-09 02:33:03 +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
Ollie Agent d1907adfae o script: audit cleanup
- Merge readloop into read -l (loop mode)
- Remove chatstream command (TUI uses 'o read chat' directly)
- Rework ctl: o ctl <cmd> [session] [agent] — dispatches to
  session ctl for kill/pause/resume, agent ctl for the rest
- Add trap EXIT to kill background statewait loop (fixes zombie)
- Remove -1 compatibility flag from generate
- Remove no-op bracketed paste bind from prompt REPL
- Fix /i help text: 'inject prompt (mid-turn or queued)'
- Update all help text to reflect current commands
2026-08-09 02:15:48 +02:00
Ollie Agent 49c93eab5f remove usage_log.go (write-only telemetry), clean AGENT_FILES
- Delete agent/usage_log.go — wrote JSONL to disk but nothing read it
- Remove appendUsageLog call from turn.go
- Remove dead 'offset' from AGENT_FILES tab-completion list
- TUI: grep markers+fences from o log (single read, not streaming)
2026-08-09 02:03:51 +02:00
Ollie Agent 72db6d900d fs: namespace cleanup — merge and remove dead files
- fifo.in + fifo.out → single fifo (write enqueues, read dequeues)
- cost + usage + ctxsz → single stats (key=value lines)
- Remove connection (no consumers, heartbeat handles it)
- Remove dead prevPrompt field and write (prompt.prev gone from spec)
- Clean AGENT_FILES: remove state, context, tail (all already absent
  from spec, were only in the tab-completion list)
2026-08-09 01:57:41 +02:00
Ollie Agent 744f775eb5 fs: split chat into chat (filtered text) and chat.raw (full markup)
chat — strips [[[...]]] markers and source fences at the byte level.
Partial lines pass through immediately for true streaming. Terminals
and text editors use this.

chat.raw — full block-structured stream with markers and fences.
GUIs that parse blocks (KDE, web) use this.

The TUI no longer pipes through grep (which was line-buffering and
killing char-by-char streaming since Aug 4).

The stripMarkers state machine processes each chunk from the server:
- Complete lines starting with [[[ and ending with ]]] → dropped
- Fence lines (```...) → dropped (open toggles in-fence state)
- Partial lines (no trailing \n) → always emitted immediately
- Everything else → passed through
2026-08-09 01:43:39 +02:00
Ollie Agent 2c5444e902 o: /agent with no args shows current agent profile 2026-08-08 23:07:54 +02:00
Ollie Agent b5404fff87 o: /cwd with no args shows current working directory 2026-08-08 23:07:26 +02:00
Ollie Agent cf1866d646 o: /model and /backend with no args show current value 2026-08-08 23:04:33 +02:00
Ollie Agent 79afb09f3d o: fix /i command — was sending double-slash to prompt
$line still had the leading / from input, so echo "/$line" sent
//i ... to the agent. Use $cmd (which has the / stripped) instead.
2026-08-08 23:00:59 +02:00
Levi Neely 07ec63704e o prompt: drop readline for paste support
Switch from 'read -e' to plain 'read' so multi-line paste can be
captured. Readline was consuming pasted lines individually.
Increase drain timeout to 100ms.
2026-08-07 17:46:35 +02:00
Levi Neely 189ec65aae o prompt: buffer multi-line paste input
Drains additional lines within 50ms of the first line to capture
multi-line pastes in the TUI prompt.
2026-08-07 17:44:05 +02:00
Levi Neely 8397f1aa74 o: add log command, rename tail to chatstream
- Add 'o log [-n N]' to read last N lines from agent log (default 1000)
- Rename 'o tail' to 'o chatstream' for clarity
- Update TUI to show log history before streaming chat
2026-08-07 17:34:33 +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
Levi Neely 54c6bc3ed2 update kde submodule pointer; whitespace cleanup in data/scripts/o 2026-08-06 14:06:14 +02:00
Ollie Agent 2e14d2e93b Add o complete and o route subcommands, update table 2026-08-05 19:20:52 +02:00
Ollie Agent 5ab073ebdb fix resolve_context unbound variable when no args 2026-08-04 19:54:48 +02:00
Ollie Agent 0694f47376 o: add trailing session/agent args to prompt, tail, stop, kill, ctl 2026-08-04 19:45:17 +02:00
Ollie Agent f1611fb50b o tui: clear prompt pane before entering REPL 2026-08-04 19:41:14 +02:00
Ollie Agent a5510a7a2b o tui: accept [session] [agent] positional args 2026-08-04 19:40:39 +02:00
Ollie Agent 3a8e3f3c63 o prompt: add /i and /info to inspect agent state 2026-08-04 19:29:57 +02:00
Ollie Agent 8ffbf3b699 o prompt: use . as send trigger, empty lines add newlines 2026-08-04 18:56:47 +02:00
Ollie Agent 19a96ab2de o prompt: fix readline line editing with ANSI prompt
Wrap bold escape sequences in \001/\002 markers so readline
correctly tracks cursor position. Fixes Ctrl+U, Ctrl+W, and
other readline kill commands after typing several characters.
2026-08-04 18:56:19 +02:00
Ollie Agent e375126adf o tui: clear chat pane before tail 2026-08-04 18:54:16 +02:00
Ollie Agent cd18539280 o tui: add /quit and /q slash commands 2026-08-04 18:53:01 +02:00
Ollie Agent 0923633624 o tui: remove shell pane, replace state pane with tmux status bar 2026-08-04 18:52:01 +02:00
Levi Neely 0f29757dac o: add generate command for one-shot prompts
Uses /generate 9P file - no session/agent context needed.
Example: o generate 'explain monads'
2026-08-04 17:25:17 +02:00
Levi Neely 59fb7d5561 o tui: use percentage-based layout instead of fixed sizes
- Right column: 25% width
- State/shell: 50/50 split
- Prompt: 20% height
- Adapts to terminal size
2026-08-04 17:09:53 +02:00
Levi Neely 77d589f98b o tui: filter out [[[...]]] block markers from chat stream 2026-08-04 17:05:52 +02:00
Levi Neely abdc91d097 remove mount/ package references and ollie-watchdog
- mount/ package no longer exists, remove from build/test rules
- remove ollie-watchdog script (unused)
- keep ollie-remount (still needed for FUSE recovery)
2026-08-04 16:58:44 +02:00
Levi Neely 05517c384a o: simplify path resolution, remove auto-session/agent
- Remove auto-resolution of session/agent (was slow, unexpected)
- Path classification determines required context level immediately
- Errors are fast and actionable with clear fix instructions
- Root-level paths work without any context
- o env now just prints export statements without requiring context
2026-08-04 16:57:01 +02:00
Levi Neely 7189a9fc24 scripts: add 'o write' subcommand 2026-08-03 12:48:08 +02:00
Levi Neely 8f09aa2060 scripts: enable readline in prompt REPL (read -e)
Supports C-a, C-e, C-u, C-k, M-b, M-f, arrow keys, etc.
Sent prompts and slash commands are added to readline history
so up-arrow recalls previous inputs.
2026-08-03 10:09:32 +02:00
Levi Neely 62cfc06a88 scripts: rename blkread → readloop 2026-08-03 10:07:54 +02:00
Levi Neely e726599f84 scripts: add 'o blkread' — blocking read loop for statewait et al 2026-08-03 10:07:10 +02:00