Quick add: a note or a photo into issues
Status: Phase 1 implemented and verified, text and image. Phase 2 implemented,
with a browser pass still pending.
One input, either a text note or an image, becomes one or more issues. A model
frames it into a title, a description and labels. A human then reviews the drafts
before anything is written to git.
Flow
sequenceDiagram
participant U as User
participant C as Client
participant S as Server
participant M as Qwen3 on Workers AI
U->>C: note or photo
C->>S: POST quick/preview
S->>M: frame, no lock and no write
M-->>S: JSON issues
S-->>C: drafts + knownLabels
C->>U: review each draft
U->>C: Create reviewed (N)
C->>S: POST quick/commit
S->>S: one mutate, one commit
S-->>C: IssueDto list
S-->>C: issue.created per issue
C->>U: open first issue popup
Decisions locked
- Model
@cf/qwen/qwen3-30b-a3b-fp8on Cloudflare Workers AI. - No streaming.
/no_thinkin the prompt. Temperature 0. - Output cap 2000 tokens. Note cap 2000 characters.
quick/previewnever writes.quick/commitis the only writer.- Splitting is uncapped in the product. A code guard rejects an absurd count.
- Labels are proposals. The user confirms a label by leaving it selected.
- A new tag may be proposed. The review marks tags that are not existing ones.
The model was chosen by sweeping all 24 free-tier text models. Only a handful
both split correctly and keep the note language. Qwen3 was fastest and cheapest
of those, at about 0.84 s and 4.8 neurons for a three-task note. The prompt was
chosen by an eight-variant bake-off. Both are summarized under Measured basis.
Phase 1: server
No frontend work, testable with curl.
1.1 Framing client
crates/patlas-server/src/text.rs, new module. An OpenAI-compatible chat client,
mirroring the shape of vision.rs.
- One request, non-streaming, whole answer validated before use.
- The system prompt is the V6 block below, ending in
/no_think. response_formatis a JSON schema, so the reply shape is enforced by the
runtime and not just requested.- The note is truncated to 2000 characters before sending. Measured at roughly
1000 input tokens for Latin and Cyrillic text. - The reply is sanitized: drop empty titles, trim, clamp titles to 120
characters, dedupe labels, keep at most 3 labels, cap drafts at 25. - Any failure returns an error. The caller falls back to
deterministic(text),
which makes the first line the title and the rest the body.
You turn a raw note into project tasks.
Reply with JSON only, in exactly this shape:
{"issues":[{"title":"...","body":"...","labels":["..."]}]}
Rules:
- Split only for clearly distinct tasks. Default to one issue. Two symptoms of
the same page or feature are one task.
- title: at most 80 characters, imperative, capitalised, no trailing period.
- body: one short sentence, or "" when the title is enough.
- labels: 1 to 3 lowercase kebab-case tags. Reuse an existing tag when it fits.
Invent a new one when none fit. Never leave labels empty.
- Never translate. Write title and body in the note's language.
Existing labels: <injected>
Example
Note: "checkout crashes on ios and the receipt email never arrives"
{"issues":[{"title":"Fix checkout crash on iOS","body":"Checkout crashes on iOS.","labels":["bug","ios"]},{"title":"Fix missing receipt email","body":"The receipt email never arrives.","labels":["bug","email"]}]}
Example
Note: "срочно: на странице оплаты сумма дублируется при повторном нажатии. и ещё кнопка логина глючит на сафари"
{"issues":[{"title":"Исправить дублирование суммы при оплате","body":"Сумма дублируется при повторном нажатии.","labels":["bug","payment"]},{"title":"Исправить кнопку логина в Safari","body":"Кнопка логина не работает в Safari.","labels":["bug","ui"]}]}
Example
Note: "the dashboard takes 8 seconds to load after login and the charts block everything"
{"issues":[{"title":"Fix slow dashboard load","body":"The dashboard takes 8 seconds to load after login and the charts block rendering.","labels":["performance"]}]}
1.2 Configuration
Environment, in the style of MOONDREAM_*:
| Variable | Meaning |
|---|---|
FRAME_MODEL_URL | Base ending in /v1, account-scoped |
FRAME_MODEL_API_KEY | Bearer token |
FRAME_MODEL | Model id, defaults to the Qwen3 one |
FRAME_MODEL_TIMEOUT_SECS | Request timeout, default 20 |
Deployment adds /opt/patlas-rust/frame-model-env to the unit with the optional- prefix, the same way moondream-env is wired. When the URL or key is unset,
quick add still works and degrades to the deterministic split.
1.3 Label injection
The runtime already holds the snapshot, so the server aggregates the project
labels itself. No new endpoint and no trust in the client.
existing = snapshot.issues.flat_map(labels).map(trim).filter(non-empty).unique.sorted
The list goes into the prompt. The same list is returned as knownLabels so the
review page can mark a proposed tag that is not yet in the project.
1.4 Bulk create
runtime.create_issues_bulk(inputs, column, board, by) -> Vec<IssueDto>.
- One
mutate, so one lock and one git commit for the whole set. emit_diffalready emits oneissue.createdper new issue, so the live board
updates with no change to the event layer.- Empty input is rejected. A board or column places the issue. Without either,
the issue belongs to the project only.
1.5 Routes
Both sit under /api/board/:slug, after the membership check, so they inherit
the existing auth.
| Route | Body | Effect |
|---|---|---|
POST .../quick/preview | { text } or { imageDataUrl } | none, returns { drafts, knownLabels } |
POST .../quick/commit | { issues: [{ title, body, labels }] } | bulk create, returns { issues } |
preview is a pure transform. commit is the only writer, and it takes exactly
what the user reviewed.
1.6 Image arm
previewwithimageDataUrl: decode with the existing 2 MB cap, caption the
bytes through Moondream without storing, then run the caption through the same
framing client. Bytes stay on the client.commit: store the image as WebP under.project/images/, then appendto the body of the first draft.- Storing happens at commit only, so a cancelled review leaves no orphan image
and no extra commit.
1.7 Tests
- Unit: prompt building with and without labels, reply parsing, sanitizing,
deterministic fallback, note truncation. - Route: preview with the model disabled returns one deterministic draft and
emits no event. Commit of three drafts produces one commit and threeissue.createdevents.
1.8 Verification
curlpreview and commit against the live box with a session cookie.- Confirm preview emits no WebSocket event and commit emits one per issue.
- Record latency and neuron usage for the three-task Russian note.
Phase 2: client
Touches web/app, which stays out of scope except by coordination. This is that
coordination.
2.1 Composer
Extend web/app/add-issue.tsx, the composer shared by the Issues page and the
bottom panel, to accept a text note or a pasted or dropped image. Submit callsquick/preview and hands the drafts to the review page.
2.2 Review page
- A dedicated route holding the draft list in client state.
- One draft at a time, rendered in the existing issue editor shell, with title,
body and labels editable. - Previous and Next move between drafts. Confirm marks the current
one reviewed. - After the last draft is confirmed, Create reviewed (N) appears and calls
quick/commit. - Drafts start in memory. A reload loses the review. Reuse
web/app/drafts.ts
only if that turns out to bite.
2.3 Label confirmation
- Every proposed label is selected and unconfirmed.
- A label not in
knownLabelsgets a distinct marker, so introducing a tag is
visible. - Unselecting removes it. Only what remains is sent at commit.
2.4 Commit and popup
- On success, upsert the returned issues, then
openIssue(first.id). - A split shows the count. The board is the list, so the popup opens only the
first. - Remote clients see
issue.createdevents and never auto-open anything.
Measured basis
Model
All 24 free-tier text models were tried on one Russian three-task note. The two
requirements, correct splitting and keeping the note language, eliminate nearly
everything.
| Model | Wall | Neurons | Notes |
|---|---|---|---|
| qwen3-30b-a3b-fp8 | 0.84 s | 4.8 | splits, keeps Russian, sparse labels |
| mistral-small-3.1-24b | 4.4 s | 15.8 | splits, keeps Russian |
| gemma-sea-lion-v4-27b | 2.5 s | 14.6 | splits, keeps Russian |
| llama-4-scout-17b | 1.8 s | 12.7 | splits, loose labels |
| llama-3.3-70b | 3.7 s | 28.4 | splits, terse titles |
| qwen3.8-27b | 18.2 s | 197 | ignores /no_think |
| llama-3.2-3b, llama-3.1-8b-fp8-fast | 0.4 s | 2 to 3 | never split |
| llama-3.1-8b-fp8, granite-micro, gpt-oss-20b | translate the note | ||
| llama-3.2-1b, qwq-32b | do not return JSON |
Free-tier budget at 4.8 neurons is roughly 2000 calls a day for three-task
notes, and about twice that for single-task notes.
Prompt
Eight variants were scored across seven notes on empty labels, language
violations and over-splitting.
| Variant | Empty labels | Language | Over-split | New tags |
|---|---|---|---|---|
| V1 baseline | 1 | ok | no | performance |
| V2 +labels +capital | 0 | 1 violation | no | performance |
| V3 / V4 / V5 with examples | 0 | ok | yes | mixed |
| V6 with examples and one single-issue example | 0 | ok | no | performance |
| V7 explicit do-not-split rule | 0 | ok | yes | performance |
| V8 no examples | 0 | 2 violations | no | none |
Two findings drive V6. Examples are required, because without them the model
transliterates Russian and stops inventing tags. Examples also teach
over-splitting, and the fix is one example whose note stays a single issue. An
explicit "if unsure, do not split" rule did not work.
Known residual: labels are sometimes mapped to the wrong existing tag, such asui for a VAT change. This is left to the review page rather than tuned with
another rule, which would overfit the test notes.
Open
- Whether reviews survive reload through IndexedDB, or stay in memory.
- Whether a proposed new tag needs an explicit approve action, or unselecting is
enough. - Whether the Moondream caption moves to
@cf/moondream/moondream3.1-9B-A2Bto
consolidate the account.