==================
Shared directives and flow clauses
==================

instruct:
  Follow the requested output contract.

context project:
  Use the supplied project context.

agic expand(_) -> Text[]:
  lanes = default
  recall = far, near
  instruct = default
  context = project
  hands = none
  handoffs = *
  prompts = *
  user: Expand {{_}}.

agic merge(_):
  user: Incorporate {{_}} into {{_1._}}.

flow research(_):
  models = *
  tools -= *
  psyches = none
  skills = *
  services = *
  prompts = *
  lanes = 4
  recall = near, far
  instruct = default
  context = project
  hands = expand, agic:merge
  handoffs = none
  run expand
  reduce using merge:
    from:
      Initial report.
  repeat 5 times windowing 3:
    run: Improve {{_}}.
    until: Compare {{_}} with {{_1._}} and {{_2._}}.

flow seeded(_):
  run -> Text[]:
    Expand {{_}}.
  reduce:
    Incorporate {{_}} into {{_1._}}.
    from:
      Initial report.

---

(program
  (blank_line)
  (instruct
    (newline)
    (content
      (text)
      (newline)
      (blank_line)))
  (context
    (identifier)
    (newline)
    (content
      (text)
      (newline)
      (blank_line)))
  (agic
    (runnable_name)
    (params
      (param
        (param_name)))
    (type
      (builtin_type))
    (newline)
    (agic_body
      (directive
        (directive_key)
        (newline))
      (directive
        (directive_key)
        (recall_value
          (recall_source)
          (recall_source))
        (newline))
      (directive
        (directive_key)
        (newline))
      (directive
        (directive_key)
        (identifier)
        (newline))
      (directive
        (directive_key)
        (route_value)
        (newline))
      (directive
        (directive_key)
        (route_value)
        (newline))
      (directive
        (directive_key)
        (query_value)
        (newline))
      (message
        (role)
        (content
          (text))
        (newline))
      (blank_line)))
  (agic
    (runnable_name)
    (params
      (param
        (param_name)))
    (newline)
    (agic_body
      (message
        (role)
        (content
          (text))
        (newline))
      (blank_line)))
  (flow
    (runnable_name)
    (params
      (param
        (param_name)))
    (newline)
    (flow_body
      (directive
        (directive_key)
        (query_value)
        (newline))
      (directive
        (directive_key)
        (query_value)
        (newline))
      (directive
        (directive_key)
        (query_value)
        (newline))
      (directive
        (directive_key)
        (query_value)
        (newline))
      (directive
        (directive_key)
        (query_value)
        (newline))
      (directive
        (directive_key)
        (query_value)
        (newline))
      (directive
        (directive_key)
        (integer_literal)
        (newline))
      (directive
        (directive_key)
        (recall_value
          (recall_source)
          (recall_source))
        (newline))
      (directive
        (directive_key)
        (newline))
      (directive
        (directive_key)
        (identifier)
        (newline))
      (directive
        (directive_key)
        (route_value
          (runnable_ref)
          (runnable_ref))
        (newline))
      (directive
        (directive_key)
        (route_value)
        (newline))
      (run_statement
        (runnable_name)
        (newline))
      (reduce_statement
        (runnable_name)
        (newline)
        (newline)
        (content
          (text)
          (newline)))
      (repeat_statement
        (integer_literal)
        (integer_literal)
        (newline)
        (repeat_body
          (run_statement
            (inline_agic
              (content
                (text))
              (newline)))
          (until_clause
            (inline_agic
              (content
                (text))
              (newline)))
          (blank_line)))))
  (flow
    (runnable_name)
    (params
      (param
        (param_name)))
    (newline)
    (flow_body
      (run_statement
        (inline_agic
          (type
            (builtin_type))
          (newline)
          (content
            (text)
            (newline))))
      (reduce_statement
        (inline_agic
          (newline)
          (content
            (text)
            (newline)))
        (newline)
        (content
          (text)
          (newline))))))
