Skip to content

Org-mode as a first-class record format#5

Merged
mwunsch merged 1 commit intomainfrom
org-mode-first-class
Apr 30, 2026
Merged

Org-mode as a first-class record format#5
mwunsch merged 1 commit intomainfrom
org-mode-first-class

Conversation

@mwunsch
Copy link
Copy Markdown
Owner

@mwunsch mwunsch commented Apr 30, 2026

Summary

  • .org files now parse, render, and round-trip through the same surfaces as .md files — record store, agents, MCP, TUI, web.
  • Org agents work end-to-end: :CLASS: agent in the property drawer is recognised; :CAPABILITIES: accepts the same compact spec form egghead agents grant already uses; the disposition is the prose body with the file-level metadata stripped before it reaches the model.
  • New default_format config key chooses the extension for newly created records (default still markdown). Existing files keep their on-disk format.
  • New site guide at site/content/guides/org-mode.md (Integrations); the Records guide gains a one-line cross-reference.

Test plan

  • mix test — full suite green locally on 1162 tests
  • Open a .org record in the TUI: headlines keep their stars, TODO/DONE colored, paragraphs wrap correctly
  • Open a .org record in the web view: drawer visible, #+BEGIN_SRC markers around source blocks, wikilinks navigate
  • Create a .org agent (or rename the agents/borges.org example) and prompt it through chat or egghead_prompt over MCP
  • Set default_format: org in config.yml, create a record via egghead_create, verify it lands as .org

🤖 Generated with Claude Code

Egghead now reads and writes .org files alongside .md files. Both
formats parse into the same Record shape, share the same id and link
graph, and route through the same agent / MCP / TUI / web surfaces.

Parser & writer
  - Record.Parser detects .org via #+-keywords / property drawer /
    extension; parse_org keeps the body byte-faithful and extracts
    metadata from #+TITLE/#+AUTHOR/#+FILETAGS/:ID:/:LINKS:/:CLASS:
  - Record.OrgWriter generates skeletons for new records and
    line-splices field updates on existing files
  - RecordStore.create_record accepts format: :org (or "org");
    update_record preserves the existing on-disk format

Rendering
  - Web: Egghead.Web.OrgHTML walks the OrgParser AST so headlines
    keep their stars, TODO/DONE render as styled badges, drawers
    render as <dl>, source blocks keep their #+BEGIN_SRC markers
  - TUI: Egghead.TUI.OrgRender mirrors the same fidelity in row/span
    output; OpenTUI.Markdown.wrap_spans is now public so any renderer
    producing the same span shape can reuse it
  - MarkdownCache becomes format-aware via a :format key
  - LiveView dispatches on record.format; CSS adds .org-* styles;
    the CodeMirror editor disables markdown grammar for .org records

Agents in org-mode
  - Record.Agent.from strips the file-level keyword block and the
    first :PROPERTIES: drawer from the body before passing it to
    the model, so an org agent's prompt is the prose part only
  - Capability.parse now delegates string input to the existing
    parse_grant_spec/1, so an org agent's :CAPABILITIES: drawer
    accepts the same compact form `egghead agents grant` accepts:
      records.read net.get{hosts=[a.example.com,b.example.com]}
  - Capability.tokenize is bracket-aware and public so the agent
    record projection can pre-tokenize without naïve comma split

MCP, config, defaults
  - egghead_create gains a `format` field; egghead_get returns the
    record's format
  - Config.default_format toggles the default for new records;
    documented in the Configuration guide alongside default_model

Docs
  - New site/content/guides/org-mode.md (Integrations) — points at
    the existing record / agent / capability surfaces and explains
    the org-specific bits (frontmatter mapping, disposition
    projection, what isn't implemented). Records guide gains a
    one-line cross-reference

Tests (~70 new across writer round-trip, byte-stability, web HTML
fidelity, TUI rendering, capability syntax, MCP create/update, and
the org disposition projection)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mwunsch mwunsch merged commit 983f487 into main Apr 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant