Skip to content
jonidimoPublic

About

A single-pane native Markdown editor for Linux in Rust + iced — written by a local 27B model orchestrated by Claude Opus 5, with the full audit of how that went.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Marklea

A native Markdown reader and editor for the Linux desktop, written in Rust with iced. One pane, no webview: the document is always rendered, and double-clicking a block turns that block — and only that block — into an editor sitting exactly where the text was. Saving splices the edited byte range back into the file and leaves every other byte untouched.

Marklea rendering this README in the Tierra theme

It exists because I wanted a Markdown tool that gets out of the way. No wall of menus, no split preview with the source on one side and the result on the other, no switching in and out of an edit mode. You read the document exactly as it will look, and when a paragraph is wrong you double-click that paragraph, fix it, and press Escape. Everything else — fonts, themes, line width, margins — lives behind one right-click instead of a toolbar. That is the whole design.

It was also an experiment, and the experiment is the more interesting half of this repository. Every line of the implementation was written by a 27B model running locally on a single RTX 3090, driven by opencode, with Claude Opus 5 writing the briefs, verifying the APIs, auditing each run and finishing the parts the local model could not reach. It worked. It also went wrong in ways worth writing down, so they were written down: REPORT.md is the audit, and every number in it comes from opencode's own SQLite store or from llama.cpp's /tokenize. None of them are estimates.


What it does

GFM tables with alignment, task lists, fenced code with syntax highlighting, nested quotes, setext headings, raw HTML rendered as code and never executed. Any system font, enumerated through fontdb. A context menu on right-click with file actions, font, theme, line width and vertical margin. Keyboard shortcuts for all of it.

Tierra Pastel
The Tierra theme The Pastel theme

There are 24 themes, all compiled into the binary: the 22 that ship with iced, plus Tierra — the colours of the TierraAPCA KDE colour scheme, taken straight from its .colors file — and Pastel, a warm cream light theme whose accents all clear 4.5:1 against the background. Marklea does not follow the system theme. Themes are compiled constants, which is exactly what makes it look identical on KDE, GNOME, Windows and macOS.

Adding them turned up a bug worth mentioning, because it affects every iced application with a light theme: markdown::Style::from_palette hardcodes the inline-code background to 0x111111 with white text and never looks at the palette, so inline code renders as a black label in the middle of a cream paragraph. Marklea overrides it and derives the colour from the active palette, the same way it already had to override code_block.


The experiment

The question was narrow and answerable: can a 27B model, quantised to Q4 and running locally on one consumer GPU, write a real native GUI application — not a to-do demo, but something with a hard invariant, a real widget toolkit, and an API surface it has never seen?

model      Qwen 3.8 27B — Qwen3.8-27B-AD-Q4_K_M.gguf, ~16 GB of weights
runtime    llama.cpp, 131,072-token window, total_slots: 1
hardware   1x RTX 3090 — 22.4/24.5 GB VRAM, 100% util, 78 °C, 379 W sustained
harness    opencode 1.18.18, phases delegated as isolated subagent sessions
speed      ~10 tokens/second, measured across real runs

The weights are AtomicChat/Qwen3.8-27B-GGUF, the AD Q4_K_M build — not the Unsloth one, in case you are comparing numbers.

The work was cut into 14 phases. Each went out as a self-contained brief: the deliverable, the exact API signatures verified beforehand against the crate sources, and the command that decides whether it passed. Nine landed. The rest is the interesting part.

What actually determines the output

With a local model this size, quality is determined by task design, not by agent design.

That was proven by accident. Hours went into tuning a custom implementador agent — shell-idempotency rules, an API-precedence order, an exploration budget, scoped permissions. Seven of the nine successful phases ran with opencode's stock build agent instead, and nobody noticed until the audit at the end: opencode run --agent <name> only accepts primary agents, the custom one was declared mode: subagent, and opencode printed a single line to stderr and silently fell back to the default.

The briefs were carrying the work on their own. A brief that works with this model has four properties, and each one was learned by violating it:

  1. One thing only. The phase that asked for three — open a file, display it, edit it — failed, and it failed while fitting comfortably inside the context window. Split into three one-thing phases, all three passed on the first try.
  2. Zero indirection. Asking the model to look up its own task in a JSON file produced 16 consecutive failed attempts to parse it. An agent should never have to go and find out what its job is.
  3. No uncertain zones. Marking one part of a brief as "unverified, try it and let the compiler correct you" turned that part into the focus of 116 steps, while the fully specified rest of the task sat untouched.
  4. APIs resolved in advance — and correct. Which has a cruel corollary.

The three-hour runaway

That corollary cost an afternoon. A brief went out containing a signature that did not exist — Animation<f32>::interpolate, invented by the orchestrator and handed over with instructions not to go verifying it.

20:07:04   start
20:19:59   write src/render.rs      <- the only write
20:20:30   write src/app.rs         <- the only write
20:20 -> 23:09    169 minutes, no writes at all

It wrote the code in thirteen minutes, hit compile errors, and instead of reading them went looking for the function it had been promised existed. Of the 2,802 shell commands in that run, 2,795 were searches through ~/.cargo/registry and four were actual invocations of cargo. It compiled four times in three hours.

The damage did not stop at the GPU. Those 9,314 session parts, each storing a full tool input and output, left opencode.db at 144 MB with a 4.8 MB uncheckpointed WAL — a runaway degrades the harness for every run after it.

The lesson is sharper than "verify your APIs": wrong certainty is worse than no certainty. A model told nothing will read the compiler error. A model told a lie will defend it for three hours.

Other things that bit

  • external_directory: ask hangs a headless run forever. There is nobody there to answer the prompt.
  • doom_loop ships configured as ask, which means it does nothing at all.
  • MCP tool schemas are billed to every session, whether or not that session ever calls them.
  • The reasoning variant of the model hung subagents outright, so planning ran with reasoning on and building ran with it off.

An honest account of the operator's mistakes

The audit gives them a full section, and it is the section to read if you are going to try this yourself. The short version: a verification gate was written loosely enough that it could be satisfied without doing the work; a test written to protect the central invariant passed while that invariant was broken (which is why PRUEBAS.md exists — 191 lines of every Markdown construct that had quietly stopped round-tripping); six monitors were written and all six had bugs; and causes were asserted before they were verified. None of that was the local model's fault.

What shipped

~1,600 lines of Rust · 16 tests green on three platforms · 5.9 MB .deb

Who wrote what is stated plainly in §1 of the report, because it matters when you read the code: fourteen delegated phases from the local model, and the diagnosis-shaped work — the round-trip bug, the focus bug, the event-subscription bug, the theming — from Claude. The difference was never implementation speed. It was diagnosis: reading a symptom, forming a hypothesis about a system you cannot see, and testing it. That is where the 27B model stopped, and no rewriting of the brief got it further.

A longer Spanish version, written while the work was happening rather than afterwards, is in INFORME.md.


Install

Every release carries a .deb, a Linux tarball, a macOS .app and a Windows .exe, all built by GitHub Actions. See Releases.

Debian / Ubuntu

sudo dpkg -i marklea_0.1.7-1_amd64.deb

Installs /usr/bin/marklea, a .desktop entry with MimeType=text/markdown, and an SVG icon. Needs glibc 2.39 or newer — Debian 13 and Ubuntu 24.04 qualify, Debian 12 does not, and there you build from source.

Beyond libc6 the package asks for libxkbcommon0, libegl1 | libgl1 and libwayland-client0 | libx11-6. Those are dlopened at runtime, so they never appear in ldd and cargo-deb cannot infer them. Declared by hand, a machine missing them fails at install time with a clear message instead of failing to start with none.

Install with dpkg rather than double-clicking the file. Double-clicking routes through Discover, which refreshes every configured apt repository first and fails if any of them is unreachable — an unrelated problem that looks exactly like a broken package.

macOS

Unzip marklea-macos.zip and drag Marklea.app to Applications. The bundle is universal (Apple Silicon + Intel) and unsigned, so the first launch needs:

xattr -dr com.apple.quarantine /Applications/Marklea.app

Without that, Gatekeeper reports it as damaged. Signing it properly needs an Apple Developer account, which this project does not have. Opening a .md from Finder is not wired up either: macOS delivers that through Apple Events rather than argv, so the bundle deliberately does not claim the file type instead of claiming it and then opening empty.

Windows 10/11 x64

Unzip marklea-windows-x86_64.zip and run marklea.exe. No installer, nothing to preinstall.

From source

cargo build --release
./target/release/marklea file.md

Rebuilding the package

cargo install cargo-deb   # once
RUSTFLAGS="--remap-path-prefix=$HOME/.cargo=/cargo --remap-path-prefix=$PWD=/marklea" \
  cargo deb

That --remap-path-prefix pair is not decoration. panic! locations from dependencies embed absolute source paths, so a stripped release binary still carries a few hundred copies of /home/<you>/.cargo/registry/... — your username, shipped inside the .deb. The remap replaces them with stable placeholders, and makes the build that much more reproducible on the way.

Building for an OS you do not own

.github/workflows/release.yml builds all three on GitHub's runners. Two ways in:

  • Actions → release → Run workflow builds everything and leaves it as artifacts on the run page. Nothing gets published.
  • Push a tag — git tag v0.1.7 && git push origin v0.1.7 — and the same build attaches the files to a Release.

The macOS job compiles aarch64-apple-darwin, cross-compiles x86_64-apple-darwin against the same SDK, joins them with lipo, and wraps the result in a Marklea.app with an .icns generated on the runner from assets/marklea.png. If the Intel half fails to build it warns and ships an Apple Silicon bundle rather than failing the release.

The workflows use actions/checkout, actions/upload-artifact and the gh CLI that comes with the runner. No third-party actions — in a repository whose whole point is auditing what wrote what, that seemed like the right call.


Keyboard shortcuts

Right click context menu
Double click edit the block
Escape leave the editor and apply the Markdown
Ctrl + N / O / S / R new, open, save, reload
Ctrl + + / - / 0 larger, smaller, normal text
Ctrl + wheel zoom
F11 / Ctrl + F full screen
F1 / Ctrl + H help

Unsaved changes

Anything that would discard the current document — closing the window, New, Open, opening a recent file, Reload — asks first: save and continue, discard, or cancel. Every one of those paths goes through a single guard, so adding another destructive action cannot forget the check.

There is no autosave and no crash recovery. If the process dies, in-memory changes are gone.

Not included

By design, to keep it small and fast: no LaTeX, no scroll virtualisation, no tabs, no data-URI images. Images render as a placeholder with their alt text.

Repository layout

Path What it is
src/ ~1,600 lines of Rust
AGENTS.md The project contract: invariants, verified APIs, the command that decides "done"
plan.md, fases.json The phase plan and the per-phase briefs handed to the model
PRUEBAS.md The Markdown stress file the round-trip test runs against
bin/ The scaffolding: phase runner and session forensics
assets/ .desktop entry, SVG icon, the PNG the macOS .icns is built from, screenshots
.github/ CI on three platforms, and the release build
REPORT.md, INFORME.md The audit, in English and Spanish

Tests

cargo test

16 tests, run on Linux, macOS and Windows on every push. The ones that matter assert the byte-for-byte round trip against every .md file in the repository — the stress file included — and that splicing a block re-parses it. Paths resolve from CARGO_MANIFEST_DIR, so a fresh clone anywhere passes.

License and reuse

MIT — see LICENSE.

That covers the code, and it is meant to cover the rest too. The audit, the measurements, the phase briefs in fases.json and the harness scripts in bin/ are free to reuse, including for research and teaching. If the numbers are useful to you, take them; a link back is appreciated and not required. If you reproduce this with a different model or a different harness, those results are worth more than this repository is — open an issue, I would like to read them.

About

A single-pane native Markdown editor for Linux in Rust + iced — written by a local 27B model orchestrated by Claude Opus 5, with the full audit of how that went.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages