Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
eff7274
feat(titles): suggest titles for untitled entries from what they hold
nodemode-ai Nov 27, 2026
84a1073
feat(titles): serve untitled list, suggestions and lookup routes
nodemode-ai Nov 27, 2026
3dfab83
feat(import): turn keywords into tags when asked
nodemode-ai Nov 27, 2026
c9d4346
feat(import): take the keywords option on the import route
nodemode-ai Nov 27, 2026
ded61a1
feat(cli): add keywords as tags to import and a from-keywords verb
nodemode-ai Nov 27, 2026
45b3e86
feat(mcp): pass keywords as tags through the import tool
nodemode-ai Nov 27, 2026
7ee5ef4
fix(titles): drop citation keys that only repeat name and year
nodemode-ai Nov 27, 2026
ed353e3
feat(cli): add titles list, suggest and set verbs
nodemode-ai Nov 27, 2026
83fe635
feat(add): send the keywords choice with an import
nodemode-ai Nov 27, 2026
9c573b0
feat(add): add a turn keywords into tags box to the import tab
nodemode-ai Nov 27, 2026
0beef4d
feat(titles): add window calls and title queue for untitled entries
nodemode-ai Nov 27, 2026
961acaf
feat(titles): add the needs a title view with suggestion strip
nodemode-ai Nov 27, 2026
af5250b
feat(window): mount the needs a title view and link its stylesheet
nodemode-ai Nov 27, 2026
d2fd71b
docs(import): describe keywords as tags and the from-keywords verb
nodemode-ai Nov 27, 2026
99bd71c
docs(skill): teach the formcite skill keywords as tags
nodemode-ai Nov 27, 2026
0041101
docs(hashout): log keywords as tags on import
nodemode-ai Nov 27, 2026
58142c0
fix(dom): patchlist moves only nodes that change place
nodemode-ai Nov 27, 2026
f8f4874
fix(side): drop late tag reads and add a new tag row at the input
nodemode-ai Nov 27, 2026
b288b23
fix(titles): pin look it up to the strip end and close the toast on open
nodemode-ai Nov 27, 2026
f2dc732
docs(titles): describe untitled entries, suggestions and the view
nodemode-ai Nov 27, 2026
9048305
fix(titles): keep the empty view message after the last save
nodemode-ai Nov 27, 2026
d61dcb4
docs(hashout): log the titles service and view
nodemode-ai Nov 27, 2026
c58978d
docs(log): tag list faults and the patchlist change
nodemode-ai Nov 27, 2026
98efd35
fix(itemlist): re-read once for a large or first insert
nodemode-ai Nov 27, 2026
217f5ca
feat(cite): take keywords as tags on the service import
nodemode-ai Nov 27, 2026
112f4af
docs(hashout): log the large insert re-read
nodemode-ai Nov 27, 2026
1a00d74
chore(release): 0.10.0
nodemode-ai Nov 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .claude/skills/formcite/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Two ways, in this order of preference.
1. **The MCP server.** When the client lists a `formcite` server, use its tools. `./formcite agents install` registers it; it runs `./formcite mcp` on stdio and is read-only unless the person registered it with `--allow-write`. Its tools:
- Read-only, no network: `search` (`text`), `get_item` (`id`), `list_items` (`collection` or `tag`), `list_collections`, `list_tags`, `list_styles`, `cite`, `bibliography`, `format_document` (several citations in document order plus their bibliography).
- Read-only, reaches the network: `lookup_preview` (an identifier; shows the record and whether the library has it, adds nothing).
- Write, listed only when the person allowed writing (the server runs with `--allow-write`, or over HTTP the token may write): `add_item`, `add_by_identifier` (also reaches the network), `import_references` (`text` and `format`: bibtex, ris, csljson, formtxt), `tag_item`.
- Write, listed only when the person allowed writing (the server runs with `--allow-write`, or over HTTP the token may write): `add_item`, `add_by_identifier` (also reaches the network), `import_references` (`text` and `format`: bibtex, ris, csljson, formtxt; `keywords_as_tags` only when the person asked for keywords as tags), `tag_item`.
2. **The command line.** From the FormCite folder, `./formcite cli [group] ...` works on the current library without the engine. It prints JSON on stdout and one plain sentence on stderr. Run `./formcite cli [group] --help` before a verb you have not used in this conversation, because flags are not guessed.

If the MCP tool list has fewer tools than a task needs, use the command line for the rest. Do not call a tool name that the server did not list.
Expand All @@ -34,7 +34,8 @@ If the MCP tool list has fewer tools than a task needs, use the command line for
| Cite these in a style, make a bibliography | MCP `list_styles` then `cite`, `bibliography` or `format_document`; or `cli styles` then `cli format` | nothing, formatting changes nothing |
| Add this DOI, arXiv id, ISBN, PubMed ID | MCP `lookup_preview`, or `cli lookup` (both reach the network: ask first) | MCP `add_by_identifier`, or `cli add` |
| Identify this PDF | nothing reads it without the network | `cli identify` |
| Import this .bib, .ris or CSL-JSON file | `cli formats` | `cli import` |
| Import this .bib, .ris or CSL-JSON file | `cli formats` | `cli import` (add `--keywords-as-tags` only if the person wants keywords as tags) |
| Turn keywords of items already imported into tags | `cli tags from-keywords --dry-run` | `cli tags from-keywords` |
| Export as BibTeX, RIS or CSL-JSON | `cli export` prints to stdout | `cli export --out FILE` writes a file the person named |
| Duplicates | `cli duplicates` (find) | merging |
| Tag, collect, note | `cli tag`, `cli collection`, `cli note` listings | any change |
Expand Down
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# Changelog

## 0.10.0

### New
- Keywords can become tags. Tick "Turn keywords into tags" in the Add dialog's Import tab, or pass `--keywords-as-tags` to `./formcite cli import`. It is off unless you ask. The keywords also stay on the item as text, so an export is unchanged.
- For a library you already imported: `./formcite cli tags from-keywords`, with `--dry-run` to see the tags it would make first.
- "Needs a title": an imported entry with no title is no longer left blank and unnoticed. After an import a notice says how many need a title, and a new view lists them. For each you can type a title or pick one of up to five suggestions made from what the entry already holds (its journal and year, the first author, an attached file's name, the start of its abstract). "Look it up" asks the lookup service only when you press it, for entries with a DOI or ISBN.
- The same from the command line: `./formcite cli titles list`, `titles suggest ID` and `titles set ID "..."`.

### Fixed
- After a large import the list could stay empty and read "0 items" for many seconds on a slow connection. It asked the engine about every new entry one by one; more than twelve new entries, or an import into an empty library, now read the list once.
- A new tag typed in the item pane appears in the tag list at once, where it used to arrive late and push the rows under it down.

### Changed
- The tag list shows twelve rows and scrolls inside its own box.
- Lists move only the rows that are out of place when they update.

### Known issues
- The loss of keyboard focus after a tag rename, reported in 0.9.0, could not be reproduced in seventeen tries and its cause is still unknown. Two guards were added; it is not claimed fixed.
- A suggested title is a starting point, not a real title, when an entry holds only an author and a year. An entry with nothing at all gets no suggestions.
- "Look it up" was not run against a live service in this release, and a BibTeX `eprint` is not yet read as an arXiv id.
- An entry skipped as a duplicate on import is not tagged; run `tags from-keywords` for those.
- "Open in FormPDF" still opens the system viewer.
- The desktop app has not been built yet; the window runs in a browser against the engine.

## 0.9.0

A small release that closes what the library window had left open.
Expand Down
10 changes: 9 additions & 1 deletion backend/HASHOUT_LOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Living log of all comment content, explainers, rationale, TODOs, & removed (hashed-out) code for this side of the repo. Source files stay comment-free per dev-rules `sub-skills/hashout-log/SUB-SKILL.md`; everything they would have said lives here, indexed. This file is also the compressed contextual map of this side: read it first, then edit code surgically.

Current build version: v0.9.0
Current build version: v0.10.0
Last updated: 2026-11-27 (US Eastern) · the lean rows route for the window's list and opening an attachment

---
Expand Down Expand Up @@ -1669,3 +1669,11 @@ New in v0.9.0 (2026-11-27). `include_trashed=true` on the position route replace
## app/store/items.py {#app-items-title-required}

New in v0.9.0 (2026-11-27). `create` refuses a title that is empty or only white space with `Invalid("A title is required.")` (HTTP 422 through the routers, a line on stderr in the CLI) when no `batch_id` is given, which is every interactive path (`POST /api/library/items`, `item add`, the MCP add tool); `update` refuses it only when the item holds a non-blank title, so an old title-less item can still be edited in other fields. The model has no type that exempts a title (`title` is TEXT for ALL types in `record/fields.py`), so the rule covers every type, as the window already did. Import, lookup and identify pass a `batch_id` and keep their old behaviour: a BibTeX, RIS and CSL JSON entry with no title still imports with an empty title (checked: 2 of 2, 2 of 2 and 1 of 1 added, 0 failed). The twelve style regression cases pass.

## app/services/transfer.py, app/routers/transfer.py, app/cli_transfer.py, app/mcp/tools.py {#app-import-keywords-as-tags}

New in v0.10.0 (2026-11-27). `keywords_as_tags` (off by default) tags each item the import adds, inside that record's savepoint, through `tags.add`. `split_keywords` is the one splitter: commas, semicolons and newlines, white space collapsed, empties dropped, first spelling kept per `casefold`. The mappers already join (bibtex `", "`, RIS `KW` lines `", "`, ISBN `"; "`), so a keyword that itself holds a comma (an RIS `KW` of "Smith, J.") is split in two; that is the price of one splitter. `tags.name` is `UNIQUE COLLATE NOCASE` with no length limit, so `SELECT name FROM tags WHERE name = ?` already finds a case variant and nothing is ever cut (a 319-character keyword became a tag). Skipped duplicates are not tagged: skip means the existing item is not touched; `tags from-keywords` covers them. `tags_reused` counts distinct pre-existing tags applied. `tags from-keywords` is a new `tags` group in `cli_transfer.py` because the `tag` group lives in `cli.py`; its route is `POST /api/library/tags/from-keywords`. The window-key route in `routers/cite_write.py` (service import) does not take the option. Checked on a fresh data folder with 200 generated BibTeX entries (mixed case, repeats, both separators, one empty, one long): off 0 tags; on 49 created, 199 items tagged, 651 links, equal to a direct count; from-keywords dry run listed the same 49 tags and per-tag counts and changed nothing, the real run gave the same tag table as the on-import; RIS and CSL JSON exports of it imported with the option gave 49, 199 and 651 again; a second import with `--duplicates add` gave 0 created, 49 reused.

## app/services/titles.py, app/routers/titles.py, app/cli.py {#app-titles}

New in v0.10.0 (2026-11-27). "Untitled" is a live item whose `title`, trimmed of space, tab, CR and LF in SQL, is empty. Suggestions read only the item, its attachments and notes, never the network; order is short title, abstract first sentence, cleaned file name, event, series or book title differing from the container, container plus year, note first sentence, family plus year plus type, publisher plus type (no creator only), citation key. Near-duplicates compare `casefold` with every non-word character removed. A citation key equal to family plus year, or a placeholder such as `empty1`, `doi2017`, `filed2022`, `zz`, is dropped. Suggestions are cut at 90 characters on a word boundary. `title-lookup` resolves the first identifier in DOI, ISBN, arXiv, PMID order outside the library lock, so a slow service does not block the library; `NetworkOff` and `NetworkError` are `Invalid`, so they come back as 422 with the reason. `items.update` still accepts an empty title when the held title is empty, so `titles set` refuses an empty title itself and the window checks before it sends. The BibTeX importer does not map `eprint`/`archiveprefix` to an arXiv id, so an arXiv entry imported from BibTeX gets no Look it up. Checked with 12 untitled BibTeX entries on a fresh data folder: 0 to 4 suggestions each, 10 of 12 with at least one, the two with none hold only a year or nothing. The twelve style regression cases pass.
2 changes: 1 addition & 1 deletion backend/app/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.9.0"
__version__ = "0.10.0"
26 changes: 25 additions & 1 deletion backend/app/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,37 @@ def _search(sub) -> None:
p.set_defaults(run=lambda a: svc.search_text(" ".join(a.text), a.limit), say=lambda r, a: f"Found {_items_of(r)}.")


def _titles(sub) -> None:
titles = __import__("app.services.titles", fromlist=["suggest"])
group = sub.add_parser("titles", help="find entries without a title and give them one")
verbs = group.add_subparsers(dest="verb", required=True, metavar="VERB")
lst = verbs.add_parser("list", help="list live entries whose title is empty")
lst.add_argument("--limit", type=int, default=50, metavar="N")
lst.add_argument("--offset", type=int, default=0, metavar="N")
lst.set_defaults(run=lambda a: titles.untitled_list(a.limit, a.offset),
say=lambda r, a: f"{r['total']} entries need a title; showing {len(r['items'])}.")
sug = verbs.add_parser("suggest", help="suggest up to five titles from what the entry already holds")
sug.add_argument("item_id", metavar="ID")
sug.set_defaults(run=lambda a: titles.suggestions(a.item_id), say=lambda r, a: "\n".join(
[f"{len(r['suggestions'])} suggestions for {r['id']}"] + [f" {n}. {s['title']} ({s['reason']})" for n, s in enumerate(r["suggestions"], 1)]))
put = verbs.add_parser("set", help="give an entry its title")
put.add_argument("item_id", metavar="ID")
put.add_argument("title", metavar="TITLE")
def _set(a):
if not a.title.strip():
raise Invalid("A title is required")
return svc.item_edit(a.item_id, {"title": a.title.strip()})

put.set_defaults(run=_set, say=lambda r, a: f"Item {r['id']} is now titled {r['title']!r}.")


def parser() -> argparse.ArgumentParser:
top = argparse.ArgumentParser(
prog=PROG,
description="Work on the current FormCite library without the engine. Prints JSON on stdout and a sentence on stderr.",
)
sub = top.add_subparsers(dest="group", required=True, metavar="GROUP")
for build in (_library, _item, _collection, _tag, _note, _search, cli_duplicates.register):
for build in (_library, _item, _collection, _tag, _note, _search, _titles, cli_duplicates.register):
build(sub)
__import__("app.cli_format", fromlist=["register"]).register(sub)
__import__("app.cli_transfer", fromlist=["register"]).register(sub)
Expand Down
25 changes: 23 additions & 2 deletions backend/app/cli_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,24 @@ def _from_caller(path: str) -> str:
return str(Path(os.environ.get(CALLER_ENV) or os.getcwd()) / Path(path).expanduser())


def _tag_counts(result: dict) -> str:
return (f"{result['tags_created']} tags created, {result['tags_reused']} reused, "
f"{result['items_tagged']} items tagged")


def _imported(result: dict, args) -> str:
return (
said = (
f"Imported {len(result['added'])} items from {Path(args.file).name} as {result['format']} "
f"(batch {result['batch_id']}); skipped {len(result['skipped'])} duplicates, {len(result['failed'])} failed."
)
return f"{said} Keywords as tags: {_tag_counts(result)}." if result.get("keywords_as_tags") else said


def _from_keywords_said(result: dict, args) -> str:
if result["dry_run"]:
return (f"Dry run over {result['items_checked']} items: would make {result['tags_created']} new tags, "
f"reuse {result['tags_reused']}, tag {result['items_tagged']} items. Nothing changed.")
return f"Checked {result['items_checked']} items: {_tag_counts(result)}."


def _export(args) -> dict:
Expand All @@ -43,10 +56,18 @@ def register(sub) -> None:
imp.add_argument("file")
imp.add_argument("--format", metavar="NAME", help="format name (default: detect from the file)")
imp.add_argument("--duplicates", choices=ON_DUPLICATE, default="skip", help="skip (default) or add items already in the library")
imp.add_argument("--keywords-as-tags", action="store_true",
help="also add each entry's keywords as tags on the new item (off by default)")
imp.set_defaults(
run=lambda a: svc.run_import_file(_from_caller(a.file), a.format, a.duplicates),
run=lambda a: svc.run_import_file(_from_caller(a.file), a.format, a.duplicates, a.keywords_as_tags),
say=_imported,
)
group = sub.add_parser("tags", help="convert keywords of items already in the library into tags")
verbs = group.add_subparsers(dest="verb", required=True, metavar="VERB")
fk = verbs.add_parser("from-keywords", help="add each item's keywords as tags")
fk.add_argument("--collection", metavar="ID", help="only items in this collection")
fk.add_argument("--dry-run", action="store_true", help="list the tags it would make with counts; change nothing")
fk.set_defaults(run=lambda a: svc.run_tags_from_keywords(a.collection, a.dry_run), say=_from_keywords_said)
exp = sub.add_parser("export", help="export items as BibTeX, RIS or CSL-JSON (default: the whole library as BibTeX)")
exp.add_argument("--format", metavar="NAME", default="bibtex")
exp.add_argument("--ids", nargs="+", metavar="ID")
Expand Down
9 changes: 7 additions & 2 deletions backend/app/mcp/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,13 @@ def _add_by_identifier(args: dict) -> tuple[str, dict]:


def _import_references(args: dict) -> tuple[str, dict]:
out = transfer.run_import_text(args["text"], args["format"], args.get("on_duplicate") or "skip")
out = transfer.run_import_text(args["text"], args["format"], args.get("on_duplicate") or "skip",
bool(args.get("keywords_as_tags")))
counts = {k: len(v) if isinstance(v, list) else v for k, v in out.items() if k in ("added", "skipped", "failed")}
return f"Imported from {out['format']}: added {counts['added']}, skipped {counts['skipped']}, failed {counts['failed']}.", out
said = f"Imported from {out['format']}: added {counts['added']}, skipped {counts['skipped']}, failed {counts['failed']}."
if out["keywords_as_tags"]:
said += f" Tags: {out['tags_created']} created, {out['tags_reused']} reused, {out['items_tagged']} items tagged."
return said, out


def _tag_item(args: dict) -> tuple[str, dict]:
Expand Down Expand Up @@ -234,6 +238,7 @@ def _tag_item(args: dict) -> tuple[str, dict]:
"text": {"type": "string", "description": "The references, as text."},
"format": {"type": "string", "enum": ["bibtex", "ris", "csljson", "formtxt"], "description": "The format of the text."},
"on_duplicate": ON_DUPLICATE,
"keywords_as_tags": {"type": "boolean", "description": "Also add each entry's keywords as tags on the new item. Off unless the person asks."},
}, ("text", "format")),
"read_only": False,
"run": _import_references,
Expand Down
3 changes: 2 additions & 1 deletion backend/app/routers/cite_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,13 @@ class ImportBody(BaseModel):
text: str
format: str
on_duplicate: str = "skip"
keywords_as_tags: bool = False


@router.post("/import", status_code=201)
def import_records(body: ImportBody, caller: Caller = Depends(writer)) -> dict:
return _write(caller, "POST /api/cite/v1/import", lambda r: (list(r["added"]), []),
transfer.run_import_text, body.text, body.format, body.on_duplicate)
transfer.run_import_text, body.text, body.format, body.on_duplicate, body.keywords_as_tags)


class TagNames(BaseModel):
Expand Down
1 change: 1 addition & 0 deletions backend/app/routers/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ def mount(app: FastAPI) -> None:
register("cite_write", __import__("app.routers.cite_write", fromlist=["router"]).router)
register("window", __import__("app.routers.window", fromlist=["router"]).router)
register("upload", __import__("app.routers.upload", fromlist=["router"]).router)
register("titles", __import__("app.routers.titles", fromlist=["router"]).router)
22 changes: 22 additions & 0 deletions backend/app/routers/titles.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from fastapi import APIRouter, Query

from app.routers.library import _run
from app.services import titles as svc

GROUP = "titles"
router = APIRouter(prefix="/library", tags=[GROUP])


@router.get("/untitled")
def untitled_list(limit: int = Query(50, ge=1, le=500), offset: int = Query(0, ge=0)) -> dict:
return _run(svc.untitled_list, limit, offset)


@router.get("/items/{item_id}/title-suggestions")
def title_suggestions(item_id: str) -> dict:
return _run(svc.suggestions, item_id)


@router.post("/items/{item_id}/title-lookup")
def title_lookup(item_id: str) -> dict:
return _run(svc.look_up, item_id)
15 changes: 13 additions & 2 deletions backend/app/routers/transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,31 @@ class ImportBody(BaseModel):
path: str | None = None
format: str | None = None
on_duplicate: str = "skip"
keywords_as_tags: bool = False


class FromKeywordsBody(BaseModel):
collection: str | None = None
dry_run: bool = False


@router.post("/import", status_code=201)
def import_records(body: ImportBody) -> dict:
if (body.text is None) == (body.path is None):
raise HTTPException(422, "give either text or path")
if body.path is not None:
return _run(svc.run_import_file, body.path, body.format, body.on_duplicate)
return _run(svc.run_import_file, body.path, body.format, body.on_duplicate, body.keywords_as_tags)
if not body.format:
found = svc.formats.sniff(body.text)
if found is None:
raise HTTPException(422, "cannot tell the format of the text; pass format")
body.format = found
return _run(svc.run_import_text, body.text, body.format, body.on_duplicate)
return _run(svc.run_import_text, body.text, body.format, body.on_duplicate, body.keywords_as_tags)


@router.post("/tags/from-keywords")
def tags_from_keywords(body: FromKeywordsBody) -> dict:
return _run(svc.run_tags_from_keywords, body.collection, body.dry_run)


@router.get("/export")
Expand Down
Loading
Loading