From 8d4404e4142f6d6194f8aa48dc2460bb2f182f3c Mon Sep 17 00:00:00 2001 From: Dasemu Date: Mon, 26 Oct 2026 03:39:33 +0100 Subject: [PATCH] docs: tags are names, one type per page, tag nodes in the graph Co-Authored-By: Claude Sonnet 5.5 --- docs/app.md | 26 ++++++++++++++------------ docs/architecture.md | 27 ++++++++++++++------------- 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/docs/app.md b/docs/app.md index 7a49cc8..0319075 100644 --- a/docs/app.md +++ b/docs/app.md @@ -117,16 +117,17 @@ Tokens: `paper surface ink muted faint line accent accent-soft ref done code-bg comments, selectors and unknown properties are ignored (unknown `--vars` are reported). ## Types and tags -- **Type** (what a note is): plain names, no page (persona, lugar, empresa, software, sueño, - concepto, idea, ...). "Type" under the header opens a picker with the types in use (with count) - and seeded suggestions, or type a new name. Stored in `Page.types`. -- **Tag** (a topic): a real page of kind `tag`. "Tag" opens a picker over the existing tag pages - or creates one by typing a new name (a note used as a tag becomes a tag page; hubs, journals - and templates cannot be tags). Tag chips open the tag page, which lists its tagged notes. - An inline `#tema` or `[[tema]]` in the text also links to the page. Renaming or deleting a tag - page updates its members. Tag pages cannot be tagged themselves. -- In the graph a tagged note points at its tag pages with a separate edge kind (TAGGED), apart - from page links and inline references. +Both are plain names with no page, shown as one row of pills under the title. +- **Type** (what a note is): at most one per page (persona, lugar, empresa, software, sueño, + concepto, idea, ...). The filled pill (or the ghost "Add type") opens a single-select picker + with the types in use (with count), seeded suggestions, a new name, or "Remove type". Stored + in `Page.types`; a type also counts as a tag of the same name. +- **Tags** (topics): many per page, always sorted alphabetically. "+ tag" opens a picker where + several can be added in a row; hovering a chip shows its ×. A chip opens the tag view: pages + with that tag or type, "Rename" (also renames types, merging duplicates) and "Remove from all + pages". An inline `#tema` in the text still links to a page of that name. +- In the graph every tag is a virtual node drawn as a hollow accent ring and linked to its + pages with a separate edge kind (TAGGED); tapping one opens its tag view. ## Hubs, namespaces and cleanup - **Hub** (folder icon): a page kind, not a note: no outline, a title, a short description @@ -172,13 +173,14 @@ One view (sidebar "Graph", Ctrl+Shift+G) with a mode selector: activation, edge thickness = Hebbian synapse weight, a pulse travels outward by hops. - **Clusters**: soft hulls grouped by "Hubs" (home hub, default when the graph has hubs; hull labelled with the hub title once it is wide enough on screen; layout-only springs pull - members to their hub), by "Tags" (each page goes to its most widely used tag page, ties + members to their hub), by "Tags" (each page goes to its most widely used tag, ties alphabetical; hull labelled with the tag name; springs pull pages to the best connected page of the tag; journals and untagged pages stay out) or by "Communities" (Louvain: groups found automatically from link density, no names). Colours follow group size. - **Tree**: hubs (root hubs, then members recursively, cycle-safe, each hub expanded once, folder glyph; membership = CONTAINS edges), namespaces (`a/b/c` titles, straight off the - centre), the notes in no hub (orphans included) and Tags (with their pages). Nothing is + centre), the notes in no hub (orphans included) and Tags (each tag node with its pages; + clicking a tag opens its tag view). Nothing is capped. Laid out by the same `ForceLayout` as the network (edges = parent/child, seeded from a radial layout). The centre carries the store name; every arm and sub-branch has its own colour (arms evenly spread over the hue circle, children split their parent's sector). diff --git a/docs/architecture.md b/docs/architecture.md index 15b9722..aacd07e 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -28,19 +28,20 @@ crates may add their own tables to the same database (prefix them: `search_*`, ` - **Assets**: metadata rows; bytes in the blob store. ## Tags and types (`synapse-core::{tags, types}`) -- **Tags are pages** of kind `tag` (topics such as "tecnología"). A page carries - `Page.tags: Vec` (tag page titles; `pages.tags`, schema v5, synced with the page, LWW - per page); the derived `page_tags(page_id, tag_key)` index is rewritten on every page write. - Setting a tag creates the tag page or converts a note to one; hubs, journals and templates - cannot be tags, and tag pages cannot be tagged. Renaming/deleting a tag page rewrites/removes - it in its members; opening the graph creates tag pages for tag names that lack one. - API: `set_page_tags`, `add_page_tag`, `remove_page_tag`, `pages_with_tag`, `tag_catalog`. - The graph has a `TAGGED` edge from each tagged page to its tag pages. -- **Types** are plain names saying what a page is: `Page.types` (`pages.types`, no page, no - index). API: `set_page_types`, `add_page_type`, `remove_page_type`, `type_catalog` (types in - use by count, then the seeded `SUGGESTED_TYPES`). -- Both are exported as `synapse-tags::` / `synapse-types::`, and tag pages as - `synapse-kind:: tag` (see `history.md`). +- **Tags are plain names**, never pages. A page carries `Page.tags: Vec` (`pages.tags`, + synced with the page, LWW per page), stored sorted case-insensitively by `title_key`. The + derived `page_tags(page_id, tag_key)` index covers the page's tags plus its type and is + rewritten on every page write. Journals and templates cannot be tagged. + API: `set_page_tags`, `add_page_tag`, `remove_page_tag`, `pages_with_tag`, `tag_catalog`, + `rename_tag` (tags and types, merging duplicates) and `remove_tag` (explicit tags only). +- **A page has at most one type** (`Page.types`, 0 or 1 entries; `Page::page_type()`), a name + saying what the page is. It implies a tag of the same name. API: `set_page_type(page, + Option<&str>)`, `type_catalog` (types in use by count, then the seeded `SUGGESTED_TYPES`). +- Schema v6 turned former tag pages (kind `tag`) into plain notes and trimmed multiple types to + the first; `PageKind` has no `Tag` any more and "tag" parses as a note. +- In the graph (`synapse-ffi`) every tag in use is a virtual node (`GraphNode.is_tag`, id + `tag:`, no page), with a `TAGGED` edge from each tagged page (type included). +- Exports use `synapse-tags::` and `synapse-type::` (see `history.md`). ## Hubs and namespaces (`synapse-core::structure`) Two orthogonal ways to organise pages.