Review: Replace Anthropic SDK with Ollama + purpose-built read-only tools

review-749-2026-04-03 Doc

review needs-refinement

Verdict: NEEDS_REFINEMENT

Template Completeness

  • [x] Type — Feature
  • [x] Lineage — Supersedes #27, references Nemo outage
  • [x] Repo — forgejo_admin/westside-ai-assistant
  • [x] User Story
  • [x] Context (excellent — documents current vs new architecture)
  • [x] File Targets (modify, create, and do-not-touch lists)
  • [x] Tool Schemas (bonus — pre-formatted I/O examples)
  • [x] Acceptance Criteria (8 items)
  • [x] Test Expectations (4 items + run command)
  • [x] Constraints
  • [x] Checklist
  • [x] Related

Traceability

  • [x] story:read-ops label — verified in project-westside-ai-assistant user-stories section
  • [x] arch:A2 label — present on board item
  • [ ] arch note MISSING — [SCOPE] No arch-A2 note found in pal-e-docs. Create architecture note arch-A2 for AI engine component.
  • [x] Forgejo issue — forgejo_admin/westside-ai-assistant#29, open

File Targets

  • [x] app/ai.py — verified: exists, contains Anthropic SDK import, anthropic.messages.create(), TOOLS list with api_get + 7 write tools, SYSTEM_PROMPT. Ticket accurately describes what needs replacing.
  • [x] app/config.py — verified: exists, contains anthropic_api_key and anthropic_model settings. No ollama settings yet.
  • [x] requirements.txt — verified: exists, contains anthropic>=0.52,<1. No pyproject.toml found (requirements.txt only).
  • [x] app/tools.py — to be created. Does not exist yet. Appropriate.
  • [x] app/basketball.py — verified: exists. Correctly marked as do-not-touch.
  • [x] app/groupme.py — verified: exists. Correctly marked as do-not-touch.
  • [ ] app/confirmation.py — ISSUE: ticket says "REMOVE" but it's listed under Context, not File Targets. Should be explicitly listed as a file to delete in the File Targets section.

Repo Placement

OK. Issue is filed on westside-ai-assistant, all file changes are within that repo. Single-repo ticket.

Dependencies

  • [x] Depends on infra ticket #30 (qwen3.5:4b deployed + env vars set). Correctly documented in Related section.
  • [x] Supersedes #27 (read-only SQL tool). Correctly documented.
  • [ ] Dependency on infra ticket should be explicit in Constraints or a "Depends on" section — currently only in Related.

Acceptance Criteria

8 AC items for a single repo. This is over the 5-AC guideline but the work is cohesive (one file rewrite + one new file + config changes). The tool schemas provide clear expected I/O which helps verification. However, 8 AC + 4 test expectations + a new file creation pushes the boundary of the 5-minute rule.

Blast Radius

Contained to westside-ai-assistant. The GroupMe webhook handler (app/groupme.py) calls process_message which is being rewritten — but the function signature is preserved (the ticket says "it calls process_message which we're changing internally"). Low external blast radius.

Decomposition

3 files to modify + 1 file to create + 1 file to delete = 5 file operations. 8 AC. Estimated agent work: borderline 5-10 minutes due to new file creation with 4 tool handlers + Ollama HTTP integration. NEEDS DECOMPOSITION into 2 tickets: (1) SDK swap + config (ai.py, config.py, requirements.txt, delete confirmation.py), (2) tool definitions (tools.py + update ai.py TOOLS list). Alternatively, a skilled agent could do it in one pass since the tool schemas are pre-defined.

Recommendation

  • [BODY] Add app/confirmation.py to File Targets as "File to delete" — currently only mentioned in Context as "REMOVE".
  • [BODY] Fix dependency reference: "requirements.txt / pyproject.toml" should be just "requirements.txt" — no pyproject.toml exists in this repo.
  • [DECOMPOSE] 5 file operations, 8 AC — borderline. Recommend decomposition into 2 sub-tickets: (1) SDK swap + config cleanup, (2) purpose-built tools. Route to skill-decompose-ticket if decomposition is desired.
  • [SCOPE] Create architecture note arch-A2 for AI engine component.