# One snippet model feeds both renderers

> For agents: start with the [agent guide](https://ratstack.sh/llms.txt). Every page is Markdown by default; add `Accept: text/html` for HTML.

New on /news: [Foldkit 0.171.0 requires result Message schemas](/news).

The [component registry](https://github.com/joelhooks/rat-stack/blob/main/apps/site/scripts/component-registry.ts) defines agent and human renderers.
The [code-snippets design brief](/lore/code-snippets) gives both renderers one snippet model.

The proposed `CodeSnippet` carries:

- Selected source text and original line numbers.
- Highlighted lines and collapsed gaps.
- Repository, commit, path, and source link.
- Diagnostics.

HTML adds colour, a filename, numbered lines, and a source link.
Agent Markdown adds the repository, commit, path, and original line numbers, plus a Markdown code block.
Both renderers use the same source facts.

Both views preserve the same source facts.
The planned property compares each view with the pinned source.

[Whole-file tokenization](/lore/tokenize-before-slicing) supplies the tokens.
[Engine-neutral tokens](/lore/engine-neutral-tokens-keep-adapters-replaceable) keep renderer input independent of Shiki.

See [the glossary](/glossary) for snippet model and renderer parity, the term for views preserving the same source facts.

## Sources

1. [Component registry](https://github.com/joelhooks/rat-stack/blob/main/apps/site/scripts/component-registry.ts)
   Primary source. Agent and human renderers Accessed 2026-10-02.

2. [Code-snippets design brief](https://github.com/joelhooks/rat-stack/blob/main/.brain/resources/lore/code-snippets.svx)
   Primary source. Shared CodeSnippet model Accessed 2026-10-02.

## Lore on this page

- [Pin the source and report drift separately](/lore/pinned-sources-can-report-drift)

## Linked from

- Agent guide → An Effect stack so pure (aspirational) Kit Langton will blush. → [Read page](https://ratstack.sh/llms.txt)

- Change log → What changed in the files served here, newest first. → [Read page](https://ratstack.sh/log)

- Code snippets quote a pinned source → Shipped design brief: pinned Git objects, typed diagnostics, and one build-only snippet model for both views. → [Read page](https://ratstack.sh/lore/code-snippets)

- Engine-neutral tokens keep adapters replaceable → The highlighter port exposes text, roles, and font styles rather than Shiki types. → [Read page](https://ratstack.sh/lore/engine-neutral-tokens-keep-adapters-replaceable)

- Full agent guide → An Effect stack so pure (aspirational) Kit Langton will blush. → [Read page](https://ratstack.sh/llms-full.txt)

- Rat Stack lore | rat-stack → Short, source-grounded notes on the ideas and decisions behind rat-stack. → [Read page](https://ratstack.sh/lore)

- Source change history (log.md) → The generated change log as Markdown. → [Read page](https://ratstack.sh/log.md)

- Tokenize the whole file before slicing → Select lines after tokenization so preceding code still guides recognition of multiline strings and comments. → [Read page](https://ratstack.sh/lore/tokenize-before-slicing)
