Skip to content

Feature/ai nl parser - #16

Merged
huantrinh1802 merged 7 commits into
mainfrom
feature/ai-nl-parser
Sep 19, 2026
Merged

huantrinh1802 merged 7 commits into
mainfrom
feature/ai-nl-parser

Conversation

@huantrinh1802

Copy link
Copy Markdown
Owner

No description provided.

huantrinh1802 and others added 7 commits September 19, 2026 22:39
…implicit tags

Why:
- "Buy milk and body wash tomorrow" was parsed as add "buy milk" due:tomorrow +bodywash
  — the model split a compound description and invented a tag from content words

What:
- Add explicit rules: keep the full description intact, never infer tags from
  description words, only extract attributes the user explicitly stated
- Add examples covering compound descriptions and multi-item tasks
- Rename the tags example to show explicit tag request phrasing

Impact:
- No code change; prompt-only fix

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Why:
- Users had no way to fix a slightly-off AI parse without re-running the command
- mod/done/delete examples were missing from the system prompt so the AI
  guessed poorly on existing-task operations

What:
- Replace yes/no confirm with questionary.text pre-filled with the parsed
  command; user can edit with arrow keys before a final Execute? confirm
- Empty/cleared command exits cleanly without executing
- Add mod/done/delete/clear-attribute examples to the system prompt so the
  AI reliably handles "mark task 5 done", "change priority of 7 to high", etc.

Impact:
- UX change only for twf ai; all other commands unchanged

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…erations

Why:
- Task IDs are ephemeral and hard to reference; users naturally think in
  terms of descriptions, tags, and dates when referring to existing tasks

What:
- System prompt: replace ID-based examples with filter expressions
  (description.contains:, +tag, due:date, wait.any:, project:, priority:)
  and add rules 5-7 explicitly forbidding numeric ID filters
- Add filter attribute reference section to system prompt
- main.py: after user edits the command, extract the filter portion of
  non-add commands (mod/done/delete/start/stop/complete/annotate) and run
  `task <filter>` to preview matching tasks before the Execute? confirm;
  exit cleanly if no tasks match

Impact:
- "mark the buy milk task as done" → description.contains:"buy milk" done
  → shows matching tasks → confirm → executes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Why:
- Models were hardcoded; users may want to switch to a faster/cheaper
  or more capable model without touching source code

What:
- ai.py: expose DEFAULT_MODELS dict; _parse_with_* and parse_nl_to_command
  accept optional model param, falling back to DEFAULT_MODELS[provider]
- main.py: add --model / -m CLI flag; resolution order:
  CLI flag > TW_AI_MODEL env var > ai.<provider>_model in TW_CONFIG > default
- __init__.py + conftest.py: add anthropic_model / openai_model fields
  to default and test config (empty string = use default)

Impact:
  twf ai "..." --model claude-opus-4-7
  TW_AI_MODEL=gpt-4o twf ai "..."
  TW_CONFIG ai.anthropic_model = "claude-opus-4-7"

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@huantrinh1802
huantrinh1802 merged commit abb9ab5 into main Sep 19, 2026
4 checks passed
@huantrinh1802
huantrinh1802 deleted the feature/ai-nl-parser branch September 19, 2026 13:59
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