/htmx-php-builder:chat-actionsfrom htmx-php-builder
Builds a voice-first chat command bar that routes natural language utterances to MCP tools for navigation and application actions. Useful when adding chat-driven navigation or voice-to-data capture to any screen.
Ships in htmx-php-builder. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Every application ships a persistent chat command bar. The user says (or types) what they want — "record three sets of bench press at 45 pounds", "navigate to the screen to create a new exercise" — and the assistant does it, using both the utterance and the context of the screen they're on. Input is chat-shaped but voice-first: users dictate via tools like Wispr Flow, so utterances are conversational, unpunctuated, and reference the visible screen ("add ten pounds to that").
Every screen: fixed bottom command bar (#assistant-bar)
│ hx-post /assistant/message.php (+ screen context)
▼
PHP handler (session auth, CSRF, activity log; mints a signed action token)
▼
Unified assistant service — Python, Claude Agent SDK (the SAME agent as AMA)
│ LLM processes the utterance and routes it by activating an MCP tool
▼
{app}_actions_mcp (Python + FastMCP, localhost-only) + the two read servers
├─ navigate(screen, …) → resolves via the screen registry, returns a directive
├─ {entity}_{action}(…) → POSTs to the app's own PHP endpoints (action token)
└─ undo_last(…) → inverse action from the manifest + activity log
html/{feature}/save.php-style endpoints a human uses — same validation, same authorization, same activity logging. The read MCP servers stay strictly read-only; nothing ever writes around the PHP layer.When the application is an application of the MaluDB Business OS (the os-application skill, the default), the
assistant is the kernel's, not the application's: the command bar posts the utterance to the kernel's chat endpoint
(POST {OS_INTERNAL_URL}/api/v1/agents/chat.php?agent=expert, the application token, X-Acting-Member), the kernel runs ONE
turn of the application's expert with the application's tools attached, every model call ledgered, approvals paused in
the kernel's queue, and answers the reply and the actions taken. The application holds no model key and ships no
assistant service and no actions server; the kernel's actions server turns the application's registry
(mcp/action_registry.json, built from the manifest) into tools that POST the application's own handlers on its
loopback port with the tenant's signed token — so handlers answer in JSON mode (emit_action_status(),
{ok, location} / 422 {error}) as well as HTMX. The UI, the manifest discipline and everything below about
utterances, context and HX-Trigger refreshes are unchanged; only who runs the model and the tools moves. A product
that must also run standalone keeps its own service behind OS_ENABLED=0.
The sibling of the MCP tool surface: a designed registry, not an afterthought.
navigate resolves against — the navigation router's routing table.exercise_record_set), target endpoint, parameter schema, natural-language trigger description, undo definition (the inverse: delete the created row / restore prior values), and whether it may execute immediately or must confirm.Worked tool definitions — the navigate description/registry pattern and the slot-filling action-tool schema (unit-bearing field names, bounds, server-side entity resolution) — are in references/tool-authoring.md; read it before writing any actions-server tool.
navigate tool contract (the router's core)The single-tool-then-end-turn loop is the pattern: tool_use(navigate) → structured success → the model confirms in one sentence and ends the turn. Two model calls per command; run it at low effort.
screen (a registry id) + optional params (dict). Params map to the canonical URL's query string — navigate("exercise-add", {"name": "Bench Press"}) → /exercises/new?name=Bench+Press, and the GET controller pre-fills from query params like any request. Compound utterances ("go to create exercise and call it bench press") stay ONE call.{"status": "success", "navigate": {"path": "...", "target": "#page-content"}}. The assistant service extracts the navigate directive from the tool result and hands it to the PHP handler, which emits HX-Location; the browser executes the swap after the loop ends. A bare "success" string is a bug — the directive must live in the result.end_turn instead of a wasted verify cycle. The tool must not claim post-navigation knowledge (annotations: idempotentHint: true, destructiveHint: false — it changes client view state, never records).Action tools follow the same shape: structured result (status, what was done, undo handle), terminal semantics, and any screen-refresh consequence expressed as an HX-Trigger event name in the directive rather than knowledge of the screen's markup.
hx-confirm on the rendered confirm control, or a spoken "yes" turn).| Assistant outcome | Response mechanism |
|---|---|
| Navigation | HX-Location: {"path": "<canonical URL>", "target": "#page-content"} — the shell swaps and pushes the explicit URL (never hx-push-url="true") |
| Data action | Reply bubble + HX-Trigger: {entity}Changed — screens listening per Pattern D refresh their own regions; the assistant knows nothing about their markup |
| Answer (AMA-style) | Reply bubble in the command bar thread (full conversations live on the AMA page) |
#assistant-bar with input #assistant-input, send #assistant-send-btn. Slim, always visible; the shell footer (#page-footer) is pinned directly above it; full-width and thumb-reachable on mobile; never overlaps #page-content scroll (the shell measures the bar into --assistant-bar-height, which pads the body and sizes the footer pin, per the design system's app-overrides.css).#assistant-form has focus or #assistant-input holds text; otherwise the bar is just the input (plus the transcript button). A permanently visible Send at the bottom of every screen was mistaken for the page's Save button, which sits at the top of the form. Pure CSS in the design system's app-overrides.css (no JS): the form has class assistant-form, #assistant-send-btn follows #assistant-input in the same .input-group, and the input has a non-empty placeholder (the rule keys on :placeholder-shown). Focus on the button itself keeps it visible, so a click is never lost; Enter submits as always.<form id="assistant-form" class="assistant-form" hx-post="/assistant/message" hx-target="#assistant-reply" hx-swap="innerHTML">
<div class="input-group">
<span class="input-group-text"><i class="feather-message-circle"></i></span>
<input type="text" class="form-control" id="assistant-input" name="message" autocomplete="off"
placeholder="Say what you want to do, or ask a question (Ctrl+K)" />
<button type="submit" class="btn btn-primary" id="assistant-send-btn"><i class="feather-send"></i><span class="d-none d-sm-inline ms-2">Send</span></button>
<button type="button" class="btn btn-light-brand" id="assistant-transcript-btn" data-bs-toggle="offcanvas" data-bs-target="#assistant-transcript" title="Conversation"><i class="feather-list"></i></button>
</div>
</form>
#assistant-reply expanding upward from the bar; full history in the offcanvas transcript #assistant-transcript (full-width on mobile). No modals.Ctrl/Cmd+K (and / outside inputs) focuses the input — dictation tools type into the focused field, so focus-fast matters more than any mic button. Enter submits; the input clears and refocuses for the next utterance.#page-content with data-screen, data-entity, data-record-id; the bar submits them via hx-vals (js) alongside the text. This is how "that" resolves./assistant/stream directly to the assistant service.hx-ext="sse"): the AMA page streams long answers into its thread; the command bar may stream progress ("still working…") into #assistant-reply during multi-second agent loops. Command-bar router turns (two model calls at low effort) normally need no stream — a plain POST with an htmx indicator suffices.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub maludb/maludb-os-htmx-php-guidelines --plugin htmx-php-builder10 skills in this plugin
/design-systemThe mandatory UI design system for applications built with this plugin — Bootstrap 5.3 admin template (nxl theme) with fixed layout, component patterns, and mobile-first rules. Use before generating or editing ANY page, screen, partial, or HTML in an application built with this plugin, and when the user mentions look and feel, styling, layout, or UI consistency./malumail-sendSend transactional email through the MaluMail API (api.malumail.com) and integrate MaluMail sending into an application. Use when an app needs to send email programmatically — welcome/verification/receipt/notification/password-reset messages, alerts, or any outbound mail — through MaluMail; when wiring up MaluMail sending; when managing a MaluMail suppression list; or when debugging MaluMail send failures (401/403/429/502, verified sending domains, API keys, Bearer auth). Triggers on "send email via MaluMail", "MaluMail API", "api.malumail.com", "transactional email", "suppression list"./mcp-serversDesign and build the two MCP servers every application ships — the record-memory server over PostgreSQL 17 and the activity-memory server over MaluDB — in Python with FastMCP, exposed to the app's AMA agent and to clients' own AI tools. Use during Phase 1 (tool-surface design) and when implementing, deploying, or extending an application's MCP servers./memory-first-planningBackground context for planning or brainstorming a new application or SaaS product — memory-first design, the ask-me-anything view of applications, SaaS Plus+ data sovereignty, and the default technical stack (PostgreSQL 17 + MaluDB, Apache/PHP/Bootstrap 5.3/HTMX). Provides answers and direction, not a workflow to run./new-appStart building a new HTMX + PHP + Bootstrap 5.3 application. Use when the user says "new app", "start a new application", "build an app", "begin the project", or invokes /new-app. Enforces the fixed build order — full database + memory design first, then authentication + app shell, then vertical feature slices — on the standard stack (Ubuntu 24.04, PostgreSQL 17 + MaluDB, Apache, PHP, HTMX)./new-screenGenerate a new screen (list, detail, create/edit form, report, or settings page) in an HTMX + PHP + Bootstrap 5.3 application built with this plugin. Use when the user asks to "add a screen", "create the customers page", "build the edit form", or invokes /new-screen. Guarantees every screen matches the design system and mobile rules.Other plugins' skills for the same job