Skip to content

Guide agents to the right --type: did-you-mean hint + rich types in --help#229

Open
ivanmkc wants to merge 1 commit into
masterfrom
type-hint
Open

Guide agents to the right --type: did-you-mean hint + rich types in --help#229
ivanmkc wants to merge 1 commit into
masterfrom
type-hint

Conversation

@ivanmkc

@ivanmkc ivanmkc commented Jul 4, 2026

Copy link
Copy Markdown
Owner

What

Two small nudges that guide coding-agents (and anyone) to the correct termchart --type.

Motivation (from the agent-compat journey tests): after #219 made push reject unknown --type values, agents self-corrected to a valid but often wrong type — Claude repeatedly fell back to mermaid for architecture/ER/dashboards — because the error listed the valid set but not which one fits the intent.

Changes

  • validateContent (core): a small alias map from the wrong --type values agents actually reach for — Mermaid keywords (flowchart, erDiagram, sequenceDiagram), semantic names (comparison, architecture, line, status, table) — to the termchart type that renders that intent. The reject message now adds Did you mean "component"? plus a one-line intent→type guide. Both the CLI fast-fail and the server 400 inherit it (single source of truth).
  • CLI --help: a new "Push --type" block listing the rich viewer types (component / flow / vegalite / panes / calltree / datatable / markdown) with the intent for each, so agents stop anchoring on termchart's Mermaid-for-terminals heritage.
  • +1 unit test (validate.test.ts) covering the did-you-mean mapping.

Measured impact

Re-ran the scripts/experiments/agent-compat journey suite (scenario-only prompts; agent must pick the type):

before #219 with #219 with this
Claude Code 0/5 1/5 4/5
Gemini CLI 2/5 1/5 3/5

Only ER still misses: agents prefer Mermaid's native erDiagram (a valid, error-free push) over the rich flow entity-node journey.

Test

  • packages/viewer/test/validate.test.ts — 28 pass (incl. new did-you-mean case). No behavior change for valid types.

… rich types in help)

Motivated by the agent-compat journey tests: after #219 made `push` reject
unknown --type values, agents self-corrected to a VALID but often WRONG type
(e.g. falling back to `mermaid`) because the error listed the valid set but not
which fits the intent. Two nudges close that gap:

- validateContent: map common wrong --type values (Mermaid keywords like
  "flowchart"/"erDiagram", semantic names like "comparison"/"line") to the
  termchart type that renders that intent, surfaced as `Did you mean "X"?` plus a
  one-line intent->type guide in the reject message.
- CLI --help: a "Push --type" block listing the rich viewer types (component /
  flow / vegalite / panes / calltree / datatable / markdown) so agents stop
  anchoring on the tool's Mermaid heritage.

Measured (scripts/experiments/agent-compat): journey activation 0/5->4/5 (Claude),
2/5->3/5 (Gemini). +1 unit test.
ivanmkc pushed a commit that referenced this pull request Jul 4, 2026
…), 2/5->3/5 (Gemini)

The #229 did-you-mean/intent hint closes the journey-selection gap: agents now
self-correct to the RIGHT type (comparison->component, architecture->flow, etc.),
not just a valid one. Only ER residual (agents prefer mermaid's native erDiagram).
ivanmkc pushed a commit that referenced this pull request Jul 4, 2026
…o-activate them

Installing termchart's skills into the sandbox (diagram-recipes etc.) did NOT
improve journey activation (Claude 1/5, Gemini 2/5) — transcripts show Claude
never read the skill (read-skill=False) and kept using Mermaid keywords. Passive
availability != activation. The #229 in-error did-you-mean hint (4/5) remains the
effective lever because it lands where the agent is already looking.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants