marklark
Status: working pre-release. The library, the CLI and the MCP server implement the specification; no version has been released yet.
marklark keeps Markdown documents up to date from their environment — source files, data files, other parts of the same document — using instructions hidden in HTML comments, so the rendered document is unaffected.
It splits document maintenance into two levels:
- Intent — a human writes, in plain prose, what a part of the document should contain and where it comes from.
- Code — an agent turns the intent into a small, hermetic Starlark program. marklark runs those programs deterministically, with no AI involved, every time the document is updated.
<!--INTENT
Show the test proving that shift-headings refuses to demote a heading below h6.
-->
<!--CODE
emit(fence(slice("tests/test_markdown.py",
start=r"def test_shift_rejects_below_h6", end=r"^ def "), "python"))
#@ intent: blake3:3f2a…
#@ params: ast1:blake3:9c41…
#@ generated: 412:blake3:77e0…
-->
…generated content…
<!--/CODE-->
The #@ stamps record that the code was checked against the intent (intent, params) and what it
generated (generated). When a human edits the intent, the code, or the generated text, marklark notices
and says so — it never silently overwrites a human edit.
A region can also be generative: when the INTENT asks for prose, the agent answers it with an
<!--AI--> block, written from dependencies marklark extracts and hashes, and flagged for regeneration
when those inputs change.
Install
From a clone of this repository:
cargo install --path .
Use
marklark update FILE... # run all CODE blocks, splice their output into the files
marklark check FILE... # structure, stamps, declarations, task graph, guards; runs nothing
marklark check --determinism FILE... # run every update twice and compare
marklark intent-check FILE... # report intent states (unresolved, intent_changed, params_edited, …)
marklark intent-accept FILE --line N # a human confirms the code (or AI text) still fits its INTENT
marklark mcp # MCP server on stdin/stdout, for agents
marklark skill [--user] # install the guide for agents as a Claude Code skill
--strict turns every intent state other than verified into an error; --json prints machine-readable
reports. Exit codes: 0 success, 1 a document has a problem, 2 a file could not be read or written.
A .bak copy is written before a file changes, unless git already holds the file's content.
To give an agent the MCP tools in Claude Code:
claude mcp add marklark -- marklark mcp
The tools: intent_list, intent_context, intent_apply, intent_check, update, ai_resolve,
ai_context, ai_update, guide, list_headings, get_section, get_lines. The guide for agents
(docs/agent-guide.md) is served by the guide tool and as the resource
marklark://guide, and marklark skill installs it as a Claude Code skill. See
examples/ for a walkthrough.
What CODE can do
CODE is Starlark with no ambient I/O. Everything goes through host functions: reading files (read,
slice, glob, json, yaml, toml, xml), text (re_search, re_findall, re_sub, reindent,
fence), the document (headings, anchor, front_matter, here, document), variables shared
between blocks (define, var), and output (emit). Blocks can order themselves with
tasks(depends_on=[...], completes=[...]). Files are read only inside the project root; gitignored files
and secrets such as .env are refused. See docs/host-functions.md.
Values can also appear inline in running text: <!--$version-->1.2.3 or
<!--= app.name-->My App<!--/=-->.
As a library
The marklark crate works on documents held in memory: Document is text plus an optional path, and
file access goes through the FileSystem trait (MemoryFs for in-memory files, DiskFs for a
directory tree). eval::update, state::analyze, apply::intent_apply and the ai module are what the
CLI and the MCP server use.
Relationship to mdship
marklark is the successor in spirit to mdship, which has one
dedicated placeholder type per task (INCLUDE, IMPORT, SIP, SLURP, …) and is written in Python. marklark
replaces that family with one programmable construct, is written in Rust, and ships as a single binary.
mdship remains maintained for environments where only pip installs are allowed.
Documentation
| File | Contents |
|---|---|
| docs/spec.md | The specification: constructs, stamps, states, evaluation model, security |
| docs/host-functions.md | The host-function library, sized against every mdship feature |
| docs/agent-guide.md | The guide for agents: rules, workflow, Starlark subset, host functions, patterns |
| docs/decisions.md | Decision log with the reasoning behind each decision |
| docs/open-questions.md | What is still undecided |
| docs/mdship-lessons.md | What to carry over from mdship (lessons, not code) |
| CLAUDE.md | Orientation for agent sessions working on this repository |
Metadata
Release files for marklark 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| marklark-0.1.0.tar.gz | 137.7 kB | With provenance | Details for marklark-0.1.0.tar.gz |
Built distributions (wheels)
Total release size: 33.5 MB
Release files / marklark-0.1.0.tar.gz
| Download URL | marklark-0.1.0.tar.gz |
|---|---|
| Size | 137.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f7308f3ff54095e994f924c4f3cc6e49130a0fe517c241bbb34ad00b769bcc8d
|
|
BLAKE2b-256 checksum How to use checksums |
4f3d0541d1c5a26ddcd92a6f8a44a3120b602c9d99adac143a3157b1a3807101
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logRelease files / marklark-0.1.0-py3-none-win_amd64.whl
| Download URL | marklark-0.1.0-py3-none-win_amd64.whl |
|---|---|
| Size | 4.8 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
29f91d0fab4496dbabc3d8e52110733fe5293f90a47616cc3ebd65f52349f42b
|
|
BLAKE2b-256 checksum How to use checksums |
e2b12b3e833fc94f19687a297c3f7de8d8ee5963bb48e48a1d27811448202350
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logRelease files / marklark-0.1.0-py3-none-musllinux_1_2_x86_64.whl
| Download URL | marklark-0.1.0-py3-none-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 5.1 MB |
| Tags | Linux musl 1.2+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
5da11625d34f13a884675ec2b51459afc1cd84665e7a718e3f0b8ee9c3dc4852
|
|
BLAKE2b-256 checksum How to use checksums |
e99e1a3493eb8e2470657ec65437656b79f551720c2c7ea877e9a476c5706284
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logRelease files / marklark-0.1.0-py3-none-musllinux_1_2_aarch64.whl
| Download URL | marklark-0.1.0-py3-none-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 4.5 MB |
| Tags | Linux musl 1.2+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
1a1eaac24c9422b43728edca6a5693f5b7ab62ab2acd9434a7d0c79322f7b639
|
|
BLAKE2b-256 checksum How to use checksums |
5a0e293ff9940a90d41f41783e51017dfe92a4a14ac02b128fd246a55a05e5c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logRelease files / marklark-0.1.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | marklark-0.1.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 5.1 MB |
| Tags | Linux glibc 2.17+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
4d11ca0676db3f047a172a722ffde0195122743fe5119ddbfff70fac0803f346
|
|
BLAKE2b-256 checksum How to use checksums |
5e664b6180a94ad966b3605e88d2787d4f84422bba0a3b3769007c301e7985d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logRelease files / marklark-0.1.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | marklark-0.1.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 4.7 MB |
| Tags | Linux glibc 2.17+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
01377b1c0a2b18867f1e7aa6b7782d3324a967fbb33868bba2f6473538440ec8
|
|
BLAKE2b-256 checksum How to use checksums |
6398393bce20e47711b4be455d7189ebc93edc0b41b59636964c35e6ca9e8eaa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logRelease files / marklark-0.1.0-py3-none-macosx_11_0_arm64.whl
| Download URL | marklark-0.1.0-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 4.5 MB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
72613c2eaacfdee1be3503378ee421e0387fcfd1f8de87c0510e8307028ab08a
|
|
BLAKE2b-256 checksum How to use checksums |
897a7d82f3d8616976e83fa9ac9b61411ae585d6e2129cff7a4b23fdb7eb9e6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logRelease files / marklark-0.1.0-py3-none-macosx_10_12_x86_64.whl
| Download URL | marklark-0.1.0-py3-none-macosx_10_12_x86_64.whl |
|---|---|
| Size | 4.6 MB |
| Tags | Python 3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
12dbaf279dbbd3653df2c0ad920286551a93ae5315085a3503483e1245dd4e29
|
|
BLAKE2b-256 checksum How to use checksums |
a7d05f9ee0100a39ccba27d5bda84579c457b65308f573215b2127b384dad944
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logSecurity for marklark 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 8 files in this release have been uploaded with provenance metadata.
Attestation for marklark-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.