AI Task Planner in Mobile Applications
An AI task planner is more than a chat bot that adds items to a to-do list. It integrates natural language with real logic: deadline parsing, priority setting, workload awareness, and synchronization with native calendars.
Parsing Tasks from Natural Language
A user writes "Call Igor by end of week about the presentation, important"—the system must extract: task title, deadline, priority, and possibly contact association.
Function calling in OpenAI is the right tool:
let tools: [[String: Any]] = [{
"type": "function",
"function": {
"name": "add_task",
"description": "Add a task extracted from user input",
"parameters": {
"type": "object",
"properties": {
"title": {"type": "string", "description": "Task title, concise"},
"due_date": {"type": "string", "format": "date-time", "description": "ISO 8601 deadline if mentioned"},
"priority": {"type": "string", "enum": ["low", "medium", "high", "urgent"]},
"tags": {"type": "array", "items": {"type": "string"}},
"contact_name": {"type": "string", "description": "Person involved if mentioned"}
},
"required": ["title"]
}
}
}]
Context for the prompt is mandatory: current date/time and timezone, otherwise "by end of week" won't parse correctly.
let systemPrompt = """
Today is \(ISO8601DateFormatter().string(from: Date())).
Timezone: \(TimeZone.current.identifier).
Extract task details from user input. For relative dates ('next week', 'tomorrow', 'end of week'), calculate exact dates.
"""
Smart Priority Reordering
Users are poor at setting priorities themselves—everything feels urgent. AI can reassess the task queue based on deadlines and patterns.
struct TaskPrioritizationInput: Encodable {
let tasks: [TaskItem]
let currentDateTime: String
let workingHoursPerDay: Int
}
// Request priority reassessment
func reprioritize(_ tasks: [TaskItem]) async throws -> [TaskItem] {
let input = TaskPrioritizationInput(
tasks: tasks,
currentDateTime: ISO8601DateFormatter().string(from: Date()),
workingHoursPerDay: userSettings.workHours
)
let prompt = """
Reorder these tasks by urgency+importance matrix.
Consider deadlines and estimated durations.
Mark overdue tasks as urgent.
Return the same array with updated priority field.
Current tasks: \(try JSONEncoder().encode(input).utf8String)
"""
let response = try await openAI.chat(messages: [.system(prompt)])
return try JSONDecoder().decode([TaskItem].self, from: response.text.data(using: .utf8)!)
}
EventKit Integration (iOS) and ContentProvider (Android)
An AI planner without system calendar sync is half-useful. EventKit on iOS provides access to Calendar and Reminders.
import EventKit
class CalendarIntegration {
let store = EKEventStore()
func addReminder(for task: TaskItem) async throws {
let granted = try await store.requestFullAccessToReminders()
guard granted else { throw IntegrationError.permissionDenied }
let reminder = EKReminder(eventStore: store)
reminder.title = task.title
reminder.priority = task.priority.ekPriority // Int 1-9
reminder.calendar = store.defaultCalendarForNewReminders()
if let due = task.dueDate {
let components = Calendar.current.dateComponents(
[.year, .month, .day, .hour, .minute],
from: due
)
reminder.dueDateComponents = components
reminder.addAlarm(EKAlarm(relativeOffset: -3600)) // -1 hour reminder
}
try store.save(reminder, commit: true)
}
}
On Android, use CalendarContract for calendar events. ReminderProvider isn't system-accessible; use AlarmManager + NotificationManager for reminders.
Daily AI Briefing
Generate a short daily plan at app launch based on current tasks. This isn't a full chat—single prompt-to-text generation:
func generateDailyBrief(tasks: [TaskItem]) async throws -> String {
let todayTasks = tasks.filter { task in
guard let due = task.dueDate else { return task.priority == .urgent }
return Calendar.current.isDateInToday(due) || due < Date()
}
let prompt = """
Create a short (3-5 sentences) morning briefing for the user's day.
Focus on what's most urgent and what should be done first.
Be direct and practical, not motivational.
Tasks: \(todayTasks.map { "\($0.title) [priority: \($0.priority), due: \($0.dueDate?.formatted() ?? "today")]" }.joined(separator: "; "))
"""
return try await openAI.complete(prompt: prompt)
}
Voice Input for Tasks
Most task additions in mobile apps happen via voice—quick, no typing. On iOS use SFSpeechRecognizer, on Android use SpeechRecognizer API.
Importantly: don't wait for the phrase to end. Use .continuous mode and process transcripts at pauses > 1.5 seconds.
recognitionRequest.shouldReportPartialResults = true
recognitionTask = recognizer.recognitionTask(with: recognitionRequest) { [weak self] result, error in
guard let result else { return }
self?.lastTranscript = result.bestTranscription.formattedString
if result.isFinal {
self?.processVoiceInput(self?.lastTranscript ?? "")
}
}
After transcription, text goes through the same function calling pipeline as text input.
Timeline Estimates
Basic task input via natural language + function calling—3–5 days. Full planner with prioritization, CalendarKit integration, daily briefing, and voice input—3–5 weeks.







