Skip to content
ncsaPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

EverDraft

Turn rough notes into well-written documents — and keep every version.

You can keep many documents. Each lives in its own folder under documents/<slug>/ with its own notes.txt (the raw material), prompt.md (how to write it up), the live document.md, and a History/ of every prior version. Pick or create a document in the header, edit its notes and prompt, and click Generate: the model writes a polished new document.md, the previous one is moved into that document's History/, and you can diff the current document against any earlier version to see exactly what changed.

It reuses the pieces from the other apps here: the NCSA Lumen model gateway (lumen.py) and a small Flask + Markdown web UI.

Setup

echo 'sk-...' > lumen_key.txt     # your Lumen key (gitignored)
source setup.sh                   # creates .venv, installs deps, loads the key
./server.py                       # https://127.0.0.1:5099

Open the URL, edit the notes and the prompt, and click Generate.

The server runs over HTTPS with a self-signed certificate it generates on first run (cert.pem / key.pem beside the app, both gitignored — needs openssl on PATH). Your browser will warn once about the self-signed cert; accept it to proceed. HTTPS keeps the page, your login (if you add a users.csv), and the document content encrypted in transit — worth it on any shared network. If something else terminates TLS in front of the app (a reverse proxy), or you just want plain HTTP locally, set EVERDRAFT_TLS=0.

How it works

Each document is a folder:

documents/<slug>/
  notes.txt      your raw material (single file) …
  notes/         … or a folder of sources — see below
  prompt.md      how to write it up (system prompt; seeded from the root template)
  document.md    the live document (regenerated each time)
  History/       document-<timestamp>.md — every previous version
  meta.json      the display title

Notes can be a single file or a whole folder

The raw material can be one notes.txt, or a notes/ folder holding many files — and those files can be nested in subfolders. When a notes/ folder is present, EverDraft gathers every text file under it, recursively, and feeds all of it to the model (each piece is tagged with its relative/path so the model can tell the sources apart). This lets you draft a document from a pile of source documents instead of one pasted blob.

  • Create documents/<slug>/notes/ and drop files (or subfolders of files) into it. Text formats are included directly (.md, .txt, .csv, .json, .yaml, .rst, extensionless, and anything that decodes as UTF-8 text).
  • PDF, DOCX, and XLSX are supported too — EverDraft extracts their text at generation time (pypdf, python-docx, openpyxl) and feeds that in like any other note. Image-only (scanned) PDFs have no selectable text, so they come through empty — those need OCR, which isn't built in. Other binaries (images, .doc/.xls, etc.) are skipped.
  • In folder mode the Notes panel is read-only: it lists exactly which files are included (with sizes) and lets you preview any one — you edit the files on disk.
  • You can use both: if a notes/ folder exists and there's a sibling notes.txt, both are fed in (the loose notes.txt is listed as one more source). With no folder, notes.txt alone is used, as before.

Subfolders are represented by a summary

Each subfolder under notes/ gets its own generated summary, and that summary — not the subfolder's raw files — is what's fed into the document. This keeps big trees of source material manageable and gives the model a clean, condensed view of each part.

  • Summaries roll up: a subfolder's summary is built from its own files plus its child subfolders' summaries, bottom-up, so one top-level summary stands in for everything beneath it. Files sitting directly in notes/ are still included in full.
  • They auto-refresh: each time you Generate (and via the ↻ Summaries button), EverDraft rebuilds any summary whose folder changed — a file added, edited, or removed anywhere beneath it. A changed deep file re-summarizes every folder above it. The summarization prompt is fingerprinted too, so if it's ever edited every summary rebuilds on the next run. Up-to-date summaries are left untouched.
  • The Notes panel marks each subfolder with a summary chip, how many files it covers, and a stale chip when it's due for a rebuild. Click view to read the summary.
  • Each summary lives in notes/<subfolder>/.everdraft_summary.txt, with a companion .everdraft_summary.json tracking what it was built from and which prompt built it (so staleness is detected). Both are hidden dotfiles, namespaced to avoid colliding with your own notes — don't hand-author them; they're regenerated (an older summary.txt from a previous version is ignored as input and removed on the next rebuild). On the command line, rebuild without generating via ./everdraft.py --summaries.

Each Generate (on the active document): saves your on-screen notes/prompt → sends them to the model → moves the old document.md into that document's History/ → writes the new document.md. The UI then shows the diff of what changed.

The root prompt.md is the template a new document's prompt.md starts from — edit it to set your house style for new documents. Each document's own prompt.md can then diverge.

Stay close to previous

Check Stay close to previous in the header before generating and — if the document already has a version — EverDraft hands the current document.md to the model as a baseline and asks it to revise minimally: keep the existing wording, structure, and tone, and change only what the notes require. Great for incremental edits where a full rewrite would churn text you're happy with. With no existing version (the first generation) it has no effect. On the command line: --close.

Read it aloud

Click 🔊 Read in the header to hear the current document.md spoken. EverDraft flattens the Markdown to plain words and synthesizes speech with ElevenLabs (the same voice stack as docent), streaming it back as one MP3 you can Stop at any time.

  • Needs an ElevenLabs key. It's read from ELEVENLABS_API_KEY, an elevenlabs_key.txt beside the app (gitignored), or — if neither is set — docent's own elevenlabs_key.txt next door, so a machine already running docent needs no extra setup. With no key, the Read button simply doesn't appear.
  • Pick a voice. Named voices live in voices.yaml beside the app — a default voice: and a personas: list (the first is the default). When more than one is configured, a voice dropdown appears next to Read. The shipped ids are the same ElevenLabs voices docent uses, so the shared key just works; edit the file to add or change voices. A single voice can also be forced with EVERDRAFT_VOICE_ID / EVERDRAFT_VOICE_MODEL / EVERDRAFT_VOICE_FORMAT, or point EVERDRAFT_VOICES at a different YAML file.
  • Expressive (emotion cues). Tick Expressive before Read and a quick model pass inserts ElevenLabs [emotion] delivery cues ([warm], [thoughtful], [pause], …) into the spoken copy only — your saved document.md is never changed. Off by default; when on it costs one extra model call per freshly-read document. The cues are only heard with a tag-aware voice model, so voices.yaml defaults to eleven_v4_turbo.
  • Cached per paragraph, until the document changes. The first time a block is read its audio is saved under documents/<slug>/.audio/, keyed by voice + Expressive + that block's text, so re-reading it — or re-reading the whole document — is instant (no re-synthesis and, in Expressive mode, no repeat model call). Switching voice or toggling Expressive just uses a different key. When you Generate a new version that actually changes the text, the whole .audio/ cache is cleared, so the next Read synthesizes the new wording fresh and stale clips don't pile up (a Generate that produces identical text keeps the cache).
  • Starts fast (streams by paragraph). Read doesn't wait for the whole document to synthesize. It plays block-by-block, like docent: as soon as the first paragraph is ready it starts speaking, and the next block is already being synthesized in the background — so playback begins in about the time it takes to voice one paragraph, not the whole piece. Each block is highlighted and scrolled into view as it's read.
  • Read one paragraph, or from here on. Hover any block in the document (paragraph, heading, list item, quote) and two small buttons appear at its right edge: 🔊 reads just that block, and ⏩ reads from that block to the end of the document (streaming onward, block by block, like the header Read). Both use the chosen voice + Expressive mode and highlight each block as it plays; the button you pressed turns into a ⏹ while it reads — click it again (or the header Read, now ⏹ Stop, or another block) to stop. Handy for re-hearing a single sentence, or picking up partway through.
  • No length cap. A paragraph longer than the voice model's limit is itself split into chunks and stitched back into one clip, so any block reads cleanly.
  • Save with audio (offline read-along). Click ⬇ Save with audio in the header to download a single self-contained .html of the document with its narration baked in. Each block is synthesized in the chosen voice + Expressive mode (reusing the cache, so blocks you already read cost nothing) and embedded as a base64 MP3; the saved file lays the document out block-by-block with a compact 🔊 (play just this block) and ▶ from here beside each one. Three ways to listen: a ▶ Play all button that reads the whole thing straight through; 🔊 to hear a single paragraph; or ▶ from here to start at a block and continue to the end. To keep the page clean, the audio scrubbers stay hidden — only the block that's currently playing reveals its progress bar, one at a time. The read-through modes highlight and scroll to each block as they go; the header button becomes ⏸ Stop and whichever control you pressed turns into ⏹ (click it to halt). It works entirely offline — no server, no key — so it's an easy way to share a listenable copy. (Like docent's "Save session", it's assembled client-side.)

Command line

./everdraft.py --new "My Report"     # create a new document
./everdraft.py --list                # list documents
./everdraft.py --doc my-report       # generate that document from its notes + prompt
./everdraft.py --doc my-report --diff  # unified diff: current vs most recent history

With no --doc, commands act on the active document (the one selected in the UI).

Environment variables

Variable Purpose Default
LUMEN_API_KEY model API key (else lumen_key.txt) —
EVERDRAFT_MODEL model id (falls back to DOCENT_CHAT_MODEL) glm-5.3
EVERDRAFT_HOST / EVERDRAFT_PORT bind address / port 127.0.0.1 / 5099
EVERDRAFT_TLS 0 serves plain HTTP (e.g. behind a TLS-terminating proxy); otherwise self-signed HTTPS 1
EVERDRAFT_CERT / EVERDRAFT_KEY TLS cert / key paths (auto-generated if missing) cert.pem / key.pem
EVERDRAFT_USERS path to a users.csv to require login (open if absent)
ELEVENLABS_API_KEY key for Read aloud (else elevenlabs_key.txt, else docent's) —
EVERDRAFT_VOICES path to the voices/personas YAML voices.yaml
EVERDRAFT_VOICE_ID / EVERDRAFT_VOICE_MODEL / EVERDRAFT_VOICE_FORMAT fallback voice (no voices.yaml) sJOX… / eleven_v4_turbo / mp3_44100_128

Notes

  • Auth is optional. With no users.csv, the app is open (meant for local use). Add a users.csv (username,password per line; passwords may be Werkzeug hashes) to require a login — the same scheme as the other apps here.
  • The whole documents/ tree is gitignored (it's your working content). The root prompt.md (the template new documents start from) is tracked. A fresh checkout has no documents — the app shows "No documents yet"; click + New to create one.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages