Human Viewer Compatibility
From spec-memo Wiki, the living architecture & domain knowledge base
Feature Overview [edit]
The vault is designed to be opened directly by standard Markdown tools — Obsidian, VS Code Markdown preview, and similar viewers — with no plugin, binary, or GUI runtime required by spec-memo. Viewer support is purely passive: the vault layout and record schemas are standards-compliant Markdown with YAML frontmatter, so a human can browse the same knowledge an agent reads over MCP.
This page documents the file-format compatibility contract. The MCP/CLI surfaces remain the only supported way to write records; viewers are read-only.
Business Rules & Logic [edit]
- Record files are
<slug>.mdcontaining YAML frontmatter followed by Markdown body.parseRecordreads them;serializeRecordwrites them with trimmed body content. - Directory layout is stable and human-navigable:
projects/<projectId>/holdsINDEX.md,TRAPS.md,DECISIONS.md,PROMPTS.md,SESSIONS.md,WIKI.md, and kind subdirectories (traps/,decisions/,specs/,plans/,logs/,reviews/,scratch/, plus prompt/session stores). - Compiled views link to records with standard relative Markdown links (text is the record id, target is the kind subdir plus
<id>.md, for example a link to thetraps/trap-id.mdfile), and also print an Obsidian-compatible wikilink token as inline code, e.g. `[[trap-id]]`. Resolvers therefore work in both plain Markdown viewers and Obsidian without configuration. - The per-project
WIKI.mduses project-relative Markdown links to each record (target./<subdir>/<id>.md) plus `[[id]]wikilink tokens, and links the compiled viewsINDEX.md,TRAPS.md, andDECISIONS.md` in the same directory. - Compiled views are regenerated, never hand-edited:
AUTO-GENERATEDmaterial is overwritten byrebuildCompiledViews.WIKI.mdcarries<!-- AUTO-GENERATED BY spec-memo wiki — DO NOT EDIT DIRECTLY -->semantics. - No viewer-specific plugins, runtime binaries, or proprietary dependencies are required. Opening the vault root as an Obsidian vault or VS Code workspace must not error on vault contents.
- Relative link targets are project-relative files that exist on disk; links do not point outside the vault project directory.
- Frontmatter uses ordinary YAML scalars and arrays (
id,kind,title,status,severity,pathPatterns,tags,occurrences,lastSeen,hits,created,updated), which generic Markdown viewers render as a metadata block rather than executable content. - The default vault root is
~/.spec-memo(overridable viaSPEC_MEMO_ROOTor--vaultRoot); a human can open that directory directly.config.jsonandmemo.sqliteare non-Markdown files that viewers simply ignore. - Compiled views are plain Markdown with a scannable title and bullet lists; trap/decision entries show status, path patterns, and the
[[id]]token inline. A reader can follow either the relative link (plain Markdown) or the wikilink token (Obsidian). - Viewer access is read-only in spirit: the agent contract treats MCP/CLI as the only writer, and compiled views are regenerated so hand edits are overwritten.
Technical Architecture [edit]
src/schema.ts:parseRecord/serializeRecorddefine the on-disk Markdown + frontmatter contract.src/compiler.ts:rebuildCompiledViews(projectId, vaultRoot)writesTRAPS.md,DECISIONS.md,PROMPTS.md,SESSIONS.md, andINDEX.md. Trap and decision bullets include a relative Markdown link and a quoted[[id]]wikilink; supersedes relations are rendered as[[...]]tokens.src/wiki.ts:renderWikiMarkdownbuildsWIKI.mdfrom atemplate.md,mdLinkemits a relative Markdown link whose target is./<subdir>/<id>.md, andregenerateWikipersists it.splitWikiSections/readWikiSectionparse level-2 sections for section reads.src/vault.ts:RECORD_SUBDIRSand the vault structure define the human-visible tree; record subdirectories are keyed by kind viagetSubdirForKind.- Reads for viewers go through
memo wiki(print/regenerateWIKI.md) andmemo get; there is no viewer UI process in the core engine. memo wiki --project <id>prints an existingWIKI.md;memo wiki --regeneraterebuilds it from vault sources.readWikiFile,parseLastGenerated, andreadWikiSectionsupport human and programmatic section reads.insertWikiLink-style tokens are emitted as inline-code `[[id]]` so they are copy-paste friendly and do not create dangling links when a record is archived; the companion relative link always points at the real record file.
Provenance: 0015-viewer.spec.md.