[Feature]: production `docmd serve` and live threads (comments kept in the markdown)
Is your feature request related to a problem?
docmd has no production server, and plugins that write cannot work on a deployed site.
- The official Docker image runs
docmd dev --host 0.0.0.0as its default command, so laptop-only behaviour runs in production (#156 is one result). --hostitself is dropped by the argument parser, so that command binds loopback and the container is unreachable.- Plugins can declare
requiresLiveServerand register actions, but onlydocmd devhosts them. The threads plugin, or any plugin that writes, stops at the laptop.
Describe the solution you'd like
Goal: a self-hosted docs site that people (and agents) can comment on, with the comments stored in the markdown itself: no database, no SaaS. That fits docmd's "no database" pitch, and threads already keeps comments in the markdown.
Two parts. The first is generic: a production docmd serve. The second, threads v2, builds on it.
docmd serve is the production counterpart of dev, like preview in Vite and Astro, start in Next, or serve in Docusaurus:
- a production build on a fixed port, with no browser auto-open, no port+1 fallback and no fs.watch;
- opt-in plugin actions over WebSocket, with an origin allowlist; writes are refused unless a trusted identity source is configured (fail safe);
- opt-in MCP over HTTP.
dev stays the laptop tool, unchanged.
Threads v2 turns threads into reviews:
- A review is one person's group of comments across pages. Drafts are private and saved on the server as you type.
- Publishing a review writes its comments into the markdown as one git commit, authored by the commenter. It happens on click, or automatically N seconds after the last edit.
- The person who started a review, or an admin, can discard it as one commit.
- A reviews panel lists reviews by author and date. Threads whose anchor text is gone are kept in an Orphaned group.
- Commenters are identified from a configurable trusted header set by an auth proxy. Write limits protect against a runaway agent.
- An optional git sync pulls the remote on an interval and pushes with a skip-deploy marker, so bot commits don't trigger redeploy loops.
Steps
Each step is a small PR that can be reviewed and merged on its own, sent in this order. The two fixes stand alone and are useful whatever you decide about the rest.
Fixes (independent)
- [x] MCP
read_docreturns only markdown inside the docs source directory (todayread_doc {route: ".env"}returns the file): #268 - [x]
--hostis parsed and honoured bydocmd devand workspace dev, so the Docker image'sdev --host 0.0.0.0is reachable: #269
docmd serve
- [x] Plugin actions receive a context (who is calling, from where) from the action dispatcher: #272
- [x]
docmd serve: production static server: #273 - [x] Plugin actions under
serveover WebSocket (origin allowlist, writes need a trusted identity): #277 - [x] Opt-in MCP over HTTP under
serve: #278 - [x] Docker image defaults to
serve, plus docs: #279 (docs: docmd-io/docs#23)
Threads v2 (on top of serve)
- [ ] Threads file format v2 and config validation errors: #287
- [ ] Server-side drafts and reviews: #290
- [ ] Publish a review into the markdown in one atomic write (the git commit comes with step 15): #291
- [ ] Publish widget: collect mode and auto-publish: #292
- [ ] Identity from a trusted header; permissions (edit and delete your own comments, configurable resolve, admins)
- [ ] Discard a review
- [ ] Reviews panel and orphaned threads
- [ ] Git sync: batched commits and push with a skip-deploy marker; pull on an interval and rebuild
- [ ] Write limits
Everything above already runs in my fork (svallory/docmd), where it serves an internal docs site behind an SSO proxy. I'd rather agree on the direction here before sending steps 3 onward. In particular: do you want serve in docmd itself?
Describe alternatives you've considered
- Keep running
devin production. It has the problems above, and its WebSocket origin guard is loopback-only, so plugin actions cannot work behind a proxy anyway. - A separate server package outside docmd. It would duplicate the build and plugin-action plumbing, and the Docker image would still have no production mode.
- Storing comments in a database or a SaaS service. That goes against docmd's no-database model, and agents can't read the comments next to the text.
Hi @svallory,
Thank you for putting together such a clear, well-structured proposal! We have officially merged both PR #268 and PR #269 into main.
We are completely aligned with this vision and all-in on the roadmap you've laid out. Keeping comments and collaborative reviews in plain Markdown with zero database dependencies fits docmd's philosophy perfectly.
A few thoughts from our side:
docmd servein core: Yes, having a dedicated production server mode in docmd makes complete sense alongsidedev. It fills an important missing link for production and containerized deployments.- Modular PRs: Your approach of sending focused, self-contained PRs with test contracts worked wonderfully for #268 and #269. We'd love to continue with that pattern so we can review, test, and merge each step quickly.
- Collaboration: We're actively building towards the
0.9.10release cycle. As you build along, feel free to tag us if you'd like to collaborate, test against edge cases, or bounce architecture ideas off each other. We would love to build and test along with you!
Keeping this issue open as our tracking home for Steps 3 onward. Really excited to see Threads v2 come to life!
Hey @svallory, quick update: both #272 (action context & shared host) and #273 (docmd serve) are now tested and merged into main!
All contracts passed cleanly. Looking forward to Steps 5–7 when you're ready.
Merged #277, #278 and #279, completing the docmd serve implementation. We've also released docmd 0.10.0, which includes these features along with the new MDX Lite feature.
Further development of Threads V2 will now build on top of 0.10.0, using docmd serve as the foundation.
You can start with further development. Cheers! ✌🏼