Skip to content

V0-09: Add Assistance Policy and local Ollama discovery #10

Closed

Description

@kiran-brahma

Parent

Part of #1.

What to build

Add the Assistance Policy foundation and first-party local Ollama discovery. A Workspace starts Manual. The thinker can select Local AI, connect only to http://localhost:11434, fetch and refresh models from Ollama's native tags endpoint, search the returned list, select a model, and understand unavailable or missing-model states.

This slice proves provider configuration and discovery but does not organize Notes yet.

Decisions

  • Assistance Policy is per Workspace: Manual, Local AI, or Cloud AI. This slice implements Manual and Local AI behavior plus the durable enum needed later.
  • New Workspaces default to Manual.
  • Local host is fixed to http://localhost:11434; no custom host field.
  • Local Ollama requires no credential.
  • Use Ollama's native /api/tags response, not OpenAI compatibility.
  • Treat model identifiers as opaque strings. Do not hard-code a catalog or infer capability from brand names.
  • Recognize cloud-capable models returned by the locally signed-in Ollama host without special authentication in Nodepad.
  • Persist selected endpoint kind and model identifier as non-secret preferences.
  • If a saved model disappears, show a typed missing-model state and require another selection; do not silently choose.
  • Switching to Manual stops future provider calls and invalidates outstanding discovery work.

Acceptance criteria

  • Every new Workspace displays Manual Assistance Policy.
  • The thinker can select Local AI and return to Manual.
  • Nodepad fetches, displays, searches, refreshes, and selects models returned from local /api/tags.
  • The selected model and policy survive restart.
  • Unavailable host, timeout, malformed response, empty list, and missing selected model have distinct actionable states.
  • Cloud-capable model names returned locally are selectable without a Nodepad cloud key.
  • No Note content is sent and no organization prompt exists in this slice.
  • No custom URL, credential, model management, or hard-coded provider catalog is introduced.

Testing decisions

  • Use controlled HTTP fixtures for tags success/failure; no live Ollama requirement in automated tests.
  • Test stale refresh cancellation, policy switch, missing model after restart, opaque identifiers, Unicode model names, and response validation.
  • UI integration covers Manual -> Local AI -> refresh/search/select -> restart -> Manual.

Blocked by

Scope fence

Do not call chat/generate, organize Notes, manage models, add direct Ollama Cloud, custom hosts, OpenRouter, OpenAI, Z.ai, or other providers.

Delivery workflow

Run prd-simplicity-audit, use a fresh implement session, then code-review, scoped fallow, focused tests and repository gates, and one PR against main.

Activity

  1. kiran-brahma commented on Jul 23, 2026

    @kiran-brahma
    OwnerAuthor

    PRD SIMPLICITY AUDIT
    Feature: V0-09 Add Assistance Policy and local Ollama discovery
    Date: 2026-07-23
    Gate: PROCEED


    MODULE MAP

    • src/workspace-client.ts: TypeScript facade; defines workspace/note types and invokes Tauri commands.
    • src/workspace-snapshot.ts: React hook that loads snapshots and submits commands.
    • src/App.tsx: Root UI orchestrator; hosts the new assistance section.
    • src-tauri/src/workspace.rs: Rust durable state, ThinkingWorkspaceInterface trait, schema, snapshots.
    • src-tauri/src/lib.rs: Tauri command registration and AppState.
    • src-tauri/src/thinking_graph.rs: Relationship rules; untouched.
    • src-tauri/migrations/*.sql: Schema evolution.

    INTERROGATION FINDINGS

    • Assistance Policy enum + default Manual: CLEAN. Add as a thinking_workspaces column; owned by the workspace module.
    • Fixed localhost:11434 host, no credential: CLEAN. Constant in the new provider module.
    • Native /api/tags discovery: CLEAN. New ollama provider module with an HTTP client trait seam.
    • Opaque model identifiers, no hard-coded catalog: CLEAN.
    • Persist selected model as non-secret preference: CLEAN. thinking_workspaces.selected_model column.
    • Missing-model state: CAUTION → keep it as a UI derivation from (snapshot.selected_model, discovered_models) rather than storing a computed flag.
    • Switching to Manual cancels/invalidates outstanding discovery: CAUTION → implement by the UI ignoring stale responses and aborting in-flight requests; provider commands remain stateless.
    • Cloud AI enum value durable but no behavior in this slice: CLEAN; schema admits the value for the next slice.

    COMPLEXITY SCORECARD
    State Surface: Medium (new durable columns + transient discovery UI state)
    Seam Quality: Preserved (provider module is a new seam; workspace module stays the durable-state seam)
    Module Cohesion: Cohesive (provider owns HTTP+tags parsing; workspace owns persistence; UI owns selection display)
    Change Blast Radius: Medium (schema, workspace trait, provider module, TS client, App UI, tests)
    Incidental Complexity Load: Mostly Problem (some incidental from Tauri HTTP setup and cancellation plumbing)

    Summary: The PRD introduces one cleanly separated concern—model discovery and assistance policy selection. Keeping the provider adapter behind a trait seam and the discovery state transient in the UI avoids tangling it with the durable workspace module. With the two cautions above handled as boundary rules, the plan is structurally sound.

    GATE DECISION: PROCEED

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agentDecision-complete and ready for an AFK agent

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions