# Internals

How Mindtape is built, from its crate layout and evaluation cache to what differs per platform.

You don’t need anything on this page to use Mindtape. It’s for you if you audit, package or build on the code.

## Workspace

A 2-crate `cargo` workspace (edition 2024, pinned to rustc 1.92.0):

- `mindtape` `0.6.0`: The domain library, with the config, the task model, the filter language, config-driven validation and the project loader. Other tools such as speconaut depend on this, not on `mindtape-cli`.
- `mindtape-cli` `0.6.0`: The thin `mt` binary (clap) over `mindtape`.

The workspace has 7 general-purpose dependencies. They’re published separately, and none of them depends on the task model, so a tool that reads Typst files as data can use them without it.

- `artifact-gate` `0.2.0`: A structural rule engine that works on any tree of nodes. It checks a tree against require/forbid/order/allow path rules and emits diagnostics. `mt check`’s own structural rules run on it.
- `swhid-mint` `0.1.1`: Mints and resolves Software Heritage IDs (SWHID, ISO/IEC 18670:2025) for content-addressed artifact identity, with a VCS-agnostic core and a git backend.
- `typst-cleanup` `0.3.0`: Retires a tracked file, refuses a dirty tree, writes a tombstone that records the file’s SWHID, and rewrites every inbound link in one pass. It works without knowing what consumes those links.
- `typst-cst` `0.3.0`: Reads a file’s structure (its heading tree, with source spans) by parsing alone, without evaluating it.
- `typst-edit` `0.1.0`: Rewrites a Typst file in place at known spans, applying a batch of edits as one change.
- `typst-harvest` `0.6.0`: Evaluates a Typst file and collects the data it marked for export, treating Typst as a data format. Never lays out or renders a page.
- `typst-world` `0.5.8`: A configurable eval-only `typst::World` over a file-provider trait, plus a Typst-free value tree. Every eval-only tool in this list uses it, so none of them re-implements `World`.

## The cache

`mt` evaluates task files with the Typst compiler, which takes time on a large backlog. So each project keeps one cache in `.mindtape/cache/`, keyed by each file’s content hash, and `mt` evaluates only the files whose bytes changed since the last run. A file that imports a module also counts as changed when that module’s bytes did. `mt` writes a `.gitignore` into that directory, so git does not track the cache. On a generated backlog of 2000 tasks:

| Command | Cold cache | Warm cache |
| --- | --- | --- |
| `mt ls` | 0.44 s | 0.18 s |
| `mt check` | 0.33 s | 0.08 s |

These figures come from one run on 2026-08-16 on one Linux machine with an i7-12700H, and nothing regenerates them. Run `just bench run` on your machine for the warm column. For the cold column, set `MINDTAPE_NO_CACHE=1` to make `mt` skip the cache.

A cache entry is a copy of what evaluation produced, so you lose nothing by deleting the directory. The next run rebuilds it. A change to the config, the prelude or the `mt` version starts a new cache and removes the old one. A read command such as `mt ls` may write the cache, but it never changes a task file.

## Platform support

Every tagged release includes a prebuilt binary for each supported platform, listed in the [Quickstart](https://mlavrinenko.github.io/mindtape/quickstart/index.md). CI runs the tests on Linux and Windows. Two things differ by platform. [Hooks](https://mlavrinenko.github.io/mindtape/hooks/index.md) says which shell runs a flip hook’s `run` command, and [docs/contributing/windows.md](https://github.com/mlavrinenko/mindtape/blob/main/docs/contributing/windows.md) lists the terminal tests that run on Unix only.

Everything else is the same code on every platform: the config and data directories, the Typst local-package path, editor lookup, and the path separators in derived tags and links. The Windows CI job tests it.

> **Note:** [For AI agents](https://mlavrinenko.github.io/mindtape/agents/index.md) covers the JSON output and the schemas a tool reads.
