# Engine-neutral tokens keep adapters replaceable

> 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).

A highlighter port is an interface for highlighting code, independent of the chosen highlighting tool.
This follows [ports and adapters](/lore/hexagonal-architecture).

The [code-snippets design brief](/lore/code-snippets) specifies an engine-neutral token:

- `text`: token source text.
- `role`: syntax role.
- `fontStyle`: style information.

The highlighter port also exposes languages, aliases, themes, and an engine fingerprint.
This identifier records the highlighter, version, and settings used in token cache keys.

The proposed Shiki adapter keeps Shiki's token type inside the adapter.
A plain adapter returns uncoloured text.
Both adapters provide the same port through an [Effect Layer](/lore/layer-constructor-pattern).

Core properties use the plain adapter.
The whole-file token property exercises Shiki.
[One snippet model](/lore/one-snippet-model-two-renderers) supplies both renderers.

See [the glossary](/glossary) for engine-neutral token and highlighter port.

## Sources

1. [Hexagonal architecture](https://alistair.cockburn.us/hexagonal-architecture/)
   Primary source. Port and adapter boundary 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. Proposed highlighter contract Accessed 2026-10-02.

3. [Effect Layer](https://github.com/Effect-TS/effect/blob/effect%404.0.0/packages/effect/src/Layer.ts)
   Effect contributors. Service providers Accessed 2026-10-02.

## 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)

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

- One snippet model feeds both renderers → HTML and agent Markdown derive their code, repository, commit, path, and line numbers from the same snippet. → [Read page](https://ratstack.sh/lore/one-snippet-model-two-renderers)

- 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)
