Skip to content

Make cht-conf AI-agent friendly #801

@inromualdo

Description

@inromualdo

Is your feature request related to a problem? Please describe.
AI coding agents working on CHT configuration projects frequently make mistakes because they lack accurate, documentation about cht-conf actions, project structure, form conventions, and CHT app building patterns.

These are common agent mistakes:

  • Putting forms in wrong directories (e.g., contact forms in forms/app/ instead of forms/contact/)
  • Missing or malformed .properties.json companion files for forms
  • Using outdated or non-existent cht-conf flags and action names
  • Generating invalid tasks.js / targets.js schemas (wrong event properties, missing required fields)
  • Deploying changes blindly with no way to verify the instance state or diagnose errors
  • Missing CHT-specific XLSForm patterns (db-doc references, xml-external itemsets, contact-summary field access)

Describe the solution you'd like
2 phases of work to make cht-conf AI-agent friendly:

Phase 1: Bundled Documentation + AGENTS.md + llms.txt

Why: Always-available local documentation outperforms on-demand retrieval. Agents with bundled docs achieve 100% accuracy vs 79% with skill-based retrieval and 53% with no docs (Vercel research).

Change Repo Reason
Hugo Markdown output format using .RenderShortcodes medic/cht-docs CHT docs use Hugo shortcodes (read-content, figure, callout) that make raw Markdown incomplete for AI consumption. A custom output format produces clean .md files with all shortcodes resolved and partials inlined.
llms.txt site index medic/cht-docs Standard adopted by 844K+ sites that gives AI tools a structured index of all available documentation pages. Near-zero effort addition to the Hugo config.
Bundle curated CHT docs in npm package medic/cht-conf Ship ~10-15 key CHT doc pages (forms, tasks, targets, contact-summary, app_settings) in dist/docs/cht/ so agents have offline, version-matched docs after npm install.
Write cht-conf-specific docs medic/cht-conf 3 Markdown files covering: action reference (all 42+ actions), project directory structure, and form conventions. These document what agents get wrong most often.
cht update-docs action medic/cht-conf Since CHT docs live in a separate repo, they may update between cht-conf releases. This action fetches fresh docs to ~/.cht-conf/docs/ with a staleness notice when bundled docs are >30 days old.
initialise-project-layout generates AGENTS.md + CLAUDE.md medic/cht-conf New projects get agent instructions pointing to the bundled docs out of the box, following the AGENTS.md standard supported by 25+ AI coding tools.
cht agents-md codemod medic/cht-conf One command for existing projects to generate AGENTS.md + CLAUDE.md, documented in README.

Phase 2: cht inspect Commands

Why: Agents currently deploy changes blindly — they can't verify what's actually on the instance. The purpose is to turn the running instance into something an agent can reason about from the terminal.

Command Reason
cht inspect-forms List all deployed forms — agents need to verify uploads succeeded
cht inspect-form <id> Show fields, calculations, media — agents need to diagnose form issues
cht inspect-settings-diff Compare local vs deployed app_settings — agents need to know what's out of sync
cht inspect-transitions Show transitions + deprecation warnings — currently only visible during upload
cht inspect-hierarchy Show contact hierarchy tree — agents need to understand the data structure
cht inspect-targets Show target definitions from deployed settings
cht inspect-tasks Show task definitions and schedules from deployed settings
cht inspect-replication Show replication status and pending changes
cht inspect-errors Show recent Sentinel + API errors — currently requires manual log inspection

All commands output human-readable text by default with a --json flag for machine-parseable output (following the pattern used by Terraform, Docker, and the agent-friendly CLI conventions).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions