phase("end").
keyword_said(Keyword) :- (user_said(Message) & .substring(Keyword, Message, Pos)) & (Pos >= 0).


+!reply_with_goal(Goal)
  :   user_said(Message)
  <-  +responded_this_turn;
      .findall(Norm, norm(Norm), Norms);
      .reply_with_goal(Message, Norms, Goal).

+!say(Text)
  <-  +responded_this_turn;
      .say(Text).

+!reply
  :   user_said(Message)
  <-  +responded_this_turn;
      .findall(Norm, norm(Norm), Norms);
      .reply(Message, Norms).

+!notify_cycle
  <-  .notify_ui;
      .wait(1).

+user_said(Message)
  :   phase("end")
  <-  .notify_user_said(Message);
      !reply.

+!check_triggers
  <-  true.

+!transition_phase
  <-  true.
