Commit Graph

420 Commits

Author SHA1 Message Date
Levi Neely ece8d22e75 9p: add ollie/tmp backed by OLLIE_TMP_PATH flatdirstore
Replaces /tmp/ollie per-session scratch space with a 9P-served tmp/
directory backed by OLLIE_TMP_PATH (~/.local/share/ollie/tmp by default).
Markers are now global, hash-addressed by absolute file path, and shared
across all sessions. OLLIE_TMP_PATH is always set by ensureEnv().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-17 09:20:27 +02:00
Levi Neely f17774163c olliesrv: fix subcommand flag parsing
flags after the subcommand (e.g. start -tcp :564) were silently ignored
because flag.Parse() stopped at the first non-flag argument. parse
os.Args[2:] after extracting the subcommand from os.Args[1].

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 23:32:28 +02:00
Levi Neely 3b5f494aef olliesrv: add TCP listener and mount subcommand
- -tcp <addr> flag on start/fgstart listens on TCP in addition to the Unix socket
- mount <address> [mountpoint] mounts a remote olliesrv namespace locally via 9pfuse

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 23:12:23 +02:00
Levi Neely 90428a7017 9p: add remove handler for tr/ transcripts
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 22:38:36 +02:00
Levi Neely b4974cc6c2 9p: add transcript store (tr/) and save via chat write or ctl save
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 22:35:02 +02:00
Levi Neely 261fa547fb 9p: fix offset to point past user prompt in chat
Capture chatOffset after the user event is appended rather than
before Submit, so tail -c +$((offset+1)) yields only the model
response for that turn.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 22:14:42 +02:00
Levi Neely de1bf9612d 9p: expose offset file in session directory
Records the byte position of chat EOF immediately before each prompt
is submitted. Clients can read offset after a turn completes and use
tail -c +$((offset+1)) to extract just the new output without needing
a dedicated reply file.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 22:05:03 +02:00
Levi Neely e277937619 batchstore: set result to status message on failure
On failure, result is empty and only status carries the error.
Callers (subagent_spawn, oq) now always have a useful value in
result regardless of success or failure.
2026-04-16 20:54:27 +02:00
Levi Neely 181e629009 batchstore: surface backend errors from Submit as failed job status
executeJob was only capturing 'assistant' events from core.Submit.
Backend errors emit an 'error' event that was silently dropped,
causing jobs with nonexistent models to show status=done with empty
result instead of status=failed.
2026-04-16 20:46:45 +02:00
Levi Neely 9a51d287f7 README: document b/ batch namespace
- Add b/ to filesystem layout (job spec, status, result, usage, ctxsz)
- Add BatchStore to backing stores table
- Add Batch jobs section with submit/poll/remove examples and oq reference
- Remove s/{id}/reply from layout
2026-04-16 19:41:46 +02:00
Levi Neely 793cf6b4fa 9p: add b/ batch namespace for ephemeral one-shot jobs
Introduces b/ as a first-class 9P namespace alongside s/. Writing to
b/new creates one or more ephemeral agent jobs (parallel=N suffix -0..-N)
each running the same prompt in an independent agentCore with no
persistent session state.

Per-job files: spec, status, result, usage, ctxsz.
BatchStore/BatchJobStore mirror SessionStore/SessionFileStore.
rm -r b/{id} cancels and removes the job.

Also removes s/{id}/reply: b/{id}/result is the purpose-built
replacement for one-shot prompt->reply use cases.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 19:22:39 +02:00
Levi Neely cb00afb8bd flush log on shutdown 2026-04-15 18:19:59 +02:00
Levi Neely f478f7545c ensureEnv: set OLLIE_* defaults at startup
Ensure all OLLIE_* path env vars (OLLIE, OLLIE_TOOLS_PATH,
OLLIE_SKILLS_PATH, OLLIE_PLAN_PATH, OLLIE_MEMORY_PATH) are set
to their default values via os.Setenv before the server or any
session is created. This guarantees they are visible to tool
subprocesses without requiring explicit external configuration.
2026-04-15 11:16:16 +02:00
Levi Neely 10a0a36681 switch to shared logger from ollie/pkg/log
Replace ad-hoc debug vars and olliesrv fprintf calls with
plog tagged "9p". Operational messages are Info level.
2026-04-15 10:24:25 +02:00
Levi Neely c705053dd5 fix stat reporting zero length for readable files; add debug logging
makeStat was reporting Length=0 for /s/new, /s/idx, /backends, /help,
and all store-backed files (/a/*, /p/*, /sk/*, /t/*). Clients that
check stat before reading (cat, 9pfuse) saw an empty file and never
issued Tread.

Also adds debug logging (OLLIE_9P_DEBUG=1) across all 9P operations,
tagged with "9p:" prefix.
2026-04-15 10:13:32 +02:00
Levi Neely 2ad8cf558f fix: handle rm -r on session directories
rm -r first unlinks each synthetic file in s/{id}/ before removing the
directory. The remove handler was passing the file basename to
SessionStore.Delete, which failed with "session not found".

Treat /s/{id}/{file} removes as no-ops so rm -r can proceed to the
directory removal, which triggers the actual session kill.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 23:24:23 +02:00
Levi Neely b8c23dd7b6 doc: fix broken relative ollie link in README
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 22:56:41 +02:00
Levi Neely e225085db4 docs: document pluggable backing stores per 9P directory
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 21:50:33 +02:00
Levi Neely 22382e821d 9p: complete SessionStore integration; /s/ fully backed by store
All /s/ directory operations now route through SessionStore:
- pathType uses sessionStore.Stat for /s/{name} entries
- readDir uses sessionStore.List for /s/ listing
- wstat uses sessionStore.Rename for session renames
- read/write/remove for /s/new and /s/{id} already updated

README.md changes excluded (unrelated to store work).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 21:46:45 +02:00
Levi Neely 60024ee917 9p: introduce pluggable store interface for all filesystem endpoints
Add ReadableStore, WritableStore, ReadWriteStore, BlobStore, and Store
interfaces with FlatDirStore as the default filesystem-backed implementation.
Each 9P directory endpoint is now backed by a named store:

  /a/       agentStore   (Store      - FlatDirStore)
  /p/       promptStore  (ReadableStore - FlatDirStore)
  /m/       memStore     (Store      - FlatDirStore)
  /pl/      planStore    (Store      - FlatDirStore)
  /t/       toolStore    (Store      - ToolStore, synthetic idx)
  /sk/      skillStore   (Store      - SkillStore, wraps skills package)
  /s/{id}/  per-session  (ReadWriteStore - SessionFileStore, in-memory)

Swapping a backend (e.g. /m/ to a vector store, /pl/ to beads) now requires
only a new Store implementation — no changes to the 9P server logic.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 21:40:17 +02:00
Levi Neely b5a0e82aad docs: document prompt rebuild triggers and file listing
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 20:07:29 +02:00
Levi Neely 7ab641b350 9p: call Close() on all sessions during shutdown
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 19:50:27 +02:00
Levi Neely 70579db150 9p: add systemprompt to session directory listing
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 19:48:07 +02:00
Levi Neely bd3dec3696 docs: add systemprompt to filesystem layout
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 19:40:14 +02:00
Levi Neely dfd7dc2ef3 9p: delegate session tmpdir cleanup to core.Close()
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 19:30:03 +02:00
Levi Neely 550510c459 9p: remove duplicate tmpdir creation (now in core)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 19:28:06 +02:00
Levi Neely 0101f81dd2 9p: clean up /tmp/ollie/$id on session kill
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 19:25:56 +02:00
Levi Neely 52bb97973a 9p: expose s/{id}/systemprompt as read-only file
Returns the fully rendered system prompt for the session via Core.SystemPrompt().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 19:17:03 +02:00
Levi Neely 78dd946144 rename OLLIE_9MOUNT → OLLIE
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 17:39:36 +02:00
Levi Neely d46b54877b add /m create+write handlers for memory files
Create handler initializes an empty file in memDir; write handler
(called from clunk) writes the full content to disk. Removes
temporary debug logging.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 17:29:24 +02:00
Levi Neely 64dd815388 server: remove restrictive create guard, allow creates in all directories
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 16:24:06 +02:00
Levi Neely da3412bb13 server: default memory path to ~/.config/ollie/memory, create on startup
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 16:15:53 +02:00
Levi Neely d6075b9a89 server: create memory directory on startup
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 16:11:38 +02:00
Levi Neely 61c1b65c83 9p: make t/idx a live synthetic file like sk/idx
Add explicit idx check in pathType() before the os.Stat fallback,
add idx entry to /t directory listing with mode 0444, and set
/t/idx stat mode to 0444. The read handler already generated live
content from tool headers — only the routing was broken.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 15:33:27 +02:00
Levi Neely acaaef9971 9p: remove file and reasoning server registrations; session tmpdir init
- Remove file.Decl and reasoning.Decl from dispatcher
- go mod tidy: drop go-udiff dependency
- Initialize /tmp/ollie/$sessID on session create (rm -rf + mkdir)
- Rename /tmp/ollie/$oldID -> $newID on session rename

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 15:26:23 +02:00
Levi Neely f5c0b29522 9p: serve t/idx and sk/idx as live synthetic files
Both are generated on read from current state — no physical files.
t/idx scans ToolsPath() headers; sk/idx uses skills.List().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 14:47:38 +02:00
Levi Neely 547e0d79dc 9p: serve sk/idx as read-only synthetic file
sk/idx is written by rebuildSkillsIdx() at session start but was
invisible via 9P since sk/ reads go through skills.Read() which only
knows skill directories. Add explicit handling in pathType, read, stat,
and directory listing — same pattern as s/idx.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 14:34:08 +02:00
Levi Neely e176e7ef7f 9p: add s/idx — live session index for agent cooperation
Synthetic read-only file at ollie/s/idx. Each line is tab-separated:
  {id}	{state}	{cwd}	{backend}	{model}

Generated on demand from live session state so it's always current.
Enables agents to discover peers by cwd or name without polling
individual session files.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 14:27:47 +02:00
Levi Neely d832965710 server: remove OLLIE_*_PATH SetEnv calls
OLLIE_MEMORY_PATH and OLLIE_PLAN_PATH are now configured via sandbox
yaml overlays rather than injected at session creation. Remove the
SetEnv calls so the sandbox can pick them up from the environment if
the user has set them.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 08:41:45 +02:00
Levi Neely 7f8fc0e033 remove memory and task server registrations from dispatcher
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 08:37:33 +02:00
Levi Neely 90cde3a30e 9p: add ollie/m directory backed by OLLIE_MEMORY_PATH
Wire /m as a read-write directory that maps to s.memDir
(OLLIE_MEMORY_PATH or ~/.local/share/ollie/memory). Handles
fileType, create, read, write, rename, remove, stat, and directory
listing — mirrors /pl exactly. Inject OLLIE_MEMORY_PATH into the
execute server env alongside OLLIE_PLAN_PATH.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 08:24:09 +02:00
Levi Neely 6168dc9313 wire memory and task servers; drop filePlanBackend
Register memory.Decl() and task.Decl(planDir) in the dispatcher.
Remove filePlanBackend (plan logic now lives in core/pkg/tools/task).
Drop WithFallbackPlanBackend now that BuildAgentEnv takes no options.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 08:14:57 +02:00
Levi Neely 3cd2afc24c fix ctl command list in package comment
Was: compact, clear, interrupt
Now: stop, kill, rn, compact, clear
2026-04-13 18:08:53 +02:00
Levi Neely 7d23361982 rename workdir to cwd
Local vars and method calls updated to match core API rename.
2026-04-13 18:03:26 +02:00
Levi Neely 818ccf2632 rename workdir to cwd
Rename the user-facing 9P file and session key from "workdir" to
"cwd" for consistency with the /cwd command.
2026-04-13 15:51:49 +02:00
Levi Neely b048aac109 9p: reject unrecognized ctl commands
ctl now validates the first word of input against a closed set of
known commands. Unrecognized input returns an error instead of being
silently forwarded as a prompt to the agent.
2026-04-13 15:44:14 +02:00
Levi Neely fdcf048a70 name= support for ollie/s/new; wip mutable state tailing 2026-04-13 15:23:04 +02:00
Levi Neely 0a4ca8a869 9p: add agents dir, backends, help, plan rm; refactor readSlice 2026-04-13 14:45:17 +02:00
Levi Neely fc5443e314 9p: session rename via wstat, ctl kill/rn, connection tracking
- Support mv on session directories (wstat rename)
- Track connections globally for fid path rewriting on rename
- Add kill and rn <name> to ctl handler
- Append rename notification to chat log
- Update README with rename and ctl docs
2026-04-13 14:25:53 +02:00
Levi Neely 368d1a9ba0 9p: accept empty values in s/new, fix docs to rm -r 2026-04-13 13:56:52 +02:00