Skip to content

AI features: OpenRouter client, task breakdown and task why - #9

Merged
maxboettinger merged 14 commits into
mainfrom
feat/ai-features
Sep 3, 2026
Merged

maxboettinger merged 14 commits into
mainfrom
feat/ai-features

Conversation

@maxboettinger

Copy link
Copy Markdown
Owner

Summary

  • AI seam in src/core/ai/: an AIClient interface (chat, stream, structured) injected next to the OmniFocus client into every verb via buildProgram(client, ai). The OpenRouter SDK (pinned 1.2.100) lives in one adapter file and is imported lazily; a static-scan test enforces that non-AI runs never load it.
  • Config: --model > $OF_AI_MODEL > ~/.config/omnifocus-cli/config.json > default google/gemini-3.8-flash; key from $OPENROUTER_API_KEY or the config file, with an actionable error when missing.
  • Prompts are Markdown files in src/prompts/, embedded in the binary and overridable per user in ~/.config/omnifocus-cli/prompts/.
  • of task breakdown <ref> (of t b): structured-output plan (flat list with parent keys, validated, one repair retry) built from a new task.context bridge op; preview → revise with feedback → apply as one task.createTree bridge call. --json prints the plan and changes nothing; --json --apply applies. The preview warns when the target's sequential/parallel type would change.
  • of task why [ref] (of t w): streamed five-whys coaching session, one question per turn, ends only on Esc, Ctrl-C, Ctrl-D or /quit. Terminal-only.
  • UI primitives: ui/prompt.ts (Esc/Ctrl-C/Ctrl-D//quit handling) and withSpinner.
  • Docs: README, CLAUDE.md, CHANGELOG, Noridocs, design spec and implementation plan.

Test plan

  • bun run check, bun run typecheck, bun test (427 tests; no OmniFocus or network needed — OpenRouter adapter tested with the real SDK against a local fake endpoint)
  • Compiled binary builds; task.context verified against the live OmniFocus database
  • Live of task breakdown … --json against OpenRouter with a valid key

… Ctrl-C

The plan's sequential flag sets the target task's own type, which also
governs pre-existing subtasks. The prompt now states that, the preview
warns when the type would change and how many existing subtasks are
affected, and the breakdown request aborts cleanly on Ctrl-C like why.

Claude-Session: https://claude.ai/code/session_01L2voqEC2eEwLsiTxoSnCGD
@maxboettinger
maxboettinger merged commit 6b4f759 into main Sep 3, 2026
@maxboettinger
maxboettinger deleted the feat/ai-features branch September 3, 2026 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant