Assuming that you have a
project.org file at the root of each project that contains the TODO items for that project, here's a simple function to do what I think you want:
(defun ndk/agenda-for-project ()
(let* ((project-name (projectile-project-name))
(org-agenda-files (list (concat project-root "project.org")))
(org-agenda-custom-commands `(("p" ,project-name tags-todo))))
It basically let-binds
org-agenda-files to a list of the single
project.org file in the project's root and
org-agenda-custom-comands to something that will show the TODO items; and then calls
org-agenda-list with the
p setting defined in the let-bound value of
org-agenda-custom-commands. You can bind the function to a key of your choice e.g.
(global-set-key (kbd "<f12>") #'ndk/agenda-for-project)
The custom agenda command is just an example for testing: you can make it as complicated as you want. I use the backquote mechanism to pass calculated values into a basically constant list as an illustration of how to do similar things in more complicated situations: it does not buy us much with the simple custom command I used.
The restriction that the Org mode file is called
project.org in every project can be relaxed a bit, but there needs to be some convention, so that the function could calculate it easily. But making it a constant is simple and not particularly restrictive IMO.
Lightly tested. Let me know how it works for you.
project.orgfile(s) are all on
org-agenda-files, so when you ask for the agenda, you get TODO items for every project? And you are interested in limiting that just to one project (the one returned by
projectile-project-nameat the current time) - is that correct?