Commit Graph

70 Commits

Author SHA1 Message Date
Levi Neely 415d75c97f freeloader: exhaust full model pool before giving up; fix resubmission and stream newlines
- scripts/x/freeloader: track tried models per-session in freeloader-tried-$SID;
  walk the full sorted :free pool in order before exiting 1; write recovery
  prompt to fifo.in (not prompt) to avoid goroutine race
- core submodule: 404 tool_unsupported detection + FIFO drain on error
- tui submodule: fix mid-stream newlines from backgroundTail chatOff race

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-28 18:47:57 +02:00
Levi Neely 15df9eeb1a freeloader: turnError-driven free model cycling with blacklist
- scripts/x/freeloader: hook-driven script; intercepts rate_limit and
  tool_unsupported on :free models; auto-blacklists on tool_unsupported;
  cycles to next non-blacklisted free model; exits 1 for unhandled errors
- agents: add turnError hook to all agent configs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-28 17:17:56 +02:00
Levi Neely 84e7b29015 agents: inline bd prime conditional; simplify task dispatcher
Replace 'task prime' hook with inline .beads walk in all agent configs —
no wrapper script needed. Drop 'prime' subcommand from scripts/x/task.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 12:31:34 +02:00
Levi Neely b7f6b08e6a task: session plan checklist; replace todo.sh fallback
- tools/task_add, task_check, task_clear: manage s/{sid}/plan markdown checklist
- prompts/tools-task.md: agent command reference, injected at spawn via prime tools-task
- agents: add 'prime tools-task' to agentSpawn in all configs
- scripts/x/task: show_plan() on 'task list'; drop todo.sh fallback (wrong tool)
- prompts/tools-todosh.md: removed (no longer needed)
- prompts/tools-subagent.md: add coordination model documentation
- core: update submodule ref (s/{sid}/plan 9p endpoint)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 12:30:14 +02:00
Levi Neely 1a01002f7b planning: observe step, task dispatcher, tool parallel annotations, graceful degradation
- agents: agentSpawn uses 'task prime', postTurn uses 'task list' (observe step)
- scripts/x/task: dispatcher routes to bd (beads) or todo.sh based on availability
- prompts/tools-todosh.md: prime context for todo.sh fallback
- tools: add '# ollie:parallel read' annotation to file_read, file_glob, file_grep,
  file_grep, memory_recall, reasoning_think, denote_view
- core: update submodule ref

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 09:00:54 +02:00
Levi Neely 2f8d18dc51 elevate: auto-start adapter via agentSpawn hook
Add x/elevate-adapter-start: checks if the adapter is already listening
(connect test), starts it in the background if not. Exits 0 always so it
never blocks session startup. Wire it into agentSpawn in all agent configs
and install it via mkfile.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 11:54:29 +02:00
Levi Neely 778af112db fix: strip script dir from sys.path before imports in x/ Python scripts
Python adds the script directory to sys.path[0] at startup and tries to
create a FileFinder for it. When the script lives on a 9P FUSE mount the
FileFinder init fails before any stdlib import can succeed. sys is a
builtin and loads without filesystem access, so strip the path first.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 11:49:03 +02:00
Levi Neely 16d4fc57ff elevate: default socket to XDG_RUNTIME_DIR, add to sandbox env
Both x/elevate and elevate-adapter-superpowerd now default the socket
path to $XDG_RUNTIME_DIR/ollie/elevate.sock (falling back to
/run/user/<uid>/ollie/elevate.sock) when OLLIE_ELEVATE_SOCKET is unset.
Add OLLIE_ELEVATE_SOCKET to env sections of both sandbox configs.
Add {XDG_RUNTIME_DIR}/ollie to restricted sandbox filesystem rw rules
so x/elevate can reach the socket. Update README env block and
scripts/README socket path docs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 11:43:24 +02:00
Levi Neely 7a88fb3437 implement generic x/elevate with socket broker pattern
x/elevate is now a generic client: reads OLLIE_ELEVATE_SOCKET, sends
{cmd,cwd}, reads back {stdout,stderr,exit_code}. All backend-specific
logic moves to adapters. Add elevate-adapter-superpowerd as the
reference adapter: owns the socket lifecycle, translates the ollie
protocol to superpowerd JSON-RPC ExecuteCommand. Add OLLIE_ELEVATE_SOCKET
to env docs. Update scripts/README.md with protocol spec, adapter
setup, and guide for writing custom adapters.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 11:41:54 +02:00
Levi Neely 1de43c1105 docs: reframe x/elevate as sandbox escape hatch, not privilege escalation
The purpose is to run steps outside the Landlock sandbox, not to gain
privileges. Clarify the constraint (kernel-enforced, must reach an
external process), reframe the minimal example and superpowerd walkthrough
accordingly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 11:33:22 +02:00
Levi Neely 2eefe5a01d docs: correct custom elevation backend section
sudo/doas don't work: Landlock is kernel-level and applies regardless
of user privileges within the sandboxed process. The backend must hand
the command to a process spawned outside landrun entirely. The
superpowerd Unix socket pattern is the right model.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 11:32:09 +02:00
Levi Neely 8700373c63 docs: remove incorrect session token injection paragraph
x/elevate handles token acquisition itself via the re-exec through
superpowers run-session when SUPERPOWERD_SESSION_TOKEN is absent.
No manual injection is needed; the paragraph was wrong.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 11:30:13 +02:00
Levi Neely 0eaa4dc8eb docs: remove broken superpowerd link, treat as hypothetical
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 11:26:37 +02:00
Levi Neely 61491ce786 docs: expand x/elevate with full backend setup guide
Document the plugin interface contract (args, cwd, stdout/exit code),
plugin path resolution (OLLIE_PLUGINS_PATH / ~/.config/ollie/scripts/x/),
a minimal exec-only example, a step-by-step walkthrough of the default
superpowerd implementation including session token injection, and custom
backend examples (sudo, doas, disable).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 11:23:47 +02:00
Levi Neely df651908c4 docs: document x/ namespace and x/elevate in scripts/README.md
Add x/ to the namespace list and add an x/elevate section describing
its role as the elevation plugin for execute_code elevated steps, the
calling convention, the default superpowerd implementation, and how to
replace or disable it.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 11:22:29 +02:00
Levi Neely 2148c8c668 update docs: unify b/ into s/, introduce s/bfg and s/bbg
Batch and session namespaces are now a single s/ concept. s/bfg blocks
until the agent finishes and writes to stdout; s/bbg returns immediately
and prints the session path. s/b is the core one-shot runner. Remove all
b/ references from README, USAGE, ARCHITECTURE, and scripts/README.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 08:31:15 +02:00
Levi Neely dfabeab4a8 sh: fix is_idle for multi-word state values 2026-04-24 15:39:42 +02:00
Levi Neely a232925745 sh: multi-line input with C-j/C-m via readmulti 2026-04-24 15:38:38 +02:00
Levi Neely 963210ea6e scripts/s/sh: replace line with awk; remove sh.rc 2026-04-24 15:29:42 +02:00
Levi Neely e4b78b705a s/cleanup: kill idle sessions instead of removing done batch jobs
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 09:18:31 +02:00
Levi Neely 9e26eb0375 s/b: poll for session directory after creation
FUSE entry cache may not reflect the new session directory immediately
after the write to s/new returns. Poll until it appears, mirroring the
approach in s/sh.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 09:17:41 +02:00
Levi Neely 00155f28fc s/b: write s/new as single write() to avoid partial-KV parse failure
Bash's printf builtin issues one write() syscall per call; the server
processes each write independently, so the first write (name= only)
would fail the cwd-required check. Build the full KV string first,
then write once.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 08:48:58 +02:00
Levi Neely b3e0367078 fix s/bfg and s/bbg: reference s/b not s/job
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 08:44:48 +02:00
Levi Neely 57d164310c remove batch jobs; rename spec -> cfg; s/job -> s/b, s/q -> s/bfg, s/sched -> s/bbg
Batch jobs were a front-end concern. All one-shot query workflows now
compose session primitives via s/b (engine), s/bfg (foreground), and
s/bbg (background). Parallel execution is a shell loop.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 08:42:38 +02:00
Levi Neely 127e518dae frontends: update to spec file; remove individual session file reads
tui/session: IsIdle reads spec and parses state= key.
scripts/s/sh, sh.rc: add spec_get helper; is_idle, /cwd, /model,
/agent, /backend read via spec_get; writes go to spec as key=value.
el/ellie.el: ellie--state reads spec with string-match on state=.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 07:43:10 +02:00
Levi Neely f4c340c2cb unify s/ and b/ namespaces: batch jobs now live under s/
Option C implementation: single namespace with composable file tables.
Batch jobs are sessions with a reduced file set — the directory
contents declare the capability.

- core: SessionStore absorbs BatchStore; s/new detects batch format
- 9p: /b/ removed entirely; all routing through /s/
- scripts/b/* moved to scripts/s/*; paths updated
- subagent_spawn, optimize: /b/q -> /s/q
- scripts/b/ removed
2026-04-23 18:50:05 +02:00
Levi Neely 5457e3ba43 scripts/s/sh: port from bash to rc shell
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-20 20:29:30 +02:00
Levi Neely 2a741f50eb Fix s/sh display synchronization issue
Simplify the script to fix the timing/display problem where LLM responses
weren't shown in real-time and user typing wasn't echoed properly.

The fix:
1. Block on statewait file until agent leaves idle state
2. Stream chat output in loop while agent is not idle
3. Use simple tail -c +offset to read new chat content
4. Remove complex buffering logic and background processes

This resolves the issue where assistant responses would appear one prompt
late and user typing wasn't visible during LLM response generation.
2026-04-19 21:55:06 +02:00
Levi Neely d37f23da39 b/q: accept piped stdin 2026-04-19 21:19:49 +02:00
Levi Neely 3bc6785230 scripts,docs: batch status→state; use statewait in b/job and b/cleanup
b/job now blocks on statewait instead of polling; b/cleanup reads state.
Update all documentation references. Bump 9p submodule.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 20:45:08 +02:00
Levi Neely 748337571f scripts/s/sh: statewait, stdin pipe, startup tail; bump tui
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 17:20:20 +02:00
Levi Neely e23c79c713 docs,prompts,scripts,tui,el: rename enqueue/dequeue to fifo.in/fifo.out; add *wait docs; bump submodules
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 16:11:19 +02:00
Levi Neely 8d870001bc prompts: migrate to hook-based priming via prime script
Remove Go template syntax from all prompt files (converted to envsubst
variables in prior commits). Agent agentSpawn hooks now call prime for
each prompt file explicitly, replacing the automatic Go-based directory
scan. coding agent gets 08_tool-elevate; default does not.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 12:10:26 +02:00
Levi Neely acc791cbda scripts: add prime wrapper for agentSpawn prompt injection
prime <name> prints $OLLIE/p/<name>[.md] to stdout, which the agentSpawn
hook captures as context. Allows agent prompt composition to be driven
entirely from hook config rather than built-in Go code.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 12:03:28 +02:00
Levi Neely 6ca864de19 scripts: fix bd wrapper path (.local/bin/bd not .local/bd)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 11:25:38 +02:00
Levi Neely 2d3d17237b tools,scripts: use -e not -d for .git boundary check
Submodules have .git as a file, not a directory. -d was stopping the
walk immediately in submodule directories.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 11:20:34 +02:00
Levi Neely a960566ec9 tools,scripts: bound .beads walk-up at .git boundary
Walk up from CWD only while .git exists at each level. Stops at the
first directory without .git, preventing false positives outside the repo.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 11:18:08 +02:00
Levi Neely 78cd60581d scripts: add bd wrapper to x/; prepend $OLLIE/x/ to PATH in execute server
The bd wrapper walks up from CWD to find a .beads directory and sets
BEADS_DIR, so bd works from any subdirectory of a monorepo without the
model needing to know about it.

The execute server now always prepends $OLLIE/x/ to PATH for tool
subprocesses, so wrappers placed there shadow system binaries transparently.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 11:07:15 +02:00
Levi Neely 8a82d0966b elevation: add x/elevate plugin; update mkfile and docs
Replace tools/elevate_superpowers with scripts/x/elevate — a single
self-contained plugin that bootstraps into a superpowers session and
runs the IPC. mkfile installs it to ~/.config/ollie/scripts/x/.
Update 08_tool-elevate.md to remove backend-specific language.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 20:50:37 +02:00
Levi Neely 4202505704 elevation: add elevate_superpowers tool; remove frontend env injection from s/sh and submodules
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 20:07:10 +02:00
Levi Neely c06fed4503 env: inject session env via s/{id}/env; works on new and resumed sessions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 19:20:03 +02:00
Levi Neely ed2316c2d0 env: session-scoped env via -e flag; remove daemon-global env export
- s/sh: add -e VAR1,VAR2 flag to inject named vars from frontend env
  into session spec as env.NAME=VALUE lines
- s/sh: remove $MOUNT/env export loop (global env file removed)
- Bump core and 9p submodules

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 19:02:35 +02:00
Levi Neely 72eeff473a env: centralize daemon env management; add /mcp slash command to s/sh
- Bump core and 9p submodules for env refactor
- s/sh: export daemon env from $MOUNT/env on startup
- s/sh: add /mcp command

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 15:44:31 +02:00
Levi Neely 179a157c8b scripts/s/sh: implement all supported slash commands
Add explicit handlers for all session ctl commands (/stop, /kill,
/compact, /clear, /rn, /cwd) and session file r/w commands (/agent,
/model, /backend) and read-only queries (/models, /backends, /usage,
/ctxsz). Ctl commands now continue past the drain loop. /rn updates
local $id/$S after rename. Unknown slash commands print an error
instead of writing garbage to ctl.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 14:53:42 +02:00
Levi Neely e3eb782be5 scripts: b/job parallel improvements — streaming results, input/output headers, -failfast
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 13:52:22 +02:00
Levi Neely 9de1baa197 scripts: add b/cleanup; update docs and mkfile
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 12:39:34 +02:00
Levi Neely ea58313f94 scripts: b/job accepts args as instruction and stdin as content when both present
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 12:36:05 +02:00
Levi Neely ab0b354132 doc: reorganize scripts README by namespace
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 12:15:36 +02:00
Levi Neely 9da56b0622 scripts: rename s/job -> b/job; b/q and b/sched wrap b/job
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 12:14:14 +02:00
Levi Neely 718fabf500 scripts: use $0 for cmd name in q, sched, sh
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 12:12:00 +02:00