Skip to content

Agent flavour: GitHub features for agent prose without forge references - #12

Merged
arpan404 merged 1 commit into
mainfrom
ace/agent-flavor
Oct 29, 2026
Merged

arpan404 merged 1 commit into
mainfrom
ace/agent-flavor

Conversation

@arpan404

Copy link
Copy Markdown
Owner

Summary

Adds a third rendering flavour, Flavor::Agent, for coding agents' chat answers. It draws everything Flavor::Github draws: footnotes, > [!NOTE] alerts, the allowlisted raw-HTML subset (<details>, <summary>, <kbd>, <sub>, <sup>, <picture>, <img>, <video>, with media never loading directly), task source offsets, emoji shortcodes, mermaid diagram placeholders and the GFM options. The one difference is that it leaves forge references alone: @user, @org/team, #123, owner/repo#123, commit SHAs and owner/repo@sha stay plain text. In agent prose, "step #1" or a hash in a log doesn't point at any repository.

Design

  • There is still one implementation. The github module now takes the flavour instead of hard-coding Flavor::Github. Two small capabilities on Flavor control the behaviour:
    • github_markdown() selects the GitHub pipeline, which Github and Agent both use.
    • forge_references() is true only for Github.
  • Front (the reader both HTML and native output share) turns forge_references() into TextMode::Prose { references }. Autolinking then passes that flag to the existing segments(text, references), so footnote definitions and streamed blocks follow the flavour as well.
  • render_block / block_document now take a built Front rather than its parts. This keeps them under clippy's argument limit.
  • The output of the default flavour is unchanged, and the existing goldens pass.

API per platform

  • Rust: Flavor::Agent, Flavor::from_name("agent"), Flavor::from_code(2). Works with render_html_with, parse_with, render_document_json_with, render_document_binary_with and StreamRenderer::with_flavor.
  • Wasm/web: renderHtmlFlavor(src, 'agent'), renderDocumentFlavor, MarkdownStream.webFlavor('agent'), and MarkitRenderer { flavor: 'agent' } (the worker and inline engine already pass the name through). MarkitFlavor = 'default' | 'github' | 'agent' in index.d.ts. The task, diagram, media and footnote hooks in github.js work unchanged, because they key off attributes, not flavour.
  • C: MARKIT_FLAVOR_AGENT 2u in markit.h. markit_render_flavor, markit_render_binary_flavor and markit_stream_new_flavor accept 2.
  • Swift: MarkitFlavor.agent. It works everywhere a flavour is accepted (Markit.parse, MarkitBinaryPlan.parse, MarkitStream, MarkitInlineView, MarkitInline, MarkitView/MarkitText). Nothing switches on flavour exhaustively.
  • Kotlin: MarkitFlavor.AGENT (code 2) through the existing JNI nativeRenderFlavor / nativeCreateStreamFlavor.
  • Docs: the README has a flavour comparison table. docs/integration.md now has a section called "GitHub and agent flavours" that explains when to use each flavour, and docs/binary-transport.md is updated.

Tests

  • crates/markit/tests/agent_flavor.rs:
    • agent output (HTML and native) for footnotes, alerts, <details>, <kbd>, a mermaid placeholder, task offsets and emoji is identical to GitHub's
    • @octocat, @github/docs, #12, owner/repo#3, a 40-hex SHA, owner/repo@sha and a short SHA stay plain text under Agent, including inside footnotes, but become references under GitHub
    • bare links and emoji still render
    • from_name/from_code select the flavour
  • github_stream.rs: an agent-flavour stream fed one character at a time matches a one-shot render (HTML, native text and spans) for every fixture.
  • FFI: flavour code 2 draws footnotes and no mentions across render, JSON and stream.
  • Web Playwright: a renderer with flavor: 'agent' draws a <details> block and a footnote and leaves #12 / @octocat as text. Node inline engine: same check.
  • Swift BridgeTests: .agent parses a footnote but not a mention, in one-shot and stream.
  • Kotlin NativeBridgeTest: same check.

All 5 CI jobs pass (core-and-web, ios, ios (grammars), android, android (grammars)).


Generated by Claude Code

Flavor::Agent draws everything Flavor::Github does (footnotes, alerts,
the allowlisted raw-HTML subset, task source offsets, emoji shortcodes,
mermaid diagram placeholders, GFM options) except forge references:
@user, @org/team, #123, owner/repo#123, commit SHAs and owner/repo@sha
stay plain text. Both flavours share the github pipeline, which now
takes the flavour and asks Flavor::forge_references() whether prose
links them.

Exposed as from_name("agent") / from_code(2), MARKIT_FLAVOR_AGENT,
MarkitFlavor.agent (Swift), MarkitFlavor.AGENT (Kotlin) and the web
'agent' flavour, with docs on choosing a flavour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HGundEKcKxSP6F8iQUnRZk
arpan404 pushed a commit to arpan404/ace that referenced this pull request Oct 29, 2026
markit 0dc267e (arpan404/markit#12) adds Flavor::Agent: GitHub's
footnotes, alerts, safe HTML subset, task lists and diagrams, with
@mentions, #refs and commit hashes left as text. The look test now runs
in that flavour and passes; its style lookups are inlined for the lint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HGundEKcKxSP6F8iQUnRZk
@arpan404
arpan404 merged commit 2095996 into main Oct 29, 2026
10 checks passed
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