==================
Package manifest
==================

> package: kedi_http:
  author: Mert Sirakaya
  contact: mert@kedi-lang.org
  version: 1.0
  source: src/kedi_http
  python: python@3.11-3.14
  license: Apache-2.0
  python_dependencies:
    httpx>=0.27
    pydantic>=2.0

---

(source_file
  (package_directive
    name: (identifier)
    body: (package_body
      (package_field
        name: (identifier)
        value: (package_plain_value))
      (package_field
        name: (identifier)
        value: (package_plain_value))
      (package_field
        name: (identifier)
        value: (package_plain_value))
      (package_field
        name: (identifier)
        value: (package_plain_value))
      (package_field
        name: (identifier)
        value: (package_plain_value))
      (package_field
        name: (identifier)
        value: (package_plain_value))
      (package_python_dependencies
        body: (package_dependency_body
          (package_dependency
            value: (package_dependency_value))
          (package_dependency
            value: (package_dependency_value)))))))

==================
Submodule and selective import
==================

> import: package/services:
  fetch
  Response

---

(source_file
  (module_import
    module: (module_path
      (identifier)
      (identifier))
    body: (module_import_body
      (module_import_name
        name: (identifier))
      (module_import_name
        name: (identifier)))))

==================
Whole submodule import
==================

> import: package/services

---

(source_file
  (module_import
    module: (module_path
      (identifier)
      (identifier))))

==================
Artifact policy directive
==================

> artifacts:
  enabled: true
  threshold: 100kb
  idle_ttl: none
  cleanup_interval: `timedelta(seconds=5)`

---

(source_file
  (artifacts_directive
    body: (artifacts_body
      (artifacts_field
        name: (identifier)
        value: (artifacts_plain_value))
      (artifacts_field
        name: (identifier)
        value: (artifacts_plain_value))
      (artifacts_field
        name: (identifier)
        value: (artifacts_plain_value))
      (artifacts_field
        name: (identifier)
        value: (inline_python_expr
          code: (python_inline_body))))))

==================
History policy in lexical scopes
==================

> history: enabled

> profile: isolated:
  > history: disabled

@remember():
  > history: enabled
  [answer] << Remember this value.
  = `answer`

---

(source_file
  (history_directive
    value: (history_plain_value))
  (profile_directive
    name: (identifier)
    body: (profile_body
      (history_directive
        value: (history_plain_value))))
  (procedure_def
    name: (identifier)
    body: (block
      (history_directive
        value: (history_plain_value))
      (raw_invoke_stmt
        target: (binding_target
          name: (identifier))
        prompt: (template_prompt_expr
          (text_segment)))
      (return_stmt
        value: (inline_python_expr
          code: (python_inline_body))))))

==================
Expanded history and native compaction settings
==================

> history:
  enabled: true
  compaction_mode: native
  compaction_threshold: `100_000`

---

(source_file
  (history_directive
    body: (history_body
      (history_field
        name: (identifier)
        value: (settings_plain_value))
      (history_field
        name: (identifier)
        value: (settings_plain_value))
      (history_field
        name: (identifier)
        value: (inline_python_expr
          code: (python_inline_body))))))

==================
CodeMode policy and limits in lexical scopes
==================

> codemode: enabled

> profile: bounded:
  > codemode:
    enabled: true
    max_nested_calls: 12
    request_timeout: 30

@inspect():
  > codemode: disabled
  = done

---

(source_file
  (codemode_directive
    value: (codemode_plain_value))
  (profile_directive
    name: (identifier)
    body: (profile_body
      (codemode_directive
        body: (codemode_body
          (codemode_field
            name: (identifier)
            value: (settings_plain_value))
          (codemode_field
            name: (identifier)
            value: (settings_plain_value))
          (codemode_field
            name: (identifier)
            value: (settings_plain_value))))))
  (procedure_def
    name: (identifier)
    body: (block
      (codemode_directive
        value: (codemode_plain_value))
      (return_stmt
        value: (template_expr
          (text_segment))))))

==================
Skills policy in lexical scopes
==================

> skills: enabled

> profile: researcher:
  > skills: disabled

@review():
  > skills:
    enabled: true
    cwd: workspace
    max_skills: 12
    include_registry: false
    include_all: true
    exclude_paths: `["~/.agents/skills"]`
  = done

---

(source_file
  (skills_directive
    value: (skills_plain_value))
  (profile_directive
    name: (identifier)
    body: (profile_body
      (skills_directive
        value: (skills_plain_value))))
  (procedure_def
    name: (identifier)
    body: (block
      (skills_directive
        body: (skills_body
          (skills_field
            name: (identifier)
            value: (settings_plain_value))
          (skills_field
            name: (identifier)
            value: (settings_plain_value))
          (skills_field
            name: (identifier)
            value: (settings_plain_value))
          (skills_field
            name: (identifier)
            value: (settings_plain_value))
          (skills_field
            name: (identifier)
            value: (settings_plain_value))
          (skills_field
            name: (identifier)
            value: (inline_python_expr
              code: (python_inline_body)))))
      (return_stmt
        value: (template_expr
          (text_segment))))))

==================
Hook policy in lexical scopes
==================

> hooks:
  user_prompt_submit: `redact_pii`
  pre_tool_use: `[validate_path, audit_call]`

> profile: audited:
  > hooks: disabled

@run():
  > hooks: enabled
  = done

---

(source_file
  (hooks_directive
    body: (hooks_body
      (hooks_field
        name: (identifier)
        value: (inline_python_expr
          code: (python_inline_body)))
      (hooks_field
        name: (identifier)
        value: (inline_python_expr
          code: (python_inline_body)))))
  (profile_directive
    name: (identifier)
    body: (profile_body
      (hooks_directive
        value: (hooks_plain_value))))
  (procedure_def
    name: (identifier)
    body: (block
      (hooks_directive
        value: (hooks_plain_value))
      (return_stmt
        value: (template_expr
          (text_segment))))))

==================
Auto directive in procedure body
==================

@summarize(text: str) -> str:
  > auto:
    Takes a long text and produces a concise summary.
    Preserves key information.

= done

---

(source_file
  (procedure_def
    name: (identifier)
    params: (param_list
      (param
        name: (identifier)
        type: (type_expr
          (type_ref
            name: (identifier)))))
    return_type: (type_expr
      (type_ref
        name: (identifier)))
    body: (block
      (auto_directive
        body: (auto_body
          (template_line
            (template_expr
              (text_segment)))
          (template_line
            (template_expr
              (text_segment)))))))
  (return_stmt
    value: (template_expr
      (text_segment))))

==================
Optimize directive with template span
==================

@solve(items: str) -> int:
  > optimize: solver:
    Items: <items>
    Pick the best.
    Reasoning: [reasoning: str]
    Total: [value: int]

  = `value`

---

(source_file
  (procedure_def
    name: (identifier)
    params: (param_list
      (param
        name: (identifier)
        type: (type_expr
          (type_ref
            name: (identifier)))))
    return_type: (type_expr
      (type_ref
        name: (identifier)))
    body: (block
      (optimize_directive
        name: (identifier)
        body: (optimize_body
          (template_line
            (template_expr
              (text_segment)
              (input_segment
                name: (identifier))))
          (template_line
            (template_expr
              (text_segment)))
          (template_line
            (template_expr
              (text_segment)
              (output_segment
                name: (identifier)
                type: (type_expr
                  (type_ref
                    name: (identifier))))))
          (template_line
            (template_expr
              (text_segment)
              (output_segment
                name: (identifier)
                type: (type_expr
                  (type_ref
                    name: (identifier))))))))
      (return_stmt
        value: (inline_python_expr
          code: (python_inline_body))))))

==================
Optimize body allows whitespace-only blank lines
==================

@solve(items: str) -> int:
  > optimize: solver:
    Items: <items>
    
    Total: [value: int]

  = `value`

---

(source_file
  (procedure_def
    name: (identifier)
    params: (param_list
      (param
        name: (identifier)
        type: (type_expr
          (type_ref
            name: (identifier)))))
    return_type: (type_expr
      (type_ref
        name: (identifier)))
    body: (block
      (optimize_directive
        name: (identifier)
        body: (optimize_body
          (template_line
            (template_expr
              (text_segment)
              (input_segment
                name: (identifier))))
          (template_line
            (template_expr
              (text_segment)
              (output_segment
                name: (identifier)
                type: (type_expr
                  (type_ref
                    name: (identifier))))))))
      (return_stmt
        value: (inline_python_expr
          code: (python_inline_body))))))

==================
Agent effort directive
==================

> model: openrouter:google/gemini-3-flash-preview
> effort: high
> profile: careful:
  > effort: max
  > model: `model_name`
> use: careful

@answer():
  > effort: low
  >> done [value]

---

(source_file
  (model_directive
    value: (model_plain_value))
  (effort_directive
    value: (effort_plain_value))
  (profile_directive
    name: (identifier)
    body: (profile_body
      (effort_directive
        value: (effort_plain_value))
      (model_directive
        value: (inline_python_expr
          code: (python_inline_body)))))
  (use_directive
    name: (identifier))
  (procedure_def
    name: (identifier)
    body: (block
      (effort_directive
        value: (effort_plain_value))
      (template_block_stmt
        head: (template_prompt_expr
          (text_segment)
          (output_segment
            name: (identifier)))))))

==================
Profile subagent directive
==================

> profile: planner:
  > model: test
  > output: list[str]
> profile: implementor:
  > subagent: planner
  > max_agents: 5
  > workflow: dynamic

---

(source_file
  (profile_directive
    name: (identifier)
    body: (profile_body
      (model_directive
        value: (model_plain_value))
      (output_directive
        type: (type_expr
          (type_apply
            name: (identifier)
            args: (type_arg
              (type_ref
                name: (identifier))))))))
  (profile_directive
    name: (identifier)
    body: (profile_body
      (subagent_directive
        name: (identifier))
      (max_agents_directive
        value: (positive_integer))
      (workflow_directive
        value: (identifier)))))
