Each slash command is now a closure in a map[string]cmdFn. Adding or
removing a command is a single map entry with no fall-through risk.
The ! shell handler is unchanged. handler(infoEvent("")) now fires only
for recognized commands, not unknown /foo inputs.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Crash-left /tmp/ollie/{id}/ directories are now cleared once at process
start via sync.Once before the first session tmpdir is created.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Both failures now panic with a descriptive message. Submit recovers,
logs the panic and stack trace via clog, cancels any in-progress action,
resets state to idle, and emits an error event to the handler.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Post-turn hook continue, unconsumed pendingInject, and FIFO drain all
previously re-entered Submit recursively, growing the stack with each
continuation. Replace with an explicit loop in Submit and extract the
single-turn logic into executeTurn, which returns the next prompt or "".
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
setState("idle") was called before handler(Event{Role:"newline"}),
meaning the final appendChat("\n") raced against statewait watchers
and clients that poll state. Remove the event entirely; clients no
longer see it.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
context.AfterFunc callback was broadcasting without holding changeMu,
risking a missed wakeup if ctx cancels between the consumer's check
and cond.Wait(). Add unit tests covering the full state-change cycle
and the missed-wakeup race under -race.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
notifyChange must hold changeMu when broadcasting. Without the lock,
the broadcast can fire between the consumer's value check and its
cond.Wait call — the signal is lost and the consumer sleeps until the
next change, causing an apparent off-by-one lag.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a sync.Cond-based change notification mechanism. setState,
SetCWD, and usage updates all broadcast. WaitChange blocks until the
named field changes from the given current value, with context
cancellation support via context.AfterFunc.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
systemPrompt() loaded and templated files from DefaultPromptsDir() at
startup and on cwd change. This is now handled entirely by the
agentSpawn hook using the prime script, eliminating the parallel
prompt-injection path.
DefaultPromptsDir() is kept for the 9P server's p/ directory exposure.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Hook values can now be a string or array of strings in agent JSON config.
Commands run in order; exit 2 from any command blocks immediately.
Context from all successful commands is concatenated.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Allows wrapper scripts in ~/.config/ollie/scripts/x/ to shadow system
binaries transparently without modifying the user's shell environment.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
setState("thinking") was called after fireAgentSpawn, so if the agentSpawn
hook (e.g. bd prime) took longer than the TUI's 150ms grace period,
tailUntilIdle would see state=idle and exit before the LLM turn began.
Move setState("thinking") to before the session-nil block so the TUI
immediately sees a non-idle state.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Debug-log all hook firings unconditionally (name, cmd, exit, context_len)
- Emit "N hook(s) run" to chat for lifecycle hooks (agentSpawn, pre/postCompact,
pre/postClear); suppress per-turn hooks (userPromptSubmit, stop) from chat
- Store env.Messages (MCP connections) on agentCore; emit to chat on first turn,
debug-log unconditionally
- Replace inline s.state assignments with setState() so debug logs emit only
on state transitions, not on every State() poll
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
agentSpawn previously fired on every turn with its result discarded.
It now fires once on the first turn of a session, injecting stdout into
the opening message. It re-fires naturally after /agent switch since
that resets the session.
Add preCompact/postCompact hooks at both compact sites (auto and manual).
Add preClear/postClear hooks around /clear. Pre-hooks can block the
operation (exit 2); post-hooks are fire-and-forget notifications.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove the elevation package and Elevator interface entirely. The
execute server now invokes x/elevate directly, with detection reduced
to a stat check. Decl() loses the elevator parameter.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove session-scoped env injection from frontend (s/{id}/env, -e/-env flags) — superseded
by per-invocation superpowers run-session in the elevator. Keep agentCore env map and
OLLIE_SESSION_ID propagation via pushSessionEnv.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- BuildAgentEnv accepts sessionEnv map for MCP ${VAR} expansion without
touching os.Setenv — session vars stay isolated from other sessions
- STDIOTransport uses os.Expand with session lookup instead of os.ExpandEnv
- Core.SetEnv injects into execute server envExtra only (not process env)
- Remove global env exposure; env is injected at session creation time
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- New pkg/env package owns EnsureDefaults, Set, Get, All, Format
- BuildAgentEnv reverted to 3-arg signature (no initialEnv)
- agentCore.setEnv removed; pushSessionEnv handles OLLIE_SESSION_ID only
- execute.Server.SetEnv no longer calls os.Setenv (session-scoped only)
- !cmd handler sets OLLIE_SESSION_ID explicitly in subprocess env
- mcp/transport: seed cmd.Env from os.Environ() so MCP servers inherit PATH etc.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add GenerationParams() and SetGenerationParams() to the Core interface
and implement them on agentCore, allowing frontends to read and update
sampling parameters at runtime.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add {OLLIE_TMP_PATH} to DefaultConfig filesystem RW list so landrun
permits writes to the tmp directory. Also mkdir the path at session
init so the pathExists check in WrapCommand doesn't skip it.
Add OLLIE_TMP_PATH to DefaultConfig env list and inject it via SetEnv
in NewAgentCore and SetSessionID, matching the pattern used for OLLIE
and OLLIE_SESSION_ID.
Replace all hard-coded ~/.config/ollie and ~/.local/share/ollie paths
with a new paths package that reads OLLIE_CFG_PATH and OLLIE_DATA_PATH,
falling back to the previous defaults when unset.
- execute_code now takes steps:[{code,language}|{tool,args}] instead of
a single code/language pair. Single-step calls return raw output;
multi-step calls run in parallel and return results under === step N ===
headers in submission order.
- execute_pipe stages may now include {parallel:[...]} to fan out
concurrently within a pipeline. Parallel outputs are concatenated in
submission order and fed as stdin to the next stage.
- Stage execution is now Go-level (stdin chaining) rather than a single
bash pipeline string, enabling parallel stages and tool/code mixing.
- CodeStep and resolveCodeStep are the shared primitives for both
execute_code and execute_pipe parallel stages.
- executeWithStdin added to Server for stdin chaining between stages.
- Tool steps use shebang detection; language field applies only to
inline code steps (default: bash).
- ListTools schemas and descriptions updated throughout.
ToolsPath() fell back to ~/.config/ollie/tools when OLLIE_TOOLS_PATH
was unset, ignoring the 9P mount entirely. Add /home/lkn/mnt/ollie/t as the
preferred fallback so execute_tool finds tools on the mounted
filesystem regardless of cwd.
- extractMCPResult: parse isError from MCP response so tool failures
are returned as Go errors and marked isErr=true in the loop
- CallTool: emit isError:true content block instead of bare {"error":...}
so the model sees tool failures as error results, not success
- SetEnv: call os.Setenv so OLLIE_SESSION_ID/OLLIE are in the process
env and inherited by sandboxed subprocesses
- NewAgentCore: inject session env into execute server at creation time,
not only on rename, so tools have OLLIE_SESSION_ID from the first call
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Returns the fully rendered system prompt for the session, so
the 9P server can expose it via s/{id}/systemprompt.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
systemPrompt() now reads all *.md files from DefaultPromptsDir() in
lexical order (00_base.md, 01_foo.md, ...), applies template rendering
to each, and concatenates them with --- separators.
Removes hardcoded eager-loading of skills (reasoning, memory, task,
edit-text) and the skills package dependency. Those now live as numbered
prompt parts alongside the base prompt.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Skills are loaded into the system prompt from the first turn as an
alternative to encoding guidance in MCP schemas.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add TrustedToolsSetter interface and SetTrustedTools to execute.Server
- Add allowed(): trusted tools return true; untrusted with no Confirm
return false (deny by default). Confirm returns true=allow, consistent
with allowed() semantics throughout.
- BuildAgentEnv wires cfg.TrustedTools into the execute server
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
$OLLIE is the ollie root (FUSE mount). Renaming makes it shorter and
cleaner for use in sandboxed code. SetSessionID now resolves and
injects OLLIE into the execute server env so it is always available
regardless of whether the parent process has it set.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
detectLanguage only checked filepath.Base(fields[0]), which returns
"env" for #!/usr/bin/env python3. Every such script was run as bash,
producing syntax errors. Now checks fields[1] when fields[0] is "env".
Also add OLLIE_MEMORY_PATH to default env passthrough.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Reading from the 9P mount during session creation deadlocked the
server. Use skills.Read() to access the physical files directly.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Read ollie/sk/reasoning.md and ollie/sk/memory.md from the 9P mount
and append them to the rendered system prompt. Removes dependency on
the model following a startup instruction.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove pkg/tools/file and pkg/tools/reasoning. Both are now implemented
as execute_tool scripts in ollie/t/ with feature parity:
- file_read, file_write, file_edit, file_grep, file_glob
- reasoning_think
isread guard delegated to /tmp/ollie/$OLLIE_SESSION_ID/<hash> markers.
SetSessionID renames the tmpdir on session rename.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Both idx files are now served as live synthetic files by the 9P server.
No physical files are written to disk.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>