Hi,
You can cast kcontext.getNodeInstance() to WorkItemNodeInstance and use getWorkItemId() to get the id of the work item.
You can then get the Task instance itself from the TaskServiceSession using getTaskByWorkItemId(..).
Could you maybe share your use case why you need access to the task instance id? Maybe there is another workaround as well. It's for example easy to pass the task instance itself as a result parameter of the human task.
Kris