<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Roshan Alwis on Medium]]></title>
        <description><![CDATA[Stories by Roshan Alwis on Medium]]></description>
        <link>https://medium.com/@pkdalwis?source=rss-ed1f1e5ee6b6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*hO4RP8mRizD5Hd9L</url>
            <title>Stories by Roshan Alwis on Medium</title>
            <link>https://medium.com/@pkdalwis?source=rss-ed1f1e5ee6b6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 18:15:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pkdalwis/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Markdown Has Two Readers Now. It Should Serve Both.]]></title>
            <link>https://medium.com/@pkdalwis/markdown-has-two-readers-now-it-should-serve-both-e05344b563bf?source=rss-ed1f1e5ee6b6------2</link>
            <guid isPermaLink="false">https://medium.com/p/e05344b563bf</guid>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[documentation]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Roshan Alwis]]></dc:creator>
            <pubDate>Sun, 27 Sep 2026 14:14:54 GMT</pubDate>
            <atom:updated>2026-09-27T14:32:56.415Z</atom:updated>
            <content:encoded><![CDATA[<h4>We keep asking agents to turn their Markdown into HTML so people can actually read it, and end up maintaining two versions of the truth. Here’s how to get both from one file.</h4><p>A while ago I noticed something about the Markdown files in my repositories. Most of them weren’t really written for me anymore.</p><p>There was the CLAUDE.md telling an agent how to behave, the AGENTS.md, and the .cursorrules somebody added and nobody remembers. Then there were the specs, ADRs and runbooks that agents read before they touch any code. It goes the other way too, half the plans and status reports I review these days were drafted by an agent first.</p><p>Without much fanfare, Markdown has become the note we pass back and forth between people and AI. It’s where we write down what we want, what we decided, and what must never happen.</p><p>Markdown was built in 2004 for one kind of reader, a person looking at a web page. Now it has two, and they want almost opposite things.</p><p>When I open a spec, I want to see at a glance whether it’s approved, what’s risky, what’s decided and what’s overdue. And please show me the diagram, not the source code for it.</p><p>When an agent opens the same spec, it wants the meaning and nothing else. Which lines are hard rules and which are just background? What’s settled and what’s still open? Every decorative character costs it tokens.</p><p>Plain Markdown hands both of us the same wall of text.</p><h3>The workaround we all use “Now make it an HTML page”</h3><p>So what do we do? If you work with agents every day, you probably already know the move. The agent writes a plan or a spec in Markdown, you look at the flat wall of text, and you say, <em>“Can you turn this into a nice HTML page?”</em></p><p>And it does, beautifully. Colored callouts, a status badge, a proper diagram, a table of risks. You share the HTML with your team, everyone’s happy, and for about a day it works.</p><p>Then someone changes a requirement.</p><p>Now there are two files. The Markdown is what the agent reads and works from. The HTML is what people read and review. Every change has to be made in both, or they quietly drift apart. The agent either regenerates the whole HTML page, spending thousands of tokens on markup, or it edits one and forgets the other. A week later, your team is reviewing a page that no longer matches what the agent is actually building, and nobody is quite sure which one is right.</p><p>We didn’t set out to create two sources of truth. We just wanted the agent’s output to be pleasant for humans to read.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OQ7f2e5UTOcBEWLOO8X7Bg.png" /></figure><p>That’s the real reason Styled Markdown exists. <strong>What if the file the agent writes were already the human-friendly version?</strong> The agent writes one .smd file, once. People open it and see a rich, rendered page. Agents open the same file and get a lean, meaning-only view. If you need HTML to share, it’s generated output, one command away, and nobody ever maintains it by hand.</p><p>One source of truth, two readers, no copy to keep in sync.</p><h3>“Markdown is just text and structure.” Well, almost</h3><p>I want to be fair to Markdown here, because I love it. It does more than text. You get headings, lists, links, images, code blocks, tables and task lists. GitHub goes further and renders Mermaid diagrams and those nice &gt; [!WARNING] alerts.</p><p>But those extras belong to the platform, not the format. And what Markdown really can’t do is say what something <em>means</em>.</p><p>A warning is just **IMPORTANT:** in bold, which looks exactly like every other bold line, to you and to a model. If you want color or layout, you drop into raw HTML and hope the renderer doesn’t strip it. A decision, a risk, an API contract and an open question are all just paragraphs. A task is - [ ] fix the thing, with no owner and no due date. And diagrams are either ASCII art or a fenced block that renders in one place and shows up as raw code everywhere else. You usually find out when someone complains.</p><p>You’ve almost certainly seen a spec like this:</p><pre>**IMPORTANT:** `GET /v1/search` will require `filters` from Nov 1.<br> <br>## Decision<br>We went with the accordion layout on mobile (Maya, Sept 8).<br> <br>## Flow<br> <br>    +--------+     +------+     +--------+<br>    |  Cart  | --&gt; |  Pay | --&gt; |  Done  |<br>    +--------+     +------+     +--------+<br> <br>## Tasks<br>- [ ] Idempotent order creation (P0, api-team, due Oct 3)<br> <br>## Background<br>Three screens of history, research notes and thank-yous...</pre><p>As a person, I can’t tell if this document is final. I can’t see that the task is overdue. And I’m left mentally drawing the flow from dashes and plus signs.</p><p>The agent has it worse. It pays for every character, including three screens of background it will never use and an ASCII drawing that costs a lot and says very little. It also has no way of knowing that the “IMPORTANT” line is a hard rule and the decision is final.</p><p>Nobody wins with this, and asking for an HTML copy only moves the problem somewhere else. So I wanted the fix to live in the source itself.</p><h3>Styled Markdown (.smd) one file, two readers</h3><p>Styled Markdown is Markdown plus a small set of blocks that carry <em>meaning</em>. I held myself to four rules while designing it.</p><p>First, <strong>every </strong><strong>.md file is already a valid </strong><strong>.smd file</strong>. You rename it and add structure only where it earns its place. Nobody has to relearn anything.</p><p>Second, <strong>meaning is explicit</strong>. :::warning, :::decision, :::risk, :::api and :::agent tell the reader what the content <em>is</em>, not just how it should look.</p><p>Third, <strong>everything is validated</strong>, with clear rule codes and automatic fixes, both in the editor and in CI. No more discovering broken diagrams in a review.</p><p>Fourth, <strong>agents get their own view of the same file</strong>. The <em>agent view</em> strips out styling, layout and human-only sections, and keeps the meaning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pv2mnIfxqQ4sqE0UL3MjIQ.png" /></figure><p>Here’s that same spec again, written as .smd:</p><pre>---<br>smd: 1<br>title: Checkout Redesign<br>summary: One-page checkout with Apple Pay / Google Pay; cut abandonment from 38% to under 30% by Q4.<br>status: approved<br>owners: [&quot;@maya&quot;, &quot;@dev-checkout&quot;]<br>---<br> <br>:metric[38%]{label=&quot;Abandonment&quot; delta=&quot;-2.1pp&quot; trend=down good=down}<br> <br>:::warning Breaking change<br>`GET /v1/search` requires the `filters` object from 2026-11-01.<br>:::<br> <br>:::decision{status=accepted date=2026-09-08 owner=@maya} Accordion layout on mobile<br>Won usability testing on completion rate.<br>:::<br> <br>```mermaid<br>flowchart LR<br>    Cart --&gt; Pay --&gt; Done<br>```<br> <br>- [ ] Idempotent order creation :priority[P0] @api-team :due[2026-10-03]<br> <br>:::agent<br>- All prices are integer cents. Never use floats for money.<br>- `POST /v1/orders` must be idempotent.<br>:::<br> <br>## Background {agent=skip}<br>Three screens of history, research notes and thank-yous...</pre><p>There’s nothing exotic in there. It still reads fine as plain text in any editor, and if you ever need to go back, every block has a sensible fallback in plain GitHub Markdown.</p><h3>What people get</h3><p>Open that file in the VS Code preview, or export it to HTML, and it turns into a document you actually want to read:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-uwIg7nOHvGWzUAuK9PkKw.png" /></figure><p>At the top there’s a status header built from the front matter, so you know right away who owns the document and whether it’s final. Warnings look like warnings. The KPI is a real tile with a trend arrow. Tasks show their owner, priority and due date, and the overdue ones turn red, which is mildly uncomfortable and exactly the point.</p><p>If you’re on the product side, you also get decision records, risks scored by impact and likelihood, and timelines:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ipMBQ7UKBE-QNthm8kXDjQ.png" /></figure><p>If you’re a developer, you get API endpoint cards, line-highlighted code, and code embedded straight from the repository (file=&quot;src/pricing.ts&quot; lines=&quot;7-13&quot;), so the snippet in the doc can’t quietly go stale. Tabs, columns and cards are there when a page needs layout.</p><p>The change I’m happiest about is diagrams. An ASCII diagram is a picture drawn with characters. It’s expensive for a model to read, fragile to edit, and tells the model very little. A Mermaid block is <em>data</em>: nodes and edges. People see a proper themed diagram, and the agent sees clean structure it can use or skip. The editor even catches flowchat before you commit it.</p><h3>What agents get. The agent view</h3><p>Now the fun part. Run smd agent checkout-redesign.smd and this is what the agent sees:</p><pre># Checkout Redesign<br>status: approved · owners: @maya, @dev-checkout<br>summary: One-page checkout with Apple Pay / Google Pay; cut abandonment from 38% to under 30% by Q4.<br> <br>Abandonment: 38% (-2.1pp)<br> <br>&lt;warning title=&quot;Breaking change&quot;&gt;<br>`GET /v1/search` requires the `filters` object from 2026-11-01.<br>&lt;/warning&gt;<br> <br>&lt;decision status=&quot;accepted&quot; date=&quot;2026-09-08&quot; owner=&quot;@maya&quot;&gt; Accordion layout on mobile<br>Won usability testing on completion rate.<br>&lt;/decision&gt;<br> <br>```mermaid<br>flowchart LR<br>    Cart --&gt; Pay --&gt; Done<br>```<br> <br>- [ ] Idempotent order creation [P0] @api-team (due 2026-10-03)<br> <br>&lt;agent-instructions&gt;<br>- All prices are integer cents. Never use floats for money.<br>- `POST /v1/orders` must be idempotent.<br>&lt;/agent-instructions&gt;</pre><p>A few small things happened here, and together they matter a lot.</p><p>The warning is now a &lt;warning&gt; tag, so the model knows it’s a caveat and not decoration. The decision says status=&quot;accepted&quot;, so the model treats it as settled instead of reopening the debate. If it said proposed, the model would know it’s still up in the air. The KPI tile shrank to one line of facts. The diagram stayed as a few lines of structure, and with --brief a longer one collapses into a pointer like [diagram: sequenceDiagram, 13 lines — see L92-L106] that the agent follows only if it cares.</p><p>Tasks get facts computed for them. An overdue task literally says (due 2026-09-25, OVERDUE), so the agent doesn’t have to work out today’s date.</p><p>The Background section is gone. People still see it in the preview, but the agent never pays for it. On this tiny example that only saves 13%. On a real spec with pages of history, it’s where most of the savings come from.</p><p>Two more things I care about a lot. The :::agent rules are always included, even when the agent reads just one section, so a hard rule can’t be skipped because it lived in the wrong part of the file. And every heading carries a line reference like ## Requirements [L53], so when the agent needs to edit, it opens exactly those lines and nothing more.</p><p>The nice part is who’s in control. <strong>The author decides what the agent sees</strong>, right there in the document. The model doesn’t have to guess what’s important.</p><h3>So how much does it actually save?</h3><p>I measured it on a realistic product spec from the project’s examples, about 2,400 tokens raw:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*--4W9JsA7-7jqXzMkWOzUg.png" /></figure><p>And across all seven example documents, finding the open tasks with smd tasks examples/ took <strong>685 tokens instead of 6,867</strong>. That’s about 90% less than making the agent read every file.</p><h3>Agent skills. Teaching agents the habit</h3><p>A format only helps if agents actually use it well. I didn’t want to paste “please use the CLI” into every prompt, or dump a full syntax guide into every conversation. That would burn the very tokens I was trying to save.</p><p>This is what <strong>agent skills</strong> are for. A skill is just a folder: a SKILL.md with instructions, maybe some references and templates, and some scripts. Claude Code, Claude.ai and the Claude Agent SDK load skills <em>on demand</em>, which is why they’re so cheap:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1OzZnfHZLYSOXDotb79AKg.png" /></figure><p>Most of the time, all the agent holds is the skill’s name and a short description, around 100 tokens. That’s enough for it to know <em>when</em> the skill applies. Only when a task matches does it read SKILL.md, about 1,000 tokens of workflow. And the heavy part, a 760 KB command-line tool, never enters the conversation at all. The agent <em>runs</em> it and reads only the short output.</p><p>Styled Markdown ships two skills, one for reading and one for writing.</p><h3>The reader skill. Pull, don’t dump</h3><p>The reader skill teaches the agent one simple habit: <strong>don’t </strong><strong>cat the whole file.</strong> Look at the outline first, then pull only the part you need. It’s what you’d do yourself with a 40-page document. You’d check the table of contents first.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*89QJGf5xzu2FsOsDWpy1xQ.png" /></figure><p>Very often the outline alone does the job:</p><pre>$ smd outline checkout-redesign.smd<br>Checkout Redesign — One-Page Checkout · approved · file ≈2424 tokens · full agent view ≈1531 tokens<br>summary: Replace the 4-step checkout with a single page, add Apple Pay / Google Pay, ...<br> <br>L39-52    ## Goals and non-goals     ≈105<br>L53-74    ## Requirements            ≈245  7 open tasks<br>L75-89    ## Design                  ≈238  skipped for agents<br>L90-128   ## Architecture            ≈339  diagram, API<br>L129-142  ## Decisions               ≈167  decision<br>L143-152  ## Risks                   ≈134  risk<br>L182-187  ## Open questions           ≈68  open question<br>L188-202  ## Implementation notes    ≈192  AGENT INSTRUCTIONS</pre><p>For about 230 tokens, the agent knows what the document is, whether it’s final, where everything lives, and what each section would cost to read. Then it asks for just the piece it needs:</p><pre>$ smd agent checkout-redesign.smd --section &quot;open questions&quot;<br> <br>&lt;question title=&quot;Should guest users see wallet buttons before entering an email?&quot;&gt;<br>Apple Pay can provide the email, but marketing wants to capture it ...<br>Decision needed by 2026-10-01 from @maya and @marketing.<br>&lt;/question&gt;<br>[smd] ≈365 tokens (file ≈2424, 85% smaller)</pre><p>The skill also teaches the agent how to <em>interpret</em> what it reads, and that’s my favorite part. A &lt;question&gt; means “this isn’t decided”, so the agent shouldn’t quietly make something up. It should use the fallback in the agent instructions or ask you. An accepted decision is binding. A draft document is tentative.</p><p>In day-to-day use you never mention the skill. You just ask something like <em>“What constraints apply to POST /v1/orders in the checkout spec, and which API tasks are open?”</em> The agent checks the outline, reads two sections, and answers with line numbers.</p><h3>The writer skill: templates in, valid documents out</h3><p>The writer skill covers the other direction. Say you ask for <em>“an ADR for moving our cron jobs to a managed scheduler.”</em> Instead of writing from memory and hoping the syntax is right, the agent follows a short loop:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZQy6b-twySg6iTQKCMWtXw.png" /></figure><p>It starts from one of seven templates (PRD, ADR, RFC, runbook, API reference, status report or meeting notes) with smd init docs/adr-0012-scheduler.smd --template adr. It fills in the placeholders and only opens the syntax reference when it needs a block it hasn’t used yet. Then it runs smd validate --fix, which points to each problem by rule code and fixes the safe ones on its own. :::warnign quietly becomes :::warning. It repeats until there are zero errors.</p><p>Beyond valid syntax, the writer skill also writes documents that stay <em>cheap to read later</em>. It writes a sharp one- or two-sentence summary, because that’s the first thing every agent reads and often the only thing it needs. It tucks history and research under {agent=skip}. It puts every hard rule for implementers into a single :::agent block, including what to do about open questions. And it embeds code by reference instead of pasting it in.</p><p>So a document written by one agent is cheap for the next agent to read. That’s a small thing to notice, but it adds up quickly.</p><h3>Installing the skills</h3><p>It’s one command</p><pre>npx styled-markdown skills install --global</pre><p>That puts both skills in ~/.claude/skills/. Run it without --global inside a repository and it installs into .claude/skills/ instead, so you can commit it and the whole team gets it. On Claude.ai, upload the skill zips from the GitHub release under Settings → Capabilities → Skills.</p><p>Using Copilot, Cursor, Codex or Windsurf? They don’t load skills, but they do read instruction files. Drop this into your AGENTS.md, .cursorrules or copilot-instructions.md and you get most of the benefit:</p><pre>## Styled Markdown (.smd)<br>- Reading: run `smd outline &lt;file&gt;`, then `smd agent &lt;file&gt; --section &quot;&lt;heading&gt;&quot;`.<br>  Don&#39;t read .smd files whole.<br>- Writing: start from `smd init &lt;file&gt; --template prd|adr|rfc|runbook|api|status-report|meeting-notes`,<br>  then run `smd validate &lt;file&gt; --fix` until there are 0 errors.</pre><h3>Where it doesn’t help (yet)</h3><p>I’d rather tell you the limits myself than have you find them.</p><p><strong>On small documents, the savings are close to zero.</strong> I ran a head-to-head test on a single ~2,000-token spec. Agents with and without the reader skill both got the answer right, and total token use was within about 1%. The skill’s own cost (about 1,000 tokens of instructions plus the outline) roughly cancels out what it saves. The payoff shows up with bigger documents, more of them, and repeated reads, which is where real projects end up living. The skill even tells agents to just read small files in one go.</p><p><strong>GitHub doesn’t render </strong><strong>.smd yet.</strong> For now, smd to-md exports clean GitHub Markdown (callouts become GitHub alerts, badges become code spans), and smd render produces a standalone HTML page.</p><p><strong>The CLI needs Node.js 18 or later.</strong> Without it, the reader skill falls back to reading the front matter and headings first, then only the line ranges it needs. That’s less elegant, but it still beats reading the whole file.</p><h3>Try it on one document</h3><p>The Styled Markdown extension for VS Code is now available on the Visual Studio Marketplace. Search for “Styled Markdown” in the Extensions view, or install it from the command line:</p><pre># VS Code: live preview, validation, quick fixes, agent view, token counter<br>code --install-extension bislink360.styled-markdown<br> <br># CLI + library<br>npm install -g styled-markdown<br> <br># Agent skills for Claude Code<br>npx styled-markdown skills install --global</pre><p>Once the extension is installed, open any .smd file and press Ctrl+K V (Cmd+K V on macOS) to open the live preview beside the editor, or Ctrl+Shift+V (Cmd+Shift+V on macOS) to open it in place.</p><p>Then pick one real spec. Rename it from .md to .smd, add a one-line summary:, wrap the one warning that really matters in :::warning, mark the history section {agent=skip}, and run:</p><pre>smd outline your-spec.smd</pre><p>Take a look at the numbers. That’s what your agents have been paying to read, every single time.</p><p>And the next time you’re about to ask an agent to “make this an HTML page”, ask it to write .smd instead. When you really do need a page to share, it’s one command, and the HTML is just output:</p><pre>smd render your-spec.smd -o your-spec.html</pre><h3>The bigger point</h3><p>We spent twenty years learning to write documents that people enjoy reading. Then, in about two years, we started pouring those same documents into context windows and hoping for the best.</p><p>Our reflex has been to ask the agent for a second, prettier copy: Markdown for the machine, HTML for the humans. I don’t think that’s the answer. Two sources of truth always drift apart, usually the week before a release.</p><p>I think the answer is <strong>one document that says what it means</strong>. Once a warning is marked as a warning, a decision as a decision and an agent rule as an agent rule, a renderer can make the page pleasant for people and a compiler can make it lean for agents.</p><p>Markdown has two readers now. It’s worth writing for both of them.</p><p><em>Styled Markdown is open source under the MIT license: </em><a href="https://github.com/bislink360/styled-markdown"><em>github.com/bislink360/styled-markdown</em></a><em>. You’ll find the full specification, seven example documents with rendered HTML, and both agent skills there. If you try it, I’d genuinely love to hear what worked and what didn’t. Issues, ideas and pull requests are all welcome.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e05344b563bf" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>