Commit Graph

227 Commits

Author SHA1 Message Date
Ollie Agent cd26595cb7 Fix stream chunk truncation; style TUI initial state from state file
server.go: the stream read handler truncated each chunk to the client's
requested Count and advanced waitBase, silently dropping bytes beyond
the buffer (e.g. a chat block larger than 64KB). It now caches each
stream chunk per-fid (readCache + streamBase) and pages within it by
absolute offset, fetching the next chunk only once the current one is
fully drained, preserving 9P offset semantics.

o tui: read the state file for the initial status bar and apply the same
color styling and status text the event loop uses, so the bar is correct
immediately on attach; the event stream drives subsequent updates.
2026-10-10 16:37:00 +02:00
Levi Neely 7867094c41 o tui: read initial state from 9P state file 2026-10-09 19:12:08 +02:00
Levi Neely f2f33e7826 Add chat file back for TUI text streaming 2026-10-09 19:09:20 +02:00
Levi Neely bc5f45854e scripts/o: tui reads filtered log instead of log.raw 2026-10-09 18:57:44 +02:00
Levi Neely 57c40d541e Migrate chat log to JSONL format
Server changes:
- format/block.go: Block struct with JSONL marshaling, RenderBlock for text
- Deleted format/event.go, format.go, format_test.go (old delimiter format)
- agent/chat.go: Dual logs (rawLog JSONL + textLog rendered text)
- agent/chatlog.go: Streaming via flushPartial/closeBlock, skip internal events
- fs/spec.go: New files log.raw (JSONL), log (text), block (ID lookup)
- Removed chat/chat.raw/chat.search from namespace

GUI changes:
- chatblockmodel: JSONL parsing via QJsonDocument, removed regex state machine
- ollie9pclient: Read from log.raw for replay, removed old streaming code
- Added Context type to block enum, filter context/state/usage from display

Docs updated: AGENTS.md, system_prompt.md, architecture-*.md, scripts/o
2026-10-09 18:52:40 +02:00
Levi Neely 73e5af6ce8 plumbing: allow colons in session/agent names 2026-10-09 13:56:59 +02:00
Levi Neely ecbea0fe90 gui: integrate bookmarks with plan9 plumber
- Add ollie:// URL scheme for plumb messages
  Format: ollie://session/agent#block
- Plumber listens on 'ollie' port for navigation messages
- Bookmarks show 📋 button to copy ollie:// link
- Add data/plumbing with rules to route ollie:// URLs
- On plumb message: switch session/agent, scroll to block, raise window
2026-10-09 13:27:40 +02:00
Levi Neely 8793202ef5 o: fix bypass agent filter to use agent ID instead of name
OLLIE_UNAME in bypass requests is the agent ID, not name.
Look up agent ID from idx before filtering.
2026-10-09 13:05:38 +02:00
Levi Neely 9fb150b6fe o: add !a !d !b shortcuts in prompt for bypass management
!a or !approve - approve first pending bypass for this agent
!d or !deny    - deny first pending bypass for this agent
!b or !bypass  - list pending bypass requests for this agent
2026-10-09 13:02:39 +02:00
Levi Neely 859bb4910f o: filter bypass/approve/deny by agent when agent context is set
o session/agent bypass   - shows only that agent's requests
o session/agent approve  - approves first request from that agent
o session/agent deny     - denies first request from that agent
o session bypass         - shows all requests (unchanged)
2026-10-09 13:01:36 +02:00
Levi Neely 2c8b301a59 o: handle expired bypass requests gracefully in approve/deny 2026-10-09 12:58:26 +02:00
Levi Neely 1663d2d212 o: fix approve/deny to handle array of pending requests 2026-10-09 12:56:34 +02:00
Levi Neely 995db45444 o: fix bypass command to handle array of pending requests 2026-10-09 12:54:39 +02:00
Levi Neely b5138fd55e o: fix tui event subscription - use IDs not names
Event topics use session/agent IDs, not names. Look up IDs from
the idx files before subscribing to state events.
2026-10-09 12:47:29 +02:00
Levi Neely f490d4eef2 o: add delays before tmux send-keys
Shell needs time to initialize before receiving commands.
2026-10-09 12:38:12 +02:00
Levi Neely 8c7a3bf83b o: simplify tui commands - remove grep filters
The shell escaping for grep patterns was complex and fragile.
Removed the cosmetic filters for [[[...]]] and backticks.
2026-10-09 12:35:33 +02:00
Levi Neely 9f69654d0c o: use slash separator in tui spawned commands
Slash is primary separator. Agent names may contain colons but
session names don't contain slashes, so slash is unambiguous.
2026-10-09 12:30:08 +02:00
Levi Neely 1d688d9944 o: sanitize agent name for tmux session too
Agent names like src:ollie need colon replaced with dash.
2026-10-09 12:29:14 +02:00
Levi Neely 9b063a24ce o: fix context parsing - slash is primary separator
Agent names may contain colons (e.g., src:ollie), so slash must
be the primary separator. Colon separator is only for the rare
case where session names contain slashes.

default/src:ollie now correctly parses as:
  session = default
  agent = src:ollie
2026-10-09 12:28:02 +02:00
Levi Neely aa939b0f84 o: fix tmux session targeting in tui command
Remove = prefix from tmux -t arguments - it doesn't work with
pane specifiers (:0.1). Also changed -g to -t for mouse option.
2026-10-09 12:24:35 +02:00
Levi Neely c30c75cea9 o: fix tui with session names containing slashes
- Sanitize tmux session name (replace / and : with -)
- Include agent name in tmux session for uniqueness
- Quote context arg in spawned o commands
- Use colon separator for robustness
2026-10-09 12:23:08 +02:00
Levi Neely e1d01716f3 o: support colon separator and quoted names in context arg
- session:agent works as alternative to session/agent
- Colon takes precedence (allows slashes in session names)
- Quoted arguments with spaces now work: o "my session:agent" prompt
- Removed set -- $* which broke quoted arguments
- Updated help with examples
2026-10-09 12:21:20 +02:00
Levi Neely f822bf6c32 prompts: enforce terse output more aggressively
- Changed 'brief' to 'TERSE' with explicit one-sentence-per-action rule
- Added 'instant failure' framing for banned patterns
- Banned multi-sentence summaries explicitly
- Removed hedging allowances
- Simplified task completion to 'ONE sentence. Stop.'

Also: kate plugin diff widget detection with debug logging
2026-10-09 11:53:58 +02:00
Levi Neely 2381ba4fbd prompts: add brevity constraints to all agent prompts
Added Output sections with explicit bans on narration, hedging, and
verbose summaries to all agent-*.md files:
- author, conductor, copilot, foreman, observer, panelist, reviewer, theo
- Strengthened existing Output sections in explorer, librarian, navigator, taskmanager

All agents now have consistent brevity guidelines.
2026-10-09 10:45:21 +02:00
Levi Neely dda056e3b1 prompts: explicit bans on verbose patterns
Added concrete examples of banned output patterns:
- Preambles (Great question!, I'd be happy to help!)
- Narration (Let me..., I'll now...)
- Hedging (It seems like, It appears that)
- Over-explaining and self-congratulation
- Summaries that restate what was just done

Added positive guidance: start with the answer, state task
completion in one sentence, end when information is delivered.

Models respond better to explicit prohibitions with examples than
to general instructions to 'be brief'.
2026-10-09 10:41:14 +02:00
Levi Neely a899f933fb acme-ollie-ensure: always update agent cwd
Match ollie-session-here behavior: update cwd for existing agents,
not just on creation. Ensures agent cwd reflects current project root
when invoked from a different context.
2026-10-07 15:24:46 +02:00
Levi Neely f7a52088db per-agent cwd override with session-level inheritance
- Agent cwd is optional; empty = inherit session cwd (the common case)
- Session cwd is required at creation and is the inheritance root
- toolsrv maintains agentCWD map, resolved per call from agent= field
- Override set via agent cfg (cwd=...) or ctl (cwd [<dir>|-])
- Agent.SyncCwdToToolServer re-pushes on every (re)connect
- GUI NewAgentDialog shows '(inherit: <sessionCwd>)' as placeholder
- proc_test.go covers per-agent cwd isolation
- Kate and acme scripts updated for new session/agent creation flow
- AGENTS.md documents the architecture
2026-10-07 15:14:04 +02:00
Levi Neely d5efe575ce consistent agent naming: parent:prefix convention
Agent names derived from cwd using parent:prefix format:
- /home/user/src/ollie -> src:ollie
- /home/user/proj/ABC-123_feature/repo -> abc-123:repo

Updates:
- Kate plugin: one agent per project, git root fallback if no project plugin
- acme-ollie-ensure: single 'acme' session, per-project agents
- ollie-session-here: single 'default' session, per-project agents

Also fixed write -> rdwr for session/agent creation endpoints
2026-10-07 14:39:47 +02:00
Levi Neely d8b24ae26d o: add bypass command to inspect pending request
o sess bypass - shows id, agent, cwd, cmd without resolving

Workflow: bypass -> review -> approve/deny
2026-10-06 14:58:22 +02:00
Levi Neely 7b6ddc1b1a o: accept optional request id for approve/deny
o sess approve [id]  - approve pending, optionally verify id
o sess deny [id]     - deny pending, optionally verify id

Shows request id in output: [42] approving: cmd
Errors if specified id doesn't match pending request.
2026-10-06 14:57:21 +02:00
Levi Neely b440622441 o: add approve/deny commands for bypass requests
Works at session or agent context (bypass is session-level).
Reads pending request from session/{s}/bypass, extracts ID,
writes '{id} approve' or '{id} deny' to resolve.
2026-10-06 14:52:07 +02:00
Levi Neely 9d0b59671c o: use filtered event stream instead of statewait loop
Subscribe to agent-specific state events via streaming rdwr pattern.
No more polling loop - single filtered subscription.
2026-10-06 12:39:25 +02:00
Ollie Agent 3f9f4753ef session: make session/new get-or-create
CreateEmpty now returns (session, created, error): if a session with the
given name already exists it is returned untouched instead of erroring,
and only a freshly created session receives the provided cwd/workflow/
variant. The o script no longer suppresses errors from session/new, so
real failures surface while re-creating an existing session stays a
no-op success.
2026-09-29 23:01:44 +02:00
Ollie Agent 42cae9ee2e human-friendliness: self-describing ctl, structured errors, status, overview
Make the namespace explain itself instead of requiring prior knowledge.

- ctl is self-describing: reading it (empty write) or writing 'help'
  returns the valid verbs with one-line descriptions; an unknown verb
  errors with the valid list. Refactor dispatch to an ordered []ctlCmd
  carrying descriptions; drop the undocumented '.' alias and the
  drift-prone hardcoded help verb. Keep 'i' (drop 'inject') for fast
  injects. o's ctl usage now reads the live listing.
- Errors carry severity + remediation. backend.ClassifyError maps the
  typed errors to transient/config/fatal with a one-line fix; the error
  event renders [[[error:<severity>]]] and a 'remediation:' line so a
  human knows whether to wait or intervene.
- Add a human status file: 'thinking · 12s', 'calling shell · 3s',
  'idle' — distinct from the machine-facing raw state. Wire the TUI bar
  to it.
- Bare 'o' shows an overview of running sessions/agents with status, so
  you don't need to know any names to get oriented.

Tests: dispatch help/unknown/routing, ClassifyError severity table.
2026-09-07 13:55:45 +02:00
Ollie Agent f3933e21e7 backend: make reasoningEffort the primary knob with documented thresholds
reasoningEffort (low|medium|high) is now the single human-facing control
for model deliberation. Backends that speak a discrete level (OpenAI,
OpenRouter, Copilot, Gemini, Kiro) send it verbatim; Anthropic, which
needs a numeric budget, translates via documented thresholds
(low=4096, medium=8192, high=16384). thinkingBudget remains an advanced
explicit override that wins when set.

- Add EffortLow/Medium/High, threshold consts, ValidReasoningEffort,
  EffortThinkingBudget, and GenerationParams.ResolvedThinkingBudget.
- Anthropic: derive budget from effort, grow max_tokens above the budget
  (Anthropic requires budget < max_tokens), and force temperature=1 when
  thinking is enabled (both are Anthropic requirements).
- Validate reasoningEffort at config load so typos fail loudly instead
  of silently no-opping.
- theo: drop explicit thinkingBudget/inflated maxTokens; reasoningEffort
  high now implies the 16384 budget.
- Document thresholds and per-backend behavior in data/agents/README.md;
  fix stale autoLoad/maxSteps references.
- Add unit tests for the mapping and Anthropic thinking behavior.
2026-09-07 13:34:58 +02:00
Ollie Agent a9fe03eb71 agents: raise theo reasoning to high with thinking budget
Theo is a security auditor reasoning about injection, TOCTOU races,
crypto misuse, and confused-deputy problems — adversarial edge-case work
that needs deep deliberation, not the low effort it was set to. Bump to
reasoningEffort=high and add thinkingBudget=16384 so depth carries over
to Anthropic extended thinking. Raise maxTokens to 24576 so it stays
above the thinking budget (Anthropic requires budget < max_tokens).
2026-09-07 13:28:45 +02:00
Ollie Agent 6c7e5864c4 agents: set reasoningEffort per profile; rename thinkingBudget tag
Reasoning effort is part of an agent's behavior definition, so set it
on all 14 profiles keyed to role (planning/review high, general medium,
lightweight assist low). Also rename the ThinkingBudget json tag from
the confusing bare "reasoning" to "thinkingBudget", distinct from the
reasoningEffort string knob. No config migration needed — no profile or
backends.conf used the old "reasoning" key.
2026-09-07 13:27:33 +02:00
Ollie Agent 9395a0e07b config: rename agent autoLoad field to tools
The autoLoad name implied an automatic tool-loading path that no longer
exists; tools now come only from agent config plus the /tool_load ctl
command. Rename the AgentConfig.AutoLoad field (json autoLoad) to Tools
(json tools), rename LoadAutoLoadTools to LoadTools, and update all 14
agent JSON profiles and the tool-not-loaded error message.
2026-09-07 13:23:17 +02:00
Ollie Agent 86db9c797b agents: autoload all memory tools 2026-09-05 11:58:12 +02:00
Levi Neely 989aa0400d o: fix tmux session name handling for dots
Session names like 'r7.20' caused 'duplicate session' errors because
tmux interprets dots as window.pane separators.

Fix: Use '=' prefix for exact match in all tmux -t arguments.
From tmux(1): 'If the session name is prefixed with an =, only an
exact match is accepted.'
2026-09-04 15:35:21 +02:00
Levi Neely 9307cc86de o: set tmux mouse option globally
Use -g instead of -t to apply mouse support to all tmux sessions.
2026-08-27 16:26:08 +02:00
Levi Neely 3a39041e26 o tui: drop tmux -CC, enable mouse support 2026-08-27 15:04:14 +02:00
Levi Neely a3dfbcefc1 o: strip ANSI escapes on dumb terminals
Detect TERM=dumb or non-tty stdout and use plain '> ' prompt
instead of bold ANSI escape sequences.
2026-08-27 14:46:18 +02:00
Levi Neely 59c19cace9 acme-ollie-ensure: use PWD (acme sets it), tag fallback for HOME
Confirmed acme calls threadspawnd with window dir.
Added tag-based fallback when PWD is HOME (top-level window).
2026-08-24 15:29:55 +02:00
Levi Neely 53baa43203 acme-ollie-ensure: update session cwd on every invocation 2026-08-24 15:26:06 +02:00
Levi Neely 89db742a04 Redesign acme sessions: one session per project, not per agent
Model: acme-{hash} (session with project cwd) / assistant (agent)
- Git worktree aware (uses --show-toplevel)
- CWD set on session, not agent
- Agent always named 'assistant'
2026-08-24 15:23:24 +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 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
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