Skip to content

Accept notes from GAM and Video Creator as Markdown - #224

Merged
davior merged 1 commit into
mainfrom
claude/fervent-brahmagupta-ab6nks
Nov 6, 2026
Merged

davior merged 1 commit into
mainfrom
claude/fervent-brahmagupta-ab6nks

Conversation

@davior

@davior davior commented Nov 6, 2026

Copy link
Copy Markdown
Owner

What

POST /api/notes/from-markdown: a way for GAM's and Video Creator's assistants to file a note in Gecko Notes. The flow: the person asks one of those assistants for a note (e.g. "a summary of all the videos about dogs"), reviews the proposed note, and presses Apply. That app then sends the Markdown here with the person's own Bearer token.

Body: {title, markdown, folder_name?, tags?, source_app?: "gam" | "gvc"}. Everything a plain POST /api/notes leaves to the caller is decided here, so the other apps only ever send text:

  • Blocks: markdown_to_blocks, the converter the assistant's plans already use (headings, lists, tables, links, code).
  • Category: the default one.
  • Folder:
    • The app's own top-level folder ("From GAM", "From Video Creator"), made the first time it's needed. A folder the person names is used instead.
    • Matched case-insensitively, so no twin folders.
    • Never the Archive Bin, and never a dynamic (saved-search) folder.
  • Tag: gam or video-creator.
  • History: a first version is written, so the note has history from the start rather than only once someone opens it.

A blank title takes the first heading, else "Untitled". Empty text is refused (400 empty_note), and the Markdown is capped at 200 KB.

No change to auth: a Bearer token the other apps forward is verified by the existing middleware, as for any request.

Testing

  • backend/tests/test_notes_from_markdown.py (6 tests) runs against the real app and real auth middleware, with a token sent the way another app sends it. It checks:
    • blocks, links and a table come out right;
    • the default category and the app tag;
    • the folder is made once and reused whatever its case;
    • the Archive Bin and saved searches are skipped;
    • a named folder and the title fallback;
    • empty text, a missing token and an unknown app are refused;
    • the note belongs to the caller.
  • Full backend suite: 1435 passed.

Deployment

  • Deploy this before the GAM and Video Creator changes that call it. Until then, their Apply says Gecko Notes needs updating.
  • No migrations and no new settings. Backend only, but rebuild as usual:
git pull origin main
docker compose up --build -d

Generated by Claude Code

POST /api/notes/from-markdown takes {title, markdown, folder_name?, tags?,
source_app?} and handles everything a plain create leaves to the caller:
- converts the Markdown with markdown_to_blocks, the converter the
  assistant's plans already use;
- files the note under the default category;
- puts it in the app's own top-level folder ("From GAM", "From Video
  Creator"), or a named one. The folder is made the first time, matched
  case-insensitively, and is never the Archive Bin or a saved search;
- tags it with the app;
- writes a first version, so the note has a history from the start.

The sibling apps call it with the person's own Bearer token when the
person applies a note their assistant proposed, so they never need to know
BlockNote's format.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V1geD34N1XKXjKUUzmys6G
davior pushed a commit to davior/gam that referenced this pull request Nov 6, 2026
"A summary of all the videos about dogs in Gecko Notes" now ends in a note
proposal. The flow:
- The assistant searches, reads, and drafts the note in Markdown, linking
  each asset as [Name](/a/<id>).
- The person reads it on the card and applies it.
- Only then does GAM send it to Notes as them.

- propose_note (assistant/tools.py). It checks every linked id is the
  caller's asset; the same title again rewrites that note; at most 3 per
  turn.
- Apply writes it through app/notes_client.py to gecko-notes'
  POST /api/notes/from-markdown (davior/gecko-notes#224). Notes makes the
  blocks and the "From GAM" folder.
  - The caller's own token is forwarded. Only the Apply request has it; a
    turn runs as GAM.
  - Asset links are made absolute with the page's origin.
  - Notes being down, a JWT mismatch, an older Notes, or no token is a
    skipped item with a sentence; the rest of the proposal still applies.
- The Apply body takes note_refs. Results carry note_ref and note_url.
- The panel shows a "New note" row: its folder, how many assets it links,
  its text on request, and "Open in Gecko Notes" once made.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V1geD34N1XKXjKUUzmys6G
davior pushed a commit to davior/gvc that referenced this pull request Nov 6, 2026
Ask for the script, a shot list or research "in Gecko Notes" and the
assistant proposes a note: a title and the whole text in Markdown, with GAM
assets linked as [Name](/a/<id>). It shows as a card under the reply, with
the text to read and "Create in Gecko Notes" / Discard.

A note is not part of the video, so it never goes through the spec
proposal or the editor. It is made by its own button:
- as whoever presses it, with that request's token (the turn's is gone by
  then);
- through gecko-notes' POST /api/notes/from-markdown (davior/gecko-notes#224),
  which files it under "From Video Creator";
- marked created only once Notes says so, and refused a second time.

- propose_note (assistant/tools.py), offered only when the turn holds a
  token. The same title again rewrites that note; at most 3 per turn.
- AssistantTurn.proposed_notes (migration 7c3e1f9a5b24, nullable).
- NotesClient.create_from_markdown, plus
  POST /turns/{id}/notes/{ref}/create and .../discard. Links become
  absolute with GAM_BASE_URL, and an older Notes answers notes_outdated.
- NoteCard in the assistant panel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V1geD34N1XKXjKUUzmys6G
@davior
davior marked this pull request as ready for review November 6, 2026 09:56
@davior
davior merged commit c21254f into main Nov 6, 2026
2 checks 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.

2 participants