YuanCheng (yotta-present)

v0.7.5
io.github.YottaMeta/yotta-present Checked 8 hours ago Published 3 days ago

Render agent output into copyable Markdown, tables, cards and SVG (Python 3.8+).

YottaMeta's universal result-presentation layer: take any AI output (conclusion / table / prose / chart / report), pick a presentation form via a content-type → form judgment layer, and render it as copyable Markdown / plain text (optional local SVG). Trigger: by default, any final result delivered to the user goes through yotta-present (judge → pick form → render) as copyable Markdown / plain text; explicit exceptions fall back raw — pure code / command output, error stacks / logs, long content via --out, or user’s one-liner / bare text.

Summary extracted from the README.

🆕 v0.7.0: R3 SVG card demo (open source) — --channel r3 renders editable cards (conclusion / metrics / table forms + release / weekly / compare / risk scenario templates + brand tokens); all text stays as <text> and remains editable, while Markdown keeps the copyable text version. 🆕 v0.6.6: explicit boundary for the default rendering rule — it is an opt-in enhancement, not a takeover: when the user asks for plain text or says to skip rendering, output goes out as-is, and project-specific output conventions win. Rendering never rewrites content or decisions, and a failed render falls back to the original text. 🆕 v0.6.5: pre-send self-check and block-level exception scope; fidelity now separates requested_form_preserved from content_preserved; present_result exposes a compact default MCP schema with advanced options under options (legacy top-level arguments remain compatible).

Quick start (30 seconds)

# 1. Feed a standard content object -> copyable conclusion card
python3 scripts/yotta_present.py --content '{"title": "Result", "grade": "success", "verdict": "Passed", "bullets": ["point 1", "point 2"]}'

# 2. Or feed plain text and let it polish automatically
python3 scripts/yotta_present.py --file result.txt

From "feed content" to "copyable Markdown" in two steps. More in "Commands" and "Usage".

What is this

AI outputs come in all shapes — raw text dumps, overused tables, bare JSON. yotta-present is a "presentation judgment + polish" layer: it decides what form fits the content (card / table / prose / chart / report…), applies the YottaMeta design language, and outputs copyable Markdown / plain text (local SVG when useful). The user gets something that "looks good and copies cleanly" instead of a raw dump.

It handles presentation only — it picks the form and renders it; it never rewrites content or makes value judgments for the user.

Core value

  • Unified presentation — whatever the input (JSON / Markdown / plain text), output follows one design language (title / badge / metrics / bullets / notes).
  • Content fidelity gate — inputs are parsed into ordered blocks; if a requested form cannot preserve every block and their order, yotta-present falls back to report-safe instead of silently dropping or reordering content.
  • Copyable-first — Markdown (paste into any Markdown editor) + plain text (paste into Word / email).
  • AI-driven choice — agents pick the form via the judgment layer; without an agent, yotta_present falls back deterministically, plus --form for explicit choice.
  • Local SVG — for distributions / trends / shares, the built-in 12-chart kernel renders SVG locally; Markdown embeds a data URI (self-contained, copyable) by default; with --svg it writes a local SVG file and references the path.
  • Explainable — --explain reports why a table / card was chosen.
  • Zero-dependency offline — Python 3.8+ stdlib; data never leaves the machine.

Why use it

  • Host hook declaration — skill-manifest.json declares before_send / present_result; hosts without pre-send interception get a visible explicit-unverified fallback instead of a false enforcement claim.
Advantage Description
Universal Any AI output: conclusions, comparisons, checklists, tutorials, reports, charts
Copyable Markdown + plain text dual output; SVG is an enhancement, never a blocker
Local offline 0 matplotlib / canvas / remote rendering; data stays on the machine
Judgment layer Content-type → form rules live in SKILL.md (core depth); deterministic fallback works without an agent
Explainable The reason for each form choice is available
Ecosystem distribution GitHub + npm + ClawHub; npx / git clone / Download ZIP / install.sh

Standard content object schema

{
  "title": "Security scan result",
  "grade": "success",
  "verdict": "No critical risk found",
  "metrics": [{"label": "Checks", "value": 8, "unit": "items"}],
  "bullets": ["All 8 checks passed"],
  "notes": ["Scan ran locally only"]
}

Fields: title / headline / grade|verdict / metrics[] / rows[] / bullets[] / body[] / notes[] / chart_data? / form? Full reference (rows forms, chart_data, judgment rules, examples): references/schema.md.

Markdown tables and JSON rows are both supported. Explicit --form / --template requests are checked against the source blocks (coverage + order); incompatible requests safely downgrade to report-safe and expose fallback + fidelity in JSON output.

Forms (open-source baseline: 8)

Form CLI name When
Conclusion card conclusion One conclusion / score / recommendation → badge + metrics + bullets
Table deliverable table Row/column data needing comparison or listing
Checklist card checklist Todos / key points / checklists ([x] / [ ] kept)
Prose prose Narrative / explanation / long paragraphs
Metric board metrics A set of key metrics
QA card qa Question / answer pairs
Report report Multi-section content (cards + table + prose + TOC)
Chart chart Distributions / trends / shares (local SVG, 12-chart kernel)

Commands

Command Description
--content <JSON|text> Pass content directly (JSON object or Markdown / plain text)
--file <path> Read content from a UTF-8 file
--form <form> Force a form (auto-detected by default)
--template <key> Named scenario template: vuln_report / faq / status (takes precedence over --form)
--platform <p> Platform adaptation: webchat (default) / discord / whatsapp (tables → lists, headings → bold) / plain (strip Markdown symbols)
--channel <c> Render channel (default auto, mapped from platform): r0 colorless baseline (no emoji) / r1 emoji-enhanced / r3 SVG cards (open-source demo); r2 reserved for a later release
--card <key> R3 card scenario template: release / weekly / compare / risk (requires --channel r3)
--brand <path> R3 brand token file (JSON: name / primary / accent / footer / logo; logo: local PNG/JPEG only)
--theme <t> Theme for chart / R3 cards (default light): light / dark (dark background, light text)
--max-len <n> Length cap (chars): compress lists → downgrade headings → truncate, keeping the conclusion
--md / --text / --both / --json Markdown (default) / plain text / both / full JSON
--out <path> Write to file (--both writes .md and .txt; a directory is named by form)
--svg <path> Chart form / R3 cards: local SVG output path
--explain Include the form-choice reason
--list-forms / --list-templates / --list-cards / --version List forms / templates / card templates / show version

Usage

Windows: python; Linux/macOS: python3.

# Standard content object -> copyable Markdown (default)
python3 scripts/yotta_present.py --content '{"title": "Conclusion", "grade": "success", "verdict": "Passed", "bullets": ["a", "b"]}'

# Plain text input (auto-parsed + fallback polish)
python3 scripts/yotta_present.py --file result.txt

# Mixed Markdown (tables, lists, code): explicit form is fidelity-checked; use --json to inspect fallback/fidelity
python3 scripts/yotta_present.py --file result.txt --form checklist --json

# Plain text output (paste into Word / email)
python3 scripts/yotta_present.py --content '<same as above>' --text

# Force a form + explanation
python3 scripts/yotta_present.py --content '<same as above>' --form report --explain

# Chart form: local SVG + Markdown reference
python3 scripts/yotta_present.py --content '{"chart_data": {"chart": "pie", "labels": ["A", "B"], "data": [3, 1]}}' --svg out/pie.svg

# Full JSON (for programs) / write files
python3 scripts/yotta_present.py --content '<same as above>' --json
python3 scripts/yotta_present.py --content '<same as above>' --out result.md --both

# Platform adaptation: Discord / WhatsApp (tables → lists, headings → bold) / plain terminal
python3 scripts/yotta_present.py --content '<same as above>' --platform discord
python3 scripts/yotta_present.py --content '<same as above>' --platform plain

# Render channel (default auto: plain -> r0 no-emoji, others -> r1 emoji-enhanced); force colorless baseline
python3 scripts/yotta_present.py --content '<same as above>' --channel r0
# R3 cards (open-source demo): three forms + four scenario templates, editable SVG output
python3 scripts/yotta_present.py --content '{"title": "Release", "grade": "success", "verdict": "Shipped", "metrics": [{"label": "Tests", "value": 233, "unit": "cases"}]}' --channel r3 --form conclusion --card release --svg out/release.svg
python3 scripts/yotta_present.py --content '{"title": "Weekly report", "metrics": [{"label": "Installs", "value": 186, "unit": "times", "tone": "up"}]}' --channel r3 --card weekly --theme dark
# Brand tokens: name/primary/accent/footer/logo (logo: local PNG/JPEG only)
python3 scripts/yotta_present.py --content '<same as above>' --channel r3 --card release --brand references/brand.example.json
# Theme (dark chart SVG): --theme dark (default light)
python3 scripts/yotta_present.py --content '{"chart_data": {"chart": "bar", "labels": ["A", "B"], "data": [3, 5]}}' --form chart --theme dark --svg out/bar-dark.svg

# Named scenario template (define once, reuse everywhere): vulnerability report / FAQ / status
python3 scripts/yotta_present.py --content '{"title": "SQLi", "grade": "danger", "verdict": "High risk", "rows": [["Injection point", "POST /demo.php"]], "steps": ["Step 1"], "code": "POST /demo.php HTTP/1.1", "fixes": ["Parametrized query"]}' --template vuln_report

# Length cap (token saving): compress lists, then headings, then truncate — conclusion kept
python3 scripts/yotta_present.py --content '<same as above>' --max-len 800

Exit codes: 0 = success; 1 = no input / read error; 2 = content validation or render error.

R3 cards (open-source demo)

--channel r3 renders an editable SVG card for "send-an-image" scenarios (chat groups, newsletters, email headers). Every text stays as <text>, so you can edit wording and colors directly in Inkscape / Figma / a browser.

Scenario template Form Use case
release conclusion + metrics release / acceptance result
weekly metrics weekly numbers / usage digest
compare table plan / product comparison
risk conclusion + detail table security / risk report
  • Three forms conclusion / metrics / table; unsupported forms or missing data fail with a clear error (non-zero exit + fix hint) instead of silently degrading.
  • Brand tokens: --brand <file> (name / primary / accent / footer / logo); empty by default — no watermark. Logo: local PNG/JPEG only (≤ 256 KB; SVG logos are rejected).
  • Editable standard: text-as-<text>, semantic layer ids, no scripts / external references / <foreignObject>; structure is self-checked after rendering.
  • copyable-first is unchanged: Markdown / plain text still carry the same content alongside the card.
  • Output: --svg out.svg writes the file; otherwise the SVG is embedded as a data URI in Markdown; --json exposes card.svg.

MCP usage (present_result)

The skill ships one public MCP server: yotta-present (zero dependency, data stays local). No separate chart MCP is needed — the chart form of present_result (chart_data) reuses the 12-chart kernel. The AI auto-configures this MCP on first use (writes the server entry into mcpServers and records the guardrail in permanent memory) — after obtaining your explicit consent for each persistent change; if you decline, it falls back to the CLI with identical output and no functionality is lost. Tools: present_result (with form / template / platform / channel / theme / card / brand / max_len / bold_keys / output / svg / explain), present_forms, present_templates.

{
  "mcpServers": {
    "yotta-present": {
      "command": "python",
      "args": ["<absolute path>/scripts/yotta_present_mcp.py"]
    }
  }
}
  • npx -y @yottameta/yotta-present (no install flags) starts this stdio server; Python 3.8+ is required. --agent / --dir / --list still delegate to the installer.
  • present_result: content (JSON / Markdown / plain text) + optional form / title / output(md|text|both|json) / svg / explain; form=chart + chart_data reuses the 12-chart kernel (bar / line / pie / radar / scatter / histogram / funnel / waterfall / word_cloud / sankey / spreadsheet / treemap), local SVG or data URI.
  • present_forms: list the 8 open-source baseline forms (read-only).

Install

Choose one of four (method 1 recommended):

Running the package without install flags starts the MCP server; pass --agent / --dir / --list to install.

Method 1: npx one-liner (npm registry)

npx -y @yottameta/yotta-present --agent <agent-name>    # install to the agent's default user dir (recommended)
npx -y @yottameta/yotta-present --dir <path>           # install to a custom dir
npx -y @yottameta/yotta-present --list                 # list agent -> default dir

Method 2: git clone

git clone https://github.com/YottaMeta/yotta-present.git

Method 3: Download ZIP

GitHub repo page → Code → Download ZIP, unzip into the agent's skills directory.

Method 4: install.sh

bash install.sh --agent <agent-name>    # install to the agent's default user dir
bash install.sh --dir <path>            # install to a custom dir
bash install.sh --list                  # list agent -> default dir

After install, load the skill, follow the judgment layer in SKILL.md to pick a form, and use yotta_present CLI or MCP present_result to emit copyable results.

Before / after

Input (plain text):

Scanned 8 checkpoints, all passed, no high-risk issues found.

Output (auto conclusion card, copyable Markdown):

# Scan result

> 🟢 **Passed** — No high-risk issues found

**Points**

- All 8 checkpoints passed

Tips

Tip Command / flag
Force a form --form conclusion / table / checklist / prose / metrics / qa / report / chart
See the decision reason --explain
Check content trade-offs --json returns fallback and fidelity; --explain lists preserved / compressed / dropped blocks and the order status
Save tokens --max-len 800 (compress lists, demote headings, then truncate; keep the conclusion)
Platform adaptation --platform discord / whatsapp / plain
Paste into Word / email --text plain output
Bold key fields bold_keys: ["title", "verdict"]
Named templates --template vuln_report / faq / status (definitions in references/templates.json)

Errors

  • Exit codes: 0 success; 1 no input / read error; 2 validation or rendering error.
  • On error, stderr shows the reason + a plain-language fix suggestion.
  • FAQ and pitfalls: references/faq.md.

FAQ (quick reference)

Question Answer (see references/faq.md)
No badge in output? Use a standard content object ({title, grade, verdict, bullets})
table columns ignored? Use rows object keys or 2D array + headers
chart needs chart_data? Pass chart_data (chart/labels/data)
--svg error? Chart form only; drop --svg for default data URI
Wrong form? Force --form; use --explain to see why
Will an explicit form drop content? No silent drops or reordering; incompatible forms fall back to report-safe with fallback / fidelity
Markdown table accepted? Yes; JSON rows remains the recommended structured input
MCP not loaded? Check mcpServers + restart session; otherwise fall back to CLI

Boundaries

  • Not a chart tool: charts are only one presentation form.
  • Copyable-first: Markdown + plain text dual output; SVG is an enhancement, never a blocker.
  • Data stays local: no network, no external rendering service.
  • No content judgment: presentation only — never rewrites content or makes value judgments for the user.
  • Open source: MIT-licensed; see NOTICE for trademark and brand statements.

License

MIT. Trademark and brand statements: see NOTICE.