Document Type: Governance Blueprint & Reusable AI Master Prompt Classification: Private And Confidential (P&C) Attribution: Compile by: Harisfazillah Jamel Standard: Terminal & Cloud Technical Ebook & Handbook Standard (DSOM Rule 11 & Rule 22)
1. Executive Overview & Dual Purpose
This document serves two complementary functions:- The Reusable AI Master Prompt (Section 2): A complete, drop-in system prompt that can be provided to any advanced AI coding assistant (Google Antigravity, Google Jules, Claude, Cursor, ChatGPT) to autonomously orchestrate, style, and compile an entire repository of multi-file Markdown (
.md) documentation and source code into a publication-grade PDF handbook. - The Architectural Blueprint & Engineering Field Manual (Sections 3–7): An exhaustive technical record documenting the formatting standards, color palettes, typography pairings, CSS
@pagerules, and the ten critical engineering hurdles solved to eliminate syntax crashes, blank pages, link leaks, and ink waste during multi-format compilation (PDF, standalone HTML, EPUB 3, and styled ODT). - The Embedded Skill SOP (Section 6): The full operational specification of the
dsom-technical-book-compilerskill, ensuring complete self-containment.
2. The Reusable AI Master Prompt
Copy and paste the entire block below into your AI prompt window or agent instruction set:3. Visual Design System: The “Terminal & Cloud” Framework
3.1 Color Palette & Contrast Economics
3.2 Typography Pairing
- Prose:
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;Characteristics: Clean geometric sans-serif, high x-height, optimized for both 300 DPI print and high-res displays. Line height is fixed at1.55with10ptbase size. - Code & Configurations:
font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;Characteristics: Distinct character shaping (disambiguating0/Oand1/l/I), tabular numbers, ligature support. Sized at8.5ptwith1.4line height.
3.3 Print Page Budget & Paging Rules (@page)
4. The 10 Critical Engineering Hurdles Solved
Hurdle 1: Pandoc YAML Parser Explosions (Unknown alias)
- Failure Mode: Stitched multi-document markdowns retain individual OKF frontmatter blocks (
--- ... ---). Pandoc attempts to parse subsequent frontmatter blocks as YAML document streams, failing withUnknown aliasor corrupted titles. - Solution: A pre-processing function (
strip_frontmatter()) strips leading YAML frontmatter while capturingtitleanddescriptionto create formatted chapter metadata banners (.chapter-meta).
Hurdle 2: Nested Backtick Fence Collisions
- Failure Mode: Ingested markdown documents or playbook examples already contain triple backticks (
```). If the master compiler wraps them in triple backticks, the code block prematurely terminates, leaking raw code into prose. - Solution: Dynamic backtick scaling. The compiler scans the target code text; if triple backticks exist, it wraps the block in 4 backticks (
````); if 4 exist, it scales to 5.
Hurdle 3: Blank Overflow Pages & Cover Fragmentation
- Failure Mode: Manual page breaks (
<div class="page-break"></div>) combined with CSSpage-break-before: always;on H1 elements generate unwanted empty pages. Furthermore, default Pandoc title headers split the cover across Pages 1 and 2. - Solution:
- Eliminate all manual page break divs.
- Generate a standalone
cover.htmlpassed via--include-before-body=cover.html. - Enforce
#title-block-header { display: none !important; }and.cover-title { break-before: avoid !important; }. - Constrain cover page padding and metadata fonts so the entire cover fits inside Page 1.
Hurdle 4: Mermaid 10 Syntax Bomb Graphics (HTML Escaping)
- Failure Mode: Pandoc automatically escapes HTML entities inside
<pre class="mermaid"><code>(",<,>,-->). When Mermaid.js runs, it encounters illegal characters, rendering a pink syntax error bomb icon. - Solution: A dedicated post-pandoc HTML regex unescapes
",<,>,&and strips enclosing<code>tags before headless browser invocation.
Hurdle 5: Mermaid Node Collision in Multi-Diagram Handbooks
- Failure Mode: Different diagrams reuse common node identifiers (e.g.
NODE1,DB,CBE,PWP). Mermaid’s internal parser merges identical IDs into the same global SVG graph, corrupting diagram topology. - Solution: Mermaid Multi-Diagram Isolation Protocol. Every diagram must have unique diagram-scoped namespaces prefixed to all nodes (e.g.,
TB_for Master Architecture,PA_for Pattern A,PB_for Pattern B,PC_for Pattern C).
Hurdle 6: Headless Chromium Millisecond Timestamp Collision
- Failure Mode: Headless Chromium renders all page scripts in milliseconds. Mermaid’s default
mermaid.run()usesDate.now()timestamp IDs, causing ID collisions that draw multiple diagrams inside the same container. - Solution: Sequential DOM replacement. The browser script iterates over
document.querySelectorAll("pre.mermaid")and callsmermaid.render("diagram_svg_" + i, code)sequentially, injecting the returned SVG directly intoel.innerHTML.
Hurdle 7: Tall Vertical Flowcharts Splitting Pages
- Failure Mode: Long linear flowcharts (height > 600px) split mid-node across physical page breaks, causing dangling connectors and unreadable diagrams.
- Solution:
- Re-architect flowcharts into balanced 2-column grids (e.g., Phase 1 vs Phase 2).
- Set
pre.mermaid svg { max-width: 100% !important; height: auto !important; }. - Extract
innerHTMLrather thantextContentin the Mermaid pre-pass to preserve<br/>tags and card formatting.
Hurdle 8: Broken Relative Links & Leaked Local Paths (file:///)
- Failure Mode: Ingested documentation contains relative links (
../how-to/deploy.md) or absolute filesystem paths (file:///D:/Users/...), which break or leak workstation directories in the compiled PDF. - Solution: Soft-Path Link Resolution Mandate (3-Tier Normalisation Pipeline):
- Pre-index all chapters (
#chap-{slug}) and code files (#code-{slug}) into an in-memorylink_map. - Normalize link targets across 3 tiers:
- Tier 1: Exact match in
link_map. - Tier 2: Strip
file:///, Windows drive letters (C:/,D:/), root directory prefixes, andbuild/prefixes. - Tier 3: Basename-only fallback (
os.path.basename(target)).
- Tier 1: Exact match in
- Preserve
#fragmentanchor suffixes across all tiers. - Run an automated post-assembly audit to verify zero absolute paths survive in PDF links.
- Pre-index all chapters (
Hurdle 9: Critical Safety Warnings Hidden in Code Comments
- Failure Mode: Production playbooks contain vital operational warnings, vendor bug workarounds, and safety dispatches hidden in
#comments that SysAdmins miss when skimming compiled books. - Solution: Developer Commentary Extraction Protocol:
- Inspect the leading
#comment block of every playbook, script, and configuration file. - Scan for warning keywords (
BUG,FIX,Confirmed,live,vendor,NEVER,destroy,destructive,ORA-\d+,crash,escalation). - If keywords match, generate a ⚠️ orange warning callout (
callout-warning, “Developer Commentary, Read Before Executing”) rendered above the code fence. - If standard comments, render a 💡 blue note callout (
callout-note). - Preserve the original
#comments inside the code block intact.
- Inspect the leading
Hurdle 10: Headless Browser Print Timeouts & Compositor Stalls
- Failure Mode: Headless Chrome/Edge can hang indefinitely if web fonts or ESM modules fail to trigger draw completion, stalling CI/CD pipelines.
- Solution: Execute Chromium with strict flags:
Enforce a hard Python subprocess timeout (45–60s) to gracefully catch draw completion.
5. Multi-Format Compilation Commands
6. Complete Embedded Skill: dsom-technical-book-compiler
Below is the full, unabridged operational specification of the dsom-technical-book-compiler skill:
7. Operational Checklist for AI Agents & Compilers
Before finalizing any compiled handbook, the AI agent must verify:- Pure White Audit: No solid black terminal blocks exist in the compiled PDF.
- Blank Page Audit: Verified total page count has zero empty filler pages between chapters.
- Mermaid Audit: All diagrams render as clean vector SVGs with zero syntax error bomb icons.
- Link Leak Audit: Grep search the assembled HTML/PDF links for
file:///or Windows drive letters (D:/,C:/), result must be 0. - Commentary Audit: Leading playbook dispatches are rendered as human-readable callouts above the code fences.
- Confidentiality Audit: Running headers state
PRIVATE AND CONFIDENTIAL (P&C)and attribution readsCompile by: Harisfazillah Jamel.
Deep State of Mind (DSOM) For My AI Protocol | Harisfazillah Jamel (LinuxMalaysia) | 2026-09-04 Standard: UK English | DBP-standard Bahasa Melayu Malaysia (Piawai) | PRIVATE AND CONFIDENTIAL (P&C) | All Rights Reserved