Get LLM To Create Reports

Difference between revisions from 2026/10/23 02:08 and 2026/10/23 01:45.
{html}
<article>
  <b>Run GLM on Your Own Computer (Step by Step)</b>

  <p>Imagine you have a really smart friend named GLM. He can write stories, answer questions, and even make pretty documents. Right now he lives far away โ€” at Z.ai's house โ€” and every time you want to talk, you have to send him a letter through the mail and wait.</p>

  <p>What if you could invite GLM to live in <em>your</em> house? Then he'd always be there. No mail. No waiting. And โ€” best part โ€” you could give him a desk, some pens, and a recipe book, and he'd start making the same kind of pretty reports Z.ai shows off.</p>

  <p>This guide walks you through that, one tiny step at a time. Grown-up words are explained with kid words. Every step ends with "you did it" so you always know when to high-five yourself.</p>

  <h2>Before we start: meet the four friends</h2>

  <p>Picture four friends who all need to show up at your house for a party:</p>

  <ul>
    <li><strong>GLM</strong> โ€” the smart brain. He writes the words.</li>
    <li><strong>Ollama</strong> โ€” the front door. He's the one who actually lets GLM inside your computer.</li>
    <li><strong>Open WebUI</strong> โ€” the desk and chair GLM sits at. It's the screen with buttons that you click.</li>
    <li><strong>Toolbox</strong> โ€” pens, paper, scissors, glue. Without these, GLM can only talk. With these, he can <em>make things</em>.</li>
  </ul>

  <p>Got the picture? Okay, let's invite them over one at a time.</p>

  <h2>Step 1 โ€” Put in the front door (install Ollama)</h2>

  <p>Ollama is the front door of your computer. Without it, GLM has nowhere to walk in. The good news: it installs itself with one command.</p>

  <p>Open your terminal (that black box where you type stuff). On a Mac, press <code>Cmd + Space</code>, type <code>terminal</code>, and hit Enter. On Windows, search for "PowerShell." Then paste this in and press Enter:</p>

  <pre><code>curl -fsSL https://ollama.com/install.sh | sh</code></pre>

  <p>Your computer will think for a minute, download some files, and tell you when it's done. If you see something like "Ollama is now running" or just no red error text โ€” <strong>you did it.</strong></p>

  <h2>Step 2 โ€” Invite GLM inside (download the model)</h2>

  <p>Now that the door is in, you need to actually call GLM over. He lives in a big library called Hugging Face. Tell Ollama to fetch him:</p>

  <pre><code>ollama pull hf.co/unsloth/GLM-4.6-GGUF:TQ1_0</code></pre>

  <p>This one takes a while โ€” like, "go make a sandwich" while. GLM is a chunky boy (~73GB). When the progress bar hits 100% and the prompt comes back, <strong>you did it.</strong></p>

  <p>Quick note: if your computer doesn't have a lot of memory (less than 32GB of RAM or under 24GB of video card memory), grab the smaller cousin instead:</p>

  <pre><code>ollama pull hf.co/unsloth/GLM-4.5-Air-GGUF:Q4_K_M</code></pre>

  <p>He's smaller, faster, and almost as smart.</p>

  <h2>Step 3 โ€” Say hi to GLM (test it works)</h2>

  <p>Before we give him a desk, let's just check he's awake. Type:</p>

  <pre><code>ollama run hf.co/unsloth/GLM-4.6-GGUF:TQ1_0</code></pre>

  <p>You'll see a little <code>>>></code> prompt. That means GLM is listening. Type: <code>Hi! What's 2 plus 2?</code> and press Enter. If he answers โ€” even a weird answer โ€” <strong>you did it.</strong> GLM is alive in your house.</p>

  <p>Type <code>/bye</code> to send him to his room for now.</p>

  <h2>Step 4 โ€” Give GLM a desk (install Open WebUI)</h2>

  <p>Right now, talking to GLM means typing in that black terminal box. That's no fun. Let's give him a nice desk with buttons and a screen. That desk is called Open WebUI.</p>

  <p>Make sure Python is installed first (it usually is on Mac; on Windows grab it from python.org). Then in your terminal:</p>

  <pre><code>pip install open-webui
open-webui serve</code></pre>

  <p>It'll print some text and tell you it's running on something like <code>http://localhost:8080</code>. Open your browser (Chrome, Safari, whatever) and go to that address. You'll see a chat screen that looks suspiciously like the one at z.ai. <strong>You did it.</strong> GLM has a desk now.</p>

  <p>If you go to <em>Settings โ†’ Connections</em>, you'll see Ollama is already auto-detected. That's because both friends are at the same party.</p>

  <h2>Step 5 โ€” Hand GLM the toolbox (install the document libraries)</h2>

  <p>Here's the part most people miss, and it's the secret sauce. GLM by himself can only <em>talk</em>. He can't actually <em>save a Word file</em> or <em>draw a chart</em>. He needs tools โ€” just like a chef needs a stove and a pan.</p>

  <p>Open a new terminal window (or stop the open-webui one with Ctrl+C and restart it later) and install these tools. Each one is a different appliance in GLM's kitchen:</p>

  <pre><code>pip install python-docx          # the Word-document typewriter
pip install reportlab            # the PDF-printing press
pip install openpyxl             # the Excel spreadsheet maker
pip install python-pptx          # the PowerPoint slide projector
pip install matplotlib seaborn   # the chart-drawing crayons
pip install pandas               # the calculator
pip install weasyprint           # an HTML-to-PDF toaster (optional but nice)</code></pre>

  <p>When all of those finish installing without red errors โ€” <strong>you did it.</strong> GLM's kitchen is fully stocked.</p>

  <h2>Step 6 โ€” Write the recipe book (make skill files)</h2>

  <p>This is the magic step. A chef with tools but no recipes makes a mess. So we write GLM a little recipe book โ€” one recipe per kind of document.</p>

  <p>Make a folder on your computer, like <code>~/.glm-skills/</code>, and inside it put plain text files. Each one tells GLM the rules for that kind of document. For example, <code>pdf.md</code> might say:</p>

  <pre><code># How to make a PDF

- Use the reportlab library.
- Every paragraph must have at least 3 sentences.
- Never put a page break in the middle of a section.
- For Chinese characters, register Noto Serif SC first.
- Always save the .py script before running it.</code></pre>

  <p>Then in Open WebUI, go to <em>Settings โ†’ Advanced โ†’ System Prompt</em>, and paste the contents of the recipe that matches what you want. (If you want a Word doc, paste <code>docx.md</code>. If you want a PDF, paste <code>pdf.md</code>.) Now whenever GLM writes that kind of document, he follows your rules. <strong>You did it.</strong> GLM knows how the house runs.</p>

  <h2>Step 7 โ€” Ask for a report (the fun part)</h2>

  <p>Back in Open WebUI, type something like:</p>

  <blockquote><p>"Write me a 3-page PDF briefing about why the sky is blue, with a cover page and three sections."</p></blockquote>

  <p>If everything's wired up โ€” GLM is awake, the libraries are installed, and the recipe is loaded โ€” GLM will write a Python script, run it, and produce an actual <code>.pdf</code> file you can open and read. <strong>You did it.</strong> You just reproduced a Z.ai-style polished report on your own computer, with no API bill.</p>

  <h2>Quick recap โ€” the party in order</h2>

  <ol>
    <li>Install the door โ†’ <code>curl -fsSL https://ollama.com/install.sh | sh</code></li>
    <li>Invite GLM in โ†’ <code>ollama pull hf.co/unsloth/GLM-4.6-GGUF:TQ1_0</code></li>
    <li>Wave hello โ†’ <code>ollama run ...</code> and ask "what's 2+2?"</li>
    <li>Set up the desk โ†’ <code>pip install open-webui && open-webui serve</code></li>
    <li>Stock the kitchen โ†’ <code>pip install python-docx reportlab openpyxl python-pptx matplotlib</code></li>
    <li>Write the recipe book โ†’ make <code>~/.glm-skills/*.md</code> files, paste one into the system prompt</li>
    <li>Order a report โ†’ ask Open WebUI for a PDF and watch it appear</li>
  </ol>

  <p>Do these seven steps in order and you'll have a working local GLM setup before bedtime.</p>

  <h2>So is the Z.ai frontend open source?</h2>

  <p>Honest answer: <strong>no, the actual chat.z.ai website code is not open source.</strong> You can't just download the exact screen you see when you log into Z.ai.</p>

  <p>But here's what Z.ai <em>has</em> given away for free (and it's a lot):</p>

  <ul>
    <li><strong>The GLM model weights</strong> โ€” GLM-4.5, 4.6, 4.7, and GLM-5 are all on Hugging Face under the MIT license. This is the brain itself. Anyone can use it commercially.</li>
    <li><strong>The inference code</strong> โ€” at <code>github.com/zai-org/GLM-4.5</code>, you get the Python code that knows how to run the model.</li>
    <li><strong>Z.ai Coding Plugins</strong> โ€” at <code>github.com/zai-org/zai-coding-plugins</code>, a marketplace of plugins for Claude Code-style agents.</li>
    <li><strong>Synapse</strong> โ€” at <code>github.com/zai-org/Synapse</code>, a self-hostable AI workspace with shared conversations, memory, and MCP tools. This is the closest thing Z.ai has released to their chat frontend, but it's a separate product, not the chat.z.ai code.</li>
  </ul>

  <p>What's <em>not</em> open: the proprietary "skills" system that turns a plain chat answer into a polished multi-page report with the right fonts, page breaks, and cover pages. That part you build yourself with Step 6 above.</p>

  <p>So the realistic move is: take Z.ai's open model, run it on your machine, give it the open-source Open WebUI frontend, and write your own skill files. You end up with something that <em>works</em> like Z.ai, even if it doesn't <em>look</em> exactly like Z.ai. And honestly โ€” once you've tuned your skill files for a few weeks, yours might be better, because they'll be exactly tuned to the documents <em>you</em> care about.</p>

  <h2>How to tell GLM exactly what you want (the spec sheet)</h2>

  <p>Here's the part nobody explains: a model can't read your mind. "Make me a report" produces a different document every time. To get the polished, repeatable output you're after, you have to brief GLM the same way you'd brief a junior designer โ€” with specific numbers and specific rules, not adjectives.</p>

  <p>You can put the brief in two places. <strong>In the user prompt</strong> for one-off requests where every report is different. Or <strong>in the skill file</strong> for repeatable defaults where you want all your PDFs to look the same. The mental model: skill file = house style guide; user prompt = the specific assignment.</p>

  <h3>The 11 things to always specify</h3>

  <p>Every brief should answer these. Skip one and the model fills it in with a guess โ€” usually a bad one.</p>

  <ol>
    <li><strong>Length</strong> โ€” total page count, word count, and words-per-section. "8 pages" is too vague; "8 pages, ~3,000 words, ~400 words per body section, 4 body sections" is briefable.</li>
    <li><strong>Cover page</strong> โ€” yes or no, layout (full-bleed photo, solid color, or centered title only), and whether it should look "glossy" (gradient/photographic) or "minimal" (typographic only).</li>
    <li><strong>Table of contents</strong> โ€” yes or no, and if yes, how deep (just H1s, or H1 plus H2).</li>
    <li><strong>Headers and footers</strong> โ€” what goes in the header (report title? section name?), what goes in the footer (page numbers? copyright line? date?).</li>
    <li><strong>Page numbers</strong> โ€” format (1, 2, 3 or i, ii, iii for front matter), starting position (cover doesn't count? start at TOC?), and alignment.</li>
    <li><strong>Typography</strong> โ€” heading font, body font, and sizes. If you don't pick, the model picks for you, usually badly.</li>
    <li><strong>Color palette</strong> โ€” primary, accent, and background. Use hex codes, not adjectives. "Professional blue" means something different to every model on every day.</li>
    <li><strong>Section structure</strong> โ€” what sections, in what order, with what each one is about.</li>
    <li><strong>Visual elements</strong> โ€” charts? tables? callout boxes? sidebars? Specify which and where.</li>
    <li><strong>Tone and audience</strong> โ€” executive, technical, or general public.</li>
    <li><strong>Output format and path</strong> โ€” PDF, DOCX, XLSX, or PPTX, plus the exact save location on disk.</li>
  </ol>

  <h3>A copy-paste spec template</h3>

  <p>Here's a template you can fill in and paste into the user prompt or your skill file. Treat the bracketed values as the only things you change.</p>

  <pre><code># REPORT SPEC

Length: 8 pages total, ~3,000 words, ~400 words per body section
Audience: executive (non-technical)
Tone: confident, concise, no hedging

Cover:
  - Style: glossy, full-bleed gradient background (#0A2540 to #1E3A8A)
  - Title centered, white, 32pt
  - Subtitle below in lighter weight, 14pt
  - Date and author in bottom-right corner, 10pt

Table of contents: yes, H1 only, on its own page after cover

Headers: report title on left, section name on right
Footers: page number centered ("Page 3 of 8"), copyright line on left

Page numbers: arabic, start at 1 on the first body page
  (cover and TOC don't count)

Typography:
  - Headings: Noto Sans SC, 18pt, bold, #0A2540
  - Body: Noto Serif SC, 11pt, #1F2937
  - Captions: Noto Sans SC, 9pt, italic, #6B7280

Color palette:
  - Primary: #0A2540 (deep navy)
  - Accent: #F59E0B (amber)
  - Background: #FFFFFF
  - Callout background: #FEF3C7

Sections (in order):
  1. Executive Summary โ€” 200 words
  2. Market Context โ€” 400 words + 1 bar chart
  3. Key Findings โ€” 800 words + 2 tables
  4. Recommendations โ€” 400 words
  5. Appendix โ€” data tables, no word count

Visual elements:
  - 1 bar chart in section 2 (matplotlib, accent color)
  - 2 tables in section 3 (alternating row shading)
  - 3 callout boxes for key stats (amber background)

Output: PDF, saved to /home/me/reports/q4-summary.pdf</code></pre>

  <h3>How to actually make the cover "glossy"</h3>

  <p>"Glossy" is a vague word that means different things to different models. To get the look you actually want, specify these four things instead of just the word:</p>

  <ul>
    <li><strong>Background type</strong>: full-bleed photo, gradient, solid color, or texture.</li>
    <li><strong>Gradient direction</strong> (if gradient): "top-to-bottom, 135 degrees" or "radial from center".</li>
    <li><strong>Hex codes</strong> for both endpoints of the gradient.</li>
    <li><strong>Title treatment</strong>: shadow yes/no, embossed yes/no, all-caps yes/no.</li>
    <li><strong>Photo source</strong> (if full-bleed): "from Unsplash, query: modern cityscape at dusk" โ€” otherwise the model will guess, and it'll guess badly.</li>
  </ul>

  <p>A typical glossy cover brief looks like this:</p>

  <pre><code>Cover style: glossy, full-bleed gradient
Gradient: 135 degrees linear, from #0F172A (top-left) to #1E40AF (bottom-right)
Title: "Q4 2026 Market Review", centered, 36pt, white,
       slight drop shadow (rgba(0,0,0,0.3), 2px offset)
Subtitle: "Prepared for the Board of Directors", centered, 14pt, #E5E7EB
Bottom strip: thin amber bar (#F59E0B), 4px tall, full width, 24px from bottom edge
Date: "October 2026", bottom-right, 10pt, white</code></pre>

  <h3>Where each spec lives</h3>

  <table>
    <thead>
      <tr>
        <th>Spec type</th>
        <th>Where it goes</th>
        <th>Example</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>Reusable defaults (fonts, palette, page number style)</td>
        <td>Skill file (<code>pdf.md</code>)</td>
        <td>"All PDFs use Noto Serif SC for body..."</td>
      </tr>
      <tr>
        <td>Per-report variables (length, sections, topic)</td>
        <td>User prompt</td>
        <td>"Make me an 8-page Q4 review..."</td>
      </tr>
      <tr>
        <td>One-off flourishes (glossy cover, custom hero image)</td>
        <td>User prompt, near the top</td>
        <td>"Cover should be a glossy gradient..."</td>
      </tr>
    </tbody>
  </table>

  <h3>Two example briefs side by side</h3>

  <p><strong>Example A โ€” short and opinionated:</strong></p>

  <blockquote><p>"Make a 4-page PDF briefing on lithium supply chains. Glossy cover with deep navy gradient. TOC. Executive summary plus 3 body sections plus recommendations. Page numbers in footer, centered. Save as lithium.pdf."</p></blockquote>

  <p><strong>Example B โ€” long and fully spec'd:</strong></p>

  <blockquote><p>Use the template above, fill in every field, paste the whole thing into the chat.</p></blockquote>

  <p>Both work. Example A produces a good-but-generic report. Example B produces a report that looks like a human designer made it. The difference between the two is roughly the difference between a template you found on Etsy and one a brand agency would charge you five figures for.</p>

  <h2>Wrapping up</h2>

  <p>Think of it like this: the model is the brain, the agent loop is the hands, the Python libraries are the typewriter, and the skill files are the style guide. Skip any one of those four and the output drops a tier. Get all four right and you'll be producing Z.ai-quality deliverables on your own hardware, on your own data, with no API bill.</p>

  <p>Start with Steps 1 through 3 tonight. Get one goodnight-answer from GLM. Then come back tomorrow and finish Steps 4 through 7. By the end of the week, you'll have your own report factory.</p>
</article>

<article>
  <b>How to Run GLM Locally and Make It Write Polished Reports Like Z.ai</b>

  <p>If you've watched Z.ai hand back a beautifully formatted PDF or Word document in seconds and wondered "can I do that on my own machine?" โ€” the answer is yes, but you have to understand that the magic isn't in the model alone. Polished reports come from <strong>model + agent loop + document libraries + style instructions</strong> working together. The model is just one ingredient.</p>

  <p>This walkthrough covers the full stack: how to install a local GLM runtime, which quant to pick, how to wrap the model in an agent that can call tools, and the formatting rules that turn a wall of text into something you'd be proud to ship to a client. Let's build it piece by piece.</p>

  <h2>1. Pick your local runtime</h2>

  <p>There are four mainstream ways to run GLM locally. Which one you choose depends almost entirely on your hardware โ€” there's no "best" runtime, only the right one for your machine.</p>

  <table>
    <thead>
      <tr>
        <th>Runtime</th>
        <th>Best for</th>
        <th>Install</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><strong>Ollama</strong></td>
        <td>Easiest setup, good for 7Bโ€“70B quants, ships with an OpenAI-compatible server out of the box</td>
        <td><code>curl -fsSL https://ollama.com/install.sh | sh</code></td>
      </tr>
      <tr>
        <td><strong>vLLM</strong></td>
        <td>Best throughput on NVIDIA GPUs, production-grade</td>
        <td><code>pip install vllm</code> then <code>vllm serve "zai-org/GLM-4.6"</code></td>
      </tr>
      <tr>
        <td><strong>llama.cpp</strong></td>
        <td>CPU-only or mixed CPU/GPU, lowest memory footprint</td>
        <td>Build from source, use GGUF quants</td>
      </tr>
      <tr>
        <td><strong>MLX</strong></td>
        <td>Apple Silicon (M-series Macs)</td>
        <td><code>pip install mlx-lm</code></td>
      </tr>
    </tbody>
  </table>

  <p>For most people starting out, <strong>Ollama</strong> is the right call. It installs in one command, autodetects your GPU, and exposes an OpenAI-compatible endpoint that every agent framework on earth knows how to talk to. You can always graduate to vLLM later if you need higher throughput.</p>

  <h2>2. Pull the GLM model</h2>

  <p>GLM comes in a few sizes. The community-maintained Unsloth quants on Hugging Face are currently the most reliable GGUF files, and Ollama can pull them directly via the <code>hf.co/</code> prefix:</p>

  <pre><code># Smaller Air variant โ€” fits on 24โ€“48GB VRAM with quantization
ollama pull hf.co/unsloth/GLM-4.5-Air-GGUF:Q4_K_M

# Full GLM-4.6 (better quality, needs ~73GB for Q4)
ollama pull hf.co/unsloth/GLM-4.6-GGUF:TQ1_0

# Then run it
ollama run hf.co/unsloth/GLM-4.6-GGUF:TQ1_0</code></pre>

  <p>GLM-4.6 expanded the context window from 128K to 200K tokens, improved coding benchmarks, and โ€” most relevant for us โ€” refined its writing style to align more naturally with human preferences. If you have the VRAM, go straight to 4.6. If you're on a 24GB consumer card, the Air variant is a perfectly serviceable stand-in. Mac users should swap Ollama for MLX and call <code>mlx_lm.load("zai-org/GLM-4.6")</code> instead.</p>

  <h2>3. Expose it as an OpenAI-compatible API</h2>

  <p>Here's the underappreciated part: Ollama already exposes your local model on <code>http://localhost:11434/v1</code> using the OpenAI chat completions schema. That means any agent framework built for OpenAI โ€” which is basically all of them โ€” will work with your local GLM for free, with zero code changes. Verify the endpoint works:</p>

  <pre><code>curl http://localhost:11434/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model":"hf.co/unsloth/GLM-4.6-GGUF:TQ1_0","messages":[{"role":"user","content":"hi"}]}'</code></pre>

  <p>If you get JSON back with a <code>choices</code> array, you're in business.</p>

  <h2>4. Wrap GLM in an agent loop with tools</h2>

  <p>This is the part most people skip, and it's the <em>real</em> secret to polished reports. Z.ai doesn't just ask the model for a report. It gives the model <strong>tools</strong> โ€” file-write access, web search, code execution โ€” and a <strong>skill system</strong>: Markdown instruction files that define exactly how each document type should be formatted. You can reproduce both halves locally.</p>

  <h3>Easy path โ€” use an existing agent UI</h3>

  <ul>
    <li><strong>Open WebUI</strong> (<code>pip install open-webui</code>) โ€” connects to Ollama automatically, has a community marketplace of "tools" (Python functions the model can call), including <code>write_docx</code>, <code>write_pdf</code>, and friends.</li>
    <li><strong>Cline</strong> or <strong>Roo Code</strong> (VS Code extensions) โ€” point them at your local Ollama endpoint, hand them file-write and terminal tools. GLM-4.6 and 4.7 are explicitly tuned for these agent frameworks and the difference is visible.</li>
    <li><strong>Continue.dev</strong> โ€” similar pattern, good for inline workflows inside your editor.</li>
  </ul>

  <h3>Custom path โ€” write your own agent loop</h3>

  <ul>
    <li><strong>OpenAI Agents SDK</strong> (<code>pip install openai-agents</code>) โ€” point <code>base_url</code> at Ollama, register tools as plain Python functions.</li>
    <li><strong>LangGraph</strong> or <strong>smolagents</strong> โ€” more control over multi-step reasoning and tool sequencing.</li>
  </ul>

  <p>A minimal client looks like this:</p>

  <pre><code>from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:11434/v1",
    api_key="ollama",  # any non-empty string works
)

resp = client.chat.completions.create(
    model="hf.co/unsloth/GLM-4.6-GGUF:TQ1_0",
    messages=[{"role": "user", "content": "Write me a 3-section briefing on lithium supply chains."}],
)
print(resp.choices[0].message.content)</code></pre>

  <p>From here, the only limit is which tools you wire up.</p>

  <h2>5. Install the document libraries</h2>

  <p>The actual file production is done by Python libraries the model calls as tools, not by the model itself. The model decides what goes in the report; the libraries make it look good. Install the full stack:</p>

  <pre><code>pip install python-docx          # Word documents
pip install reportlab            # PDFs with full layout control
pip install openpyxl             # Excel spreadsheets
pip install python-pptx          # PowerPoint slides
pip install matplotlib seaborn   # charts and figures
pip install pandas               # data manipulation

# Optional but very useful:
pip install weasyprint           # HTML โ†’ PDF for prettier layouts
pip install jinja2               # templating for repeatable report structures</code></pre>

  <p>Once these are installed and exposed as tools the model can invoke, you've closed the gap between "the model produced text" and "the model produced a deliverable."</p>

  <h2>6. Mirror the "skills" pattern</h2>

  <p>The single biggest reason Z.ai's reports look polished is the <strong>skill files</strong> โ€” Markdown instructions that tell the model exactly how to format each document type. Cover page recipe, font choices, paragraph depth rules, page-break rules, character safety rules. Without these, the model produces generic Markdown and you get a mediocre PDF. With these, every report follows the same high bar.</p>

  <p>You can build a minimal version on disk:</p>

  <pre><code>~/.glm-skills/
  โ”œโ”€โ”€ docx.md         # Word rules: fonts, TOC, no page breaks mid-section
  โ”œโ”€โ”€ pdf.md          # PDF rules: ReportLab, CJK font registration, character safety
  โ”œโ”€โ”€ xlsx.md         # Spreadsheet rules: header styling, freeze panes
  โ””โ”€โ”€ pptx.md         # Slide rules: one idea per slide, color palette</code></pre>

  <p>Each file is just Markdown the model reads as system context when asked to produce that document type. When the user says "make me a PDF," you load <code>pdf.md</code> into the system prompt, then let the model emit Python that calls ReportLab. You can harvest real skill files from open-source agent frameworks โ€” Z.ai has open-sourced model weights and several tools at <code>github.com/zai-org</code>, and the structural pattern is easy to adapt.</p>

  <h2>7. Add the "polish" rules</h2>

  <p>These are the actual differentiators. Steal them verbatim โ€” they're what separates a generic model output from a Z.ai-style deliverable:</p>

  <ul>
    <li><strong>Content depth.</strong> Every section โ‰ฅ150 words, every paragraph โ‰ฅ3 sentences. No bullet dumps masquerading as analysis.</li>
    <li><strong>Page breaks only between cover โ†” TOC and TOC โ†” body</strong>, never mid-section. Mid-section page breaks are the single most common formatting tell that something was generated by a model that didn't have rules.</li>
    <li><strong>Chinese and special characters.</strong> Register <code>Noto Serif SC</code> and <code>Noto Sans SC</code> fonts before generating PDFs, or you'll get tofu boxes (โ–กโ–กโ–ก) everywhere a CJK character should be.</li>
    <li><strong>Script persistence.</strong> Have the model write a <code>.py</code> file first, then you execute it. On failure, edit-and-rerun rather than regenerate the whole thing. This one rule cuts iteration cost 5โ€“10ร—.</li>
    <li><strong>Two-stage generation.</strong> First call an <code>Outline</code> step (just structure), then per-section generation calls. This is how you get long, coherent documents instead of shallow one-shot output where the model runs out of ideas halfway through.</li>
  </ul>

  <h2>8. A 30-second recipe to start today</h2>

  <p>If you want to be up and running by tonight, here's the shortest path:</p>

  <pre><code># 1. Install Ollama + pull a GLM quant
curl -fsSL https://ollama.com/install.sh | sh
ollama pull hf.co/unsloth/GLM-4.6-GGUF:TQ1_0

# 2. Install Open WebUI for the agent surface
pip install open-webui
open-webui serve

# 3. Open http://localhost:8080
#    Settings โ†’ Connections โ†’ Ollama (auto-detected)
# 4. Install the "Document Tools" community pack
#    (docx / pdf / xlsx / pptx writers)
# 5. Add a custom system prompt containing the contents
#    of your skill files</code></pre>

  <p>From there, ask Open WebUI something like "Write me a 4-page briefing on grid-scale battery storage economics as a PDF." If the tools are wired up and the skill prompt is loaded, you'll get a real file back โ€” not just text in a chat window.</p>

  <h2>Wrapping up</h2>

  <p>The mental model to walk away with: <strong>the model is the brain, the agent loop is the hands, the Python libraries are the typewriter, and the skill files are the style guide.</strong> Skip any one of those four and the output drops a tier. Get all four right and you'll be producing Z.ai-quality deliverables on your own hardware, on your own data, with no API bill.</p>

  <p>Start small: Ollama + one GLM quant + Open WebUI + the document tools pack. Get one clean PDF out of it. Then iterate on your skill files โ€” that's where most of the polish actually comes from, and it's the part you can keep improving forever.</p>
</article>
{/html}
  

 ๐Ÿ“œ โฑ๏ธ โฌ†๏ธ