Indeed, _C. elegans_ nematodes (which are the ones you are talking about) do not show cognitive responses. AFAIK, _Drosophila melanogaster_ is also able to learn and display some quite complex behaviors, but no cognitive functions. I believe the "simplest" organism known to display what could be called "cognitive" functions is the honeybee (see for example this article).
But as to your question:
> to demonstrate something more than mere scripted actions
I would also ask "what is a scripted action?" and to what extend a complex, cognitive response from a monkey or a human isn't also scripted (though through many different interacting pathways)?