Merge pull request #1 from NERVsystems/claude/local-llm-feasibility-gVLhq Add OpenAI-compatible local LLM backend support
Add OpenAI-compatible backend for local LLM support (GPT-OSS) Implement OpenAIClient backend that speaks the OpenAI Chat Completions API (/v1/chat/completions), enabling llm9p to work with any local model server: Ollama, vLLM, llama-server, LocalAI, or LM Studio. Primary target is GPT-OSS (OpenAI's open-weight MoE models), but any model served via these platforms works. The backend supports: - Blocking and streaming chat completions - Tool/function calling with STOP:/TOOL: formatting - Token counting from API usage (with estimation fallback) - Conversation history, system prompts, temperature control - Stateless AskWithRequest for session isolation Usage: ./llm9p -backend openai -openai-url http://localhost:11434/v1 -model gpt-oss:20b Also fixes pre-existing stale mock backends in test files (AskWithRequest signature was out of date with the Backend interface). https://claude.ai/code/session_017qVVZUUhfCCvNkMYmXDZAa
feat(llm9p): Implement clone-based session architecture Replace per-fid session model with Plan 9 clone pattern: - Reading /n/llm/new creates a session and returns its ID - Each session gets its own directory: /n/llm/<id>/ - Per-session files: ask, ctl, model, system, thinking, context, metrics - AskWithRequest method for stateless CSP-style LLM calls - Session settings (model, temperature, thinking) are per-session - Remove old ask.go, context.go in favor of session-scoped files Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
feat(llm9p): Add per-fid session isolation and prefill support - Add SessionManager for per-fid conversation isolation - Each 9P fid now gets its own conversation history - Add FidAwareFile interface for files needing fid context - Add /n/llm/prefill file for assistant response prefill - Prefill helps keep model in character (e.g., "[Veltro]") - Update ask, new, context files to use session manager - Fix context contamination between parent and subagent Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
feat(llm): Add extended thinking support and usage tracking - Add thinking token control via /n/llm/thinking file (max/off/number) - CLI backend sets MAX_THINKING_TOKENS env var for Claude CLI - Default to max thinking (31999 tokens) for CLI backend - Add /n/llm/usage file for token usage monitoring - Add /n/llm/compact file for conversation summarization - Extend Backend interface with ThinkingTokens, TotalTokens, ContextLimit, Compact - Add true streaming support for CLI backend with line-by-line output - Update example file with thinking documentation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>