dev@bfd:~/dev-diary$ git show 2026-01
commit 2026-01-22-scaffold-directory-scoped-ollama-agent-cli
Author: MJ
Date: Jan 22, 2026

2026-01-22 - Scaffold directory-scoped Ollama agent CLI

Timeline

  • (Context) Needed a simple global terminal command to run an Ollama model with direct, directory-scoped tool access.
  • (Action) Reviewed the Ollama agent CLI codebase and selected a Python CLI “agent runner” approach (wrapper around local Ollama chat calls plus a tool execution loop).
  • (Action) Scaffolded a new oa CLI package (pyproject.toml, core CLI modules, .ollama-agent.yaml, README.md) with a predetermined toolset and workspace sandboxing.
  • (Observation) pip install -e . initially failed due to an invalid TOML header in pyproject.toml; corrected [build-system] and reinstalled successfully.
  • (Action) Verified oa --help and wrote project config via oa init --force.
  • (Observation) pipx was not available on PATH; installed pipx and ran pipx install . to make oa globally available.
  • (Observation) Non-interactive smoke testing via bash redirection to NUL failed (Windows device name mismatch); interactive testing remains the intended path.
  • (Open Thread) Validate tool-calling behavior across target Ollama models; add a JSON “tool request” fallback mode for models without tool_calls.

Context

  • Needed a minimal “initialize from anywhere” workflow to run an Ollama model with direct access to a chosen directory and a fixed toolset.
  • Working in the Ollama agent CLI project on Windows; no git repo context to rely on for commit-time timestamps.

Actions

  • Read Ollama agent CLI files and converged on a Python-based wrapper as the most robust way to actually execute tools.
  • Implemented oa CLI commands (oa, oa chat, oa init) with config resolution (global + per-project) and a workspace-root sandbox.
  • Implemented tool schemas and executors: directory listing, glob, grep, read/write file, patch apply, and cwd-pinned shell command execution.
  • Fixed packaging issue in pyproject.toml and verified install via python -m pip install -e ..
  • Installed pipx, ensured PATH, and installed the CLI globally via pipx install ..

Observations

  • Packaging failed fast on invalid TOML; once corrected, editable install worked and oa --help confirmed the Typer CLI wiring.
  • pipx was missing initially, but installation + PATH setup resolved it; oa.exe is now available globally.
  • Tool-loop and sandboxing are in place, but real-world validation depends on Ollama model support for function/tool calling.

Open Threads

  • Confirm Ollama model tool-call compatibility for the specific models you plan to use; implement a JSON-emitting fallback (Modelfile-style) when needed.
  • Make apply_patch more robust (better diff parsing, clearer failure messages, and basic tests).
  • Add an optional non-interactive mode (oa run --prompt ...) and transcript logging for repeatable sessions.
  • Expand shell safety policy (configurable allowlist/denylist; optional confirmation gates).

Boundary Reminder: Seeds. No maintenance. No roadmap.