Skip to main content

attune-forms

Structured agent ↔ user communication for AI coding agents: typed, validated forms instead of guessing or twenty questions.

Ask an agent for a security audit and it usually either guesses your intent or interrogates you one question at a time. Both failures share a root cause: free-form chat is the only channel most agents have. This library gives agents the other channel — a communication grammar of declarative, validated forms. Independent decisions batch into one round-trip; malformed questions are refused at build time; malformed answers are refused at collection time. Nothing is silently accepted in either direction.

The full argument: "A Communication Grammar for AI Agents".

Install

As a Claude Code plugin (skill + MCP server, no Python setup):

claude plugin marketplace add Smart-AI-Memory/attune-forms
claude plugin install attune-forms@attune-forms

The plugin teaches the session the forms discipline (the forms skill) and serves four MCP tools — elicitation_render_form, elicitation_render_widget, elicitation_collect_response, elicitation_ask — from this package via uvx. Decision cards, pushback cards, and progress forms work out of the box; rich HTML renders where the host supports widgets and degrades to plain questions everywhere else.

As a Python library:

pip install attune-forms

Python 3.10+, one runtime dependency (structlog), 380+ tests, CI on Linux/macOS/Windows. Apache 2.0.

The grammar

Beyond the plain field types (text, single/multi select, boolean, number, date, textarea), three constructs carry conversational meaning:

  • Decision — the agent proposes: recommended option first, a "why" rationale, a one-line tradeoff under every alternative. Validates exactly like a single-select; the enrichment is presentation.
  • Pushback — structured disagreement: your stated approach appears as an option tagged "your approach", the agent's alternative is badged and ordered first, and overruling the agent is a first-class outcome, not a failure.
  • Progress — a status report (done / in-flight / blocked) whose blocked items become a picker: reading the status and unblocking the work are the same gesture.

Quick start

from attune_forms import form_from_dict, select_form_surface, form_to_widget_html

form = form_from_dict({
    "title": "Security audit scope",
    "fields": [
        {"id": "path", "type": "text_input", "label": "Which path?"},
        {"id": "depth", "type": "single_select", "label": "How deep?",
         "options": ["quick", "standard", "thorough"]},
    ],
})
if select_form_surface(form) == "widget":
    html = form_to_widget_html(form)  # render on your widget surface

One schema, every surface

  • Renderersform_to_widget_html (self-contained interactive widget with postback), form_to_askuserquestion (batched payloads), form_to_elicitation_schema (native MCP elicitation).
  • Surface routingselect_form_surface picks widget vs fallback; a keyboard-mode opt-out is persisted per project. The form degrades — it never breaks.
  • Validationform_from_dict refuses malformed definitions; collect_form_response refuses malformed answers (required fields, option membership) with field-level problems.
  • Intake templatesFormTemplate + FieldSlot generate a workflow's intake form at ask-time from named candidate providers (PROVIDERS): tools describe what they need once, and the form exists for free.
  • Telemetry — local-only surface-decision log, disabled via DO_NOT_TRACK=1 or ATTUNE_FORMS_TELEMETRY=0. Nothing is ever phoned home.

Host integration seams

Workflow-bound intake templates need two host hooks:

import attune_forms.intake_template as it

it.WORKFLOW_SCHEMA_RESOLVER = my_schema_resolver   # name -> input schema
it.TEMPLATE_LOADERS.append(my_registration_loader)  # imports template modules

Provenance

Extracted from attune-ai's elicitation subsystem, where the grammar was designed and battle-tested; attune-ai now consumes this package. The grammar's own design decisions were made through its forms — including the review that killed one of its proposed features. See docs/communication-grammar-article.md (the verified master of the article) and CHANGELOG.md.

License

Apache 2.0. Copyright 2026 Smart AI Memory.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

attune_forms-0.4.0.tar.gz (91.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

attune_forms-0.4.0-py3-none-any.whl (57.2 kB view details)

Uploaded Python 3

File details

Details for the file attune_forms-0.4.0.tar.gz.

File metadata

  • Download URL: attune_forms-0.4.0.tar.gz
  • Upload date:
  • Size: 91.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for attune_forms-0.4.0.tar.gz
Algorithm Hash digest
SHA256 6a3ef1f98022499949ddc79300651780e12d3e985f8f736f09a259e8bde242cc
MD5 805698c8fced94821b81725cbb1dab40
BLAKE2b-256 79451c80743c6549d95d37caeca19590729b2dd02613c2ed510cd39757f354a3

See more details on using hashes here.

Provenance

The following attestation bundles were made for attune_forms-0.4.0.tar.gz:

Publisher: publish.yml on Smart-AI-Memory/attune-forms

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file attune_forms-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: attune_forms-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 57.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for attune_forms-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1f9cab4f650689a7298f28bd0e6de12cb44df25eb2a7cd61e289c7e5ee88a9a4
MD5 08cd1bfa2a6a5a491c39f172f326e6db
BLAKE2b-256 a32e37d53954ad22b2437e868aab84327a6f4b01bf0fe586c75a062d3dd1cf71

See more details on using hashes here.

Provenance

The following attestation bundles were made for attune_forms-0.4.0-py3-none-any.whl:

Publisher: publish.yml on Smart-AI-Memory/attune-forms

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page