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

Free workshop: [how to burn a trillion tokens and get good results](/tokenmaxx#interested).

A highlighter port names the job without selecting an engine.
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.
The fingerprint participates 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 → Design brief for a build-only code pipeline: pinned Git objects, typed diagnostics, and one 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)

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

- One snippet model feeds both renderers → HTML and agent Markdown derive their code and provenance 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)
