AI refactoring: removed scope; added EntityDatabase + FilterTasks