The code comes from Grumbly, and you have to earn it. Start by asking him how his gramma is doing. That prompts him to offer you a quest: make a necklace for her.
Complete it, then do it a second time. After that he lets slip that the password is Agnes. Knowing the word is not quite enough, though — you still have to finish the quest properly before the treasure is yours.