Skip to content

serenakeyitan/tdoc

Repository files navigation

tdoc — Google Docs for markdown, with your agent as collaborator

See it live: https://tdoc.serenatan.workers.dev/d/conway-life/v/2

🌳 use artifacts in first-tree for free — the most efficient way for human & agent collaboration :D

tdoc-demo.mp4
Screenshot 2026-05-13 at 00 21 01

check out my recent work at https://github.com/agent-team-foundation/first-tree 🥇

Turn a prompt into an interactive doc, share it as a live URL, get Google-Docs-style comments back — straight into your agent.

Open-source take on Jesse Pollak's bdocs concept. Authored by an agent, not maintained by hand. tdoc deploys to your own free Cloudflare Worker, so you get a public shareable link with zero hosting cost and zero infra to manage — and it's an agent skill with built-in version control. It's a first-class Claude Code skill; it also runs under Codex (the skill auto-detects the host and falls back to plain-text prompts where Claude-specific tools aren't available — see Using tdoc with Codex).

You:  /tdoc new "an explainer with a slider showing how interest compounds"
Claude: <generates doc, opens it locally>
You:  /tdoc publish
Claude: https://tdoc.yourname.workers.dev/d/compound-interest/v/1

Anyone with the link reads it instantly and comments on any sentence, image, or chart. Your agent pulls those comments, regenerates the next version, and replies on each comment with ✅ applied / 🟡 partial / ❓ question — so you can see exactly what got addressed without leaving the doc.

The painpoint

You no longer need to be the router between your colleagues' comments and your agent.

Feedback on docs from a chat was always a tradeoff:

  • A nice UI for people to comment (Google Doc, Slack thread, screenshots) → but you copy-paste it all back to the AI by hand, every round.
  • Or clean structured input the agent can act on (raw JSON, "edit line 47") → but nobody wants to write feedback that way.

And docs made in chat have no version history — every regeneration overwrites the last.

tdoc gives you both sides: humans comment Google-Docs-style on any sentence/image/chart, the agent reads the same comments as structured input, and every edit is a new version you can flip back to. All free, all yours.

Think of it as Google Docs, but for markdown files and with your agent as a collaborator — multiplayer comments, comment status that stays in sync, full version history, and a one-line CLI to drive it all.

Install

Paste this into Claude Code or Codex:

Install tdoc by following https://github.com/serenakeyitan/tdoc/blob/main/ONBOARDING.md

The agent clones the repo, runs the doctor, walks you through the ~2 browser clicks for Cloudflare, and ends with a published URL. Zero to live in ~3 minutes.

Or via the plugin marketplace: /plugin marketplace add serenakeyitan/tdoc

Using tdoc with Codex

tdoc is authored as a Claude Code skill but is host-aware, so it works under Codex too:

  • Install location: clone (or symlink) the repo into ~/.codex/skills/tdoc (Codex reads ~/.codex/skills/), the same way Claude Code uses ~/.claude/skills/tdoc. The setup snippet resolves whichever location exists, and you can override with TDOC_SKILL_DIR.
  • Prompts: where the skill would use Claude Code's AskUserQuestion picker (only the first-run telemetry consent), under Codex it falls back to asking the same question as plain text and reading your typed reply. No functionality is lost.
  • What's the same: the worker, the CLI (bin/tdoc-*), comments, versions, publish — all host-independent.

What is not yet first-class on Codex: native slash-command registration (/tdoc …) — you invoke tdoc by pointing Codex at SKILL.md and asking it to run the workflow. That's the one rough edge versus Claude Code.

Commands

Command What it does
/tdoc new <prompt> Generate a new doc + open locally
/tdoc edit <slug> New version from open comments; replies on each with ✅/🟡/❓ status
/tdoc publish <slug> Deploy to your Cloudflare Worker (or Vercel, --platform vercel), get a public URL
/tdoc pull <slug> Sync comments from the published doc back to local
/tdoc fork <slug> Copy a doc to a new slug
/tdoc unpublish <slug> Remove a published doc from your Worker
/tdoc list Show all docs
/tdoc onboard First-time guided setup
/tdoc update Pull the latest skill code
/tdoc doctor Health check (deps, Cloudflare config)

Cost

$0 for normal use. Cloudflare Workers + R2 + KV all have generous free tiers that personal usage will never come close to. The same goes for the Vercel target (Functions + Blob + Upstash Redis free tiers). You own your account; nobody else (including the maintainer) sees your traffic or pays your bills.

Hosting targets

Publishing deploys the same worker code to a host you own; pick one on your first publish and it sticks (saved in ~/.tdoc/published.json):

  • Cloudflare (default) — Worker + R2 + KV, with a Durable Object serializing concurrent comment writes. The most battle-tested target.
  • Vercel/tdoc publish --platform vercel <slug> deploys a catch-all Vercel Function backed by Vercel Blob (docs) and Upstash Redis (metadata + comments, from the Vercel Marketplace). Same URLs, same commenting, same GitHub sign-in. Two caveats vs. Cloudflare: concurrent comment writes are not serialized (no Durable Object equivalent), and uploads are capped at ~4.5 MB per doc by Vercel's request limit. Details in vercel/README.md.

How comments work

It's the Google-Docs commenting model, built for markdown and wired to your agent:

  • Text: highlight any sentence (across paragraphs, across bold/links — anchors survive regeneration) → comment popup, cursor ready to type
  • Artifacts (img / canvas / svg / video / <pre>): hover → "Comment" pill → click
  • Threads: emoji reactions (👍 ❤️ 🔥 ✅ ❓ + LGTM) and replies; hover a reaction to see who reacted
  • Move / remove anchor: drag a comment to new text, or detach it entirely — it stays in the thread
  • Multiplayer: anyone with the link signs in once with GitHub and comments. Every comment is attributed to its real author, and concurrent commenters never clobber each other (writes are serialized per-doc — see Reliability below).
  • Status sync: comments carry a resolved-style status that stays in sync between the web view and your agent — tdoc-agent stamps each with ✅ applied / 🟡 partial / ❓ needs clarification when it regenerates, so "what's been addressed" is visible to everyone, live, without re-pinging.

Version history

Every doc is versioned, and every version is a full snapshot — not a diff. You can:

  • Flip back to any past version (/d/<slug>/v/2); a subtle banner on an older version links you to the latest.
  • Keep commenting on old versions — comments anchored to text that a later version removed are preserved, never silently dropped.
  • Pull the complete cross-version history of comments back to local with /tdoc pull (it merges, never overwrites).

This is the "edit history" half of the Google-Docs feeling: nothing you write — doc or comment — gets lost to a regeneration.

Reliability (what makes the multiplayer part trustworthy)

  • Concurrent comments never lost. Per-doc comment writes are serialized through a Cloudflare Durable Object, so two people commenting at the same instant both land — no last-write-wins clobber.
  • Comments survive every regenerate. When a new version reshuffles the doc, comments re-anchor to their artifact by content identity; if a target genuinely disappears, the comment is shown unanchored ("click to re-anchor") rather than attached to the wrong place.
  • Untrusted input is escaped. Comment text, author names, and avatars are HTML-escaped on render — a comment can't inject script into the page.
  • Auth: local docs comment anonymously with zero setup. Published docs require a one-time GitHub sign-in (Device Flow, scope read:user) before commenting.

Requirements

  • Node 18+
  • jq (for publishing)
  • For publishing, ONE of:
    • wrangler + a free Cloudflare account with R2 enabled (default), or
    • vercel CLI + a free Vercel account (/tdoc publish --platform vercel <slug>)

/tdoc onboard checks and installs these for you.

Roadmap (not built yet)

tdoc today is a comment + version surface — humans comment, the agent regenerates. These are wanted but not yet shipped (listed here so the feature list above stays honest):

  • Suggestion mode — propose an inline edit a reviewer can accept/reject, instead of leaving a comment.
  • Edit mode — edit the doc text in the browser, not only through the agent.
  • Collaborative / multi-editor editing — two people editing the same doc live (today, commenting is multiplayer; editing is agent-driven and single-writer per regenerate).
  • Track-changes-style edit history — version history exists today (full snapshots you can flip between); a per-change diff/track-changes view is the next step.

Want one of these? Open an issue.

Testing

The suite runs offline by default; browser and network suites are gated.

npm test            # all offline suites (worker logic, comment fold, reconcile,
                    # security, CLI, P3 hardening — no network, no browser)
npm run test:all    # also runs the gated suites:
                    #   ui.test.js / responsive.test.js  — real browser (needs playwright;
                    #                                       skip loudly if absent)
                    #   publish.test.js / onboarding.test.js — publish + doctor flows

Browser suites default to a committed local fixture (so they test the working-tree overlay, offline). Point them at a live doc with TDOC_TEST_URL=<url>. Install the optional browser dep with npm i -D playwright && npx playwright install chromium.

Telemetry

tdoc records when it runs, how it went (success / error / abandoned), how long it took, and a random UUID for your machine, and sends those events to the tdoc maintainer's Supabase. It does NOT record your tdoc content, your prompts, file paths, or anything else. Nothing is sent to Anthropic.

The maintainer uses this to figure out which features people use, what breaks, and what to fix next — without guessing.

What's collected (the full list)

Field Example
ts 2026-05-22T16:32:11Z
skill tdoc
skill_version 0.7.6
event_type skill_run / upgrade_prompted
outcome success / error / abandoned
duration_s 87
step which tdoc command — new / edit / publish / …
error_class short error tag, e.g. publish_timeout
error_message longer error context, ≤400 chars
session_id Claude Code session ID
installation_id random UUID per machine
os / arch darwin / arm64
sessions count of concurrent active sessions

It does not record your tdoc content, your prompts, file paths, or which git repo you were in. The full schema and edge-function code live in telemetry/ — read the code if you want to verify.

Three opt-out paths

  1. On first run: pick "Off" in the consent prompt.
  2. Persistent: echo off > ~/.tdoc/.telemetry-mode
  3. Ephemeral (one shell): export SKILL_TELEMETRY=off

How to delete your data

Your installation_id is at ~/.tdoc/telemetry/installation-id. Send it to the maintainer and ask them to delete rows matching it (one SQL line — no excuse not to).

Credit

The concept and original framing are Jesse Pollak's bdocs at Coinbase. tdoc is one possible open-source community implementation. If Jesse open-sources the real bdocs, use that.

License

MIT

About

Prompt-native interactive HTML docs — bdocs. Generate, comment on, and publish docs from inside codex &Claude Code.

Resources

License

Contributing

Security policy

Stars

102 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors