AI-Powered-Documentation-Workspace
Mission (canonical, v1.3.0 — project-final polish). The whole application is an AI-powered professional documentation workspace. Its main purpose is to help users create, organize, improve, rewrite, summarize, publish, and maintain professional documentation with the help of ChatGPT / AI. Think of it as a modern AI-powered documentation platform with productivity quality on par with the best in the category — built as an original high-end product. This mission block is verbatim canonical and must be mirrored at the top of docs/PRODUCT_OVERVIEW.md, CLAUDE.md, and .claude/RULES.md. AI is the core surface of this product, not a side feature: every page, block, comment, database row, file and template participates in the AI + RAG loop.
Integrated STV sub-pack (v1.3.0, project-final). This pack is physically nested as a sub-page of the parent master hub AI Coding Agent Workspace — Spec Pack (SPEC-HUB v1.4.0+). The project ships two product lines under one master hub with one §SoT system, one Spec Registry, one CHANGELOG_AI, one reviewer pool. The two product lines remain conceptually distinct (AI Coding Agent platform vs. AI-Powered Documentation Workspace — different end users, different domain objects, different sync target trees) so contributors keep mental clarity, but governance is unified. See §9 of the parent hub for the integrated product-line identity matrix, the cross-pollination path, and §10 of the parent hub for the production-ready Claude Code build prompt that drives both product lines.
This is the master specification pack for the AI-Powered Professional Documentation Workspace (internal codename: StevoApp) — a scalable, AI-first professional documentation platform. It is the single source of truth for product, architecture, database, editor system, AI/RAG, search, mobile/desktop UX, sharing/permissions, version history, files, import/export, activity log, admin, scalability, API and security. Every sub-page mirrors 1:1 into a docs/ folder in the codebase. The pack is governed by the §SoT system of the parent project (which also hosts it as a sub-pack) — every page is a versioned spec with owner, authority, sync targets, conflict rule and change policy.
Forbidden in StevoApp. Business logic in frontend · AI provider keys in frontend or in .env exposed to client · controllers over 200 LOC · unsigned URLs for private files · SELECT * on hot paths · loading the full workspace tree without pagination or lazy expand · storing a full duplicate page snapshot per edit (use event-based versioning or smart diffs) · raw HTML from the editor without sanitization · file uploads without MIME + size validation · public share links without a tokenized URL · using Notion's branding, logo, exact UI, proprietary design, colors, design tokens, icon set, or any copyrighted elements · directly calling OpenAI / Anthropic from JavaScript or Swift · putting Filament in the end-user surface · using PHP-FPM, Nginx default config, or PostgreSQL-as-default (MySQL/MariaDB is the SQL source of truth).
Posture. Desktop-optimized, mobile-responsive from day one. Native iPhone app is post-v1; mobile web must be excellent before any native client ships.
0 · Executive summary
This product is an AI-powered professional documentation workspace. Its purpose is to help users create, organize, improve, rewrite, summarize, publish, and maintain professional documentation with the help of ChatGPT / AI — a modern AI-first documentation platform with productivity quality on par with the best in the category, built as an original high-end product (no Notion branding, logo, exact UI, proprietary design, colors, or copyrighted elements). Users create workspaces, organize pages and subpages with unlimited nesting, edit with a block-based editor (28 block types), build flexible databases with table / board / list / gallery / calendar views, use a library of professional templates, run AI text transforms on selection, query a RAG knowledge base scoped to their workspace, search globally with Cmd/Ctrl + K, share pages privately or via tokenized public link, and audit every important action. The product is desktop-optimized and mobile-responsive from v1 on a clean Laravel core with a thin Livewire UI. Filament powers admin only.
0.5 · Design principles & professional posture
Twelve principles, ordered. Each is a tie-breaker for design disagreements: when two implementation choices would both satisfy the spec, the higher-numbered principle wins. New contributors should read these once and refer back when a design call feels ambiguous.
- Documentation is the product. Every UX decision is evaluated by whether it makes a documentation-author faster, calmer, and more confident. Editor speed beats feature count. Latency budgets in §15 are non-negotiable.
- AI is a peer, not a side feature. Every text surface, every block, every cell, every comment participates in the AI + RAG loop. There is no "AI tab" — the AI lives inline, contextually, with citations.
- Preview before apply. AI never writes user content without an explicit human confirmation. This is non-negotiable across web, mobile-web, and the future native client. Auto-apply is a security and trust regression.
- Workspace-scoped everything. RAG never crosses workspace boundaries. Search never crosses workspace boundaries. Templates marked
globalare read-only and curated by admins. Cross-workspace leakage is a SEV-1 incident.
- Mobile-web before native. The mobile-web experience must be fluent before a SwiftUI app ships. No feature is "desktop-only" without an explicit
mobile_omittednote in the Registry row and a one-line justification.
- Lazy load by default. The page tree, the editor block list, the database row set, and the search result list all paginate. Loading a workspace must not load a workspace. Cursor pagination on every hot list.
- Original product, original UI. No Notion branding, logo, exact UI, design tokens, icon set, or proprietary patterns. Inspiration is fine; pixel imitation is forbidden. The CI lint
ui-originality-checkkeeps a regex denylist of visual tells (specific class names, exact hex colors, exact iconography).
- One brain, two surfaces. The Laravel API is the single backend; the web client and the future SwiftUI client are both consumers. Domain logic never lives in either client. The parity test asserts this.
- Event-based history wins over snapshots. Page versions are diffs, not full payloads. Restore is a deterministic replay. Storage cost is bounded by edit count, not page size.
- Sanitization at the edge. All user-provided HTML, Markdown, and AI output passes through
SanitizerServicebefore persistence. There are no "trusted blocks" — even server-generated content is sanitized on write.
- Idempotent jobs. Every queued operation (RAG reindex, export, file commit, AI transform persistence) is keyed by a content hash and is safe to retry. Failed jobs auto-retry with capped exponential backoff; the cap is documented in §15.
- Audit everything mutable. Every state change writes one row to
activity_logs. The audit log is append-only, includes actor + IP + user-agent, and ships with the export bundle. No silent state changes.
1 · Product vision
A documentation operating system powered by AI, not a simple editor. The seven canonical verbs are first-class capabilities, each backed by concrete services in this pack:
| Verb | Where it lives |
|---|---|
| Create | Block-based editor (SPEC-STV-04), templates (SPEC-STV-06), AI generate (SPEC-STV-08 §2 generate_*). |
| Organize | Workspaces, page tree, databases + views (SPEC-STV-05), tags, favorites, search (SPEC-STV-09). |
| Improve | AI selection actions improve, expand, make_professional, make_longer (SPEC-STV-08 §2); mobile select-to-edit (SPEC-STV-13 §6). |
| Rewrite | AI rewrite, simplify, make_shorter, translate (SPEC-STV-08 §2); preview gate is mandatory (SPEC-STV-08 §3). |
| Summarize | AI summarize, generate_meeting_summary, generate_outline (SPEC-STV-08 §2); RAG-cited (SPEC-STV-07). |
| Publish | Per-user shares, workspace visibility, tokenized public links with password + expiry, premium mobile public-page reader (SPEC-STV-11 §2–4, SPEC-STV-13 §11). |
| Maintain | Event-based version history + restore (SPEC-STV-04 §8), RAG re-index pipeline (SPEC-STV-07 §6), activity log (SPEC-STV-12 §2), CHANGELOG_AI (SPEC-STV-12 §7), import/export (SPEC-STV-12 §3–4). |
Every document, page, block, database row, file, comment, version, AI transformation, share link and permission is modeled cleanly and scalably. The architecture supports:
- single-user → small team → large team scaling without rewrite,
- desktop web, tablet, mobile web, and a future SwiftUI client,
- workspace-scoped AI with RAG that cites internal pages,
- a templating system covering SOPs, product specs, API docs, wikis, roadmaps, meeting notes, knowledge bases.
2 · Architecture overview
flowchart LR
Web(["Web client<br>Livewire 3 + Alpine + Tailwind"]) -->|HTTPS + Reverb WS| API["Laravel API + Web"]
Mob(["Mobile web / future SwiftUI"]) -->|HTTPS + SSE| API
Adm(["Admin operator<br>Filament panel"]) -->|HTTPS| API
API --> Pages["PageService"]
API --> Blocks["BlockService"]
API --> DBs["DatabaseService"]
API --> Search["SearchService"]
API --> AI["AiTransformService"]
API --> RAG["RagService"]
API --> Share["ShareService"]
API --> Files["FileService"]
API --> Activity["ActivityLogService"]
AI --> Providers{"Provider"}
Providers -->|OpenAI| OAI["OpenAI"]
Providers -->|Claude| CLA["Anthropic"]
RAG --> Index["RagIndexer<br>(queued)"]
Index --> Store[("rag_chunks<br>(MySQL JSON / pgvector opt-in)")]
Files --> S3[("S3-compatible storage")]
API --> Cache[("Redis<br>cache / locks / queues / Horizon / Reverb")]
API --> DB[("MySQL / MariaDB")]3 · Tech stack (locked)
| Layer | Choice | Why |
|---|---|---|
| Framework | Laravel 11 (12 when GA) | Mature HTTP / queue / auth / events. |
| SQL | MySQL 8 / MariaDB 11.4+ | Default; JSON columns for block content + cell values. |
| Cache / queues / locks / pub-sub | Redis 7 | Horizon, Reverb, atomic locks, cached permissions. |
| Job runner | Laravel Horizon | Observable workers for indexing, exports, AI. |
| Realtime | Laravel Reverb (WS) + SSE | WS for presence/autosave; SSE for AI token streaming. |
| Web UI | Livewire 3 + Alpine.js + Tailwind | SSR-first with reactive islands. |
| Admin | Filament v3 | Admin / control panel only. |
| API | REST + Sanctum tokens | Mobile + future SwiftUI. |
| Search | Laravel Scout + Meilisearch (v1); MySQL FULLTEXT fallback | Fast typo-tolerant search; pluggable later. |
| Storage | S3-compatible (AWS S3 / R2 / MinIO) | Signed URLs for private files. |
| AI | OpenAI + Anthropic via app/Services/Ai/* | Provider-agnostic; streaming where useful. |
| RAG | Embeddings in rag_chunks (MySQL JSON default; pgvector opt-in) | Workspace-scoped retrieval with citations. |
| Auth | Session (web) + Sanctum (API) | Mobile-friendly. |
4 · The 24 modules (canonical catalogue)
| # | Module | Owner spec | One-liner |
|---|---|---|---|
| 1 | Workspace System | SPEC-STV-01 | Workspaces, members, roles, settings, storage limits. |
| 2 | Page System | SPEC-STV-01 | Pages with unlimited nesting, icon, cover, status, favorites. |
| 3 | Block-Based Editor | SPEC-STV-04 | 28 block types, JSON content, nested blocks, indexed by (page_id, position). |
| 4 | Editor UX | SPEC-STV-04 | Slash menu, drag handle, floating toolbar, autosave, mobile/desktop modes. |
| 5 | Databases / Tables | SPEC-STV-05 | Properties, rows, cell values, views (table/board/list/gallery/calendar). |
| 6 | Templates | SPEC-STV-06 | Reusable, categorized, save-as / duplicate / preview. |
| 7 | AI Writing Assistant | SPEC-STV-08 | Select → ask → preview → replace / insert / copy / discard. |
| 8 | RAG Knowledge Base | SPEC-STV-07 | Workspace-scoped index, citations, incremental reindex, stale detection. |
| 9 | Search | SPEC-STV-09 | Cmd/Ctrl + K palette across pages/blocks/files/comments/databases. |
| 10 | Mobile + Desktop UX | SPEC-STV-10 | Sidebar/tree/editor/context on desktop; drawer + bottom-nav on mobile. |
| 11 | Sharing & Permissions | SPEC-STV-11 | Roles: owner / admin / editor / commenter / viewer. Tokenized public links. |
| 12 | Comments & Collaboration | SPEC-STV-12 | Page + block comments, mentions, resolve, activity feed. |
| 13 | Version History | SPEC-STV-04 | Event-based versioning + smart snapshots; restore, compare later. |
| 14 | File & Media Library | SPEC-STV-02 | Images, PDFs, videos (embed), signed URLs, usage tracking. |
| 15 | Import / Export | SPEC-STV-12 | Markdown / HTML in; Markdown / PDF / HTML / JSON out. Queued. |
| 16 | Activity & Audit Log | SPEC-STV-12 | Append-only activity_logs table, indexed by actor + entity. |
| 17 | Admin / Control Center | SPEC-STV-11 | Users, workspaces, plans, AI/RAG status, queue health, audit. |
| 18 | Scalability | SPEC-STV-11 | Lazy load, indexed hot paths, queued heavy ops, cached permissions. |
| 19 | Database Design | SPEC-STV-02 | 23 tables (see §5). |
| 20 | API Design | SPEC-STV-03 | REST + Sanctum, paginated, mobile-friendly. |
| 21 | Testing | SPEC-STV-12 | Pest feature + unit tests; policy & API contract. |
| 22 | Security | SPEC-STV-11 | Policies, signed URLs, sanitization, rate limit, secret hygiene. |
| 23 | Documentation | SPEC-STV-12 | 13 docs/*.md files + 6 .cursor/rules/*.mdc. |
| 24 | Acceptance Criteria | SPEC-STV-HUB | See §11 of this hub. |
5 · Database plan (23 tables, schema overview)
Every table: PK id (bigint unsigned), created_at / updated_at, soft-delete where relevant, FK with restrictOnDelete or cascadeOnDelete as noted. JSON columns are validated by service-layer schema. Hot-path indexes are listed inline.
| # | Table | Purpose | Key columns | Hot indexes |
|---|---|---|---|---|
| 1 | users | App users. | email (uniq), name, avatar_url, locale, last_seen_at | email |
| 2 | workspaces | Top-level container. | name, slug (uniq), icon, cover_url, owner_id, default_language, storage_limit_bytes, ai_settings JSON, rag_settings JSON | slug, owner_id |
| 3 | workspace_members | User ↔ workspace ↔ role. | workspace_id, user_id, role (owner|admin|editor|commenter|viewer), invited_at, joined_at | uniq (workspace_id, user_id) |
| 4 | pages | Page tree node. | workspace_id, parent_page_id (nullable), path (materialized), title, icon, cover_url, sort_position, visibility (private|workspace|shared|public), status (draft|live|archived), author_id, last_edited_by, favorite_for JSON, seo JSON, archived_at | (workspace_id, parent_page_id, sort_position), (workspace_id, status), (path) (prefix) |
| 5 | page_blocks | Block instances. | page_id, parent_block_id (nullable), type, content JSON, position (fractional or integer), metadata JSON, created_by, updated_by | (page_id, position), (parent_block_id, position), type |
| 6 | page_versions | Event-based version history. | page_id, version_number, author_id, op (title|block_add|block_update|block_delete|move|restore), payload JSON (compact diff), snapshot_hash, created_at | (page_id, version_number), (page_id, created_at) |
| 7 | documentation_databases | A database object (≠ MySQL database). | page_id (host), workspace_id, name, default_view_id | workspace_id, page_id |
| 8 | database_properties | Column schema for a database. | database_id, name, type (text|number|select|multi_select|date|checkbox|user|file|url|email|phone|status|relation|formula), config JSON, position | (database_id, position) |
| 9 | database_rows | Row in a database (≠ page_blocks). | database_id, position, created_by, archived_at | (database_id, position) |
| 10 | database_cell_values | Polymorphic cell storage. | row_id, property_id, value JSON, value_text (denormalized for search), value_number (denorm), value_date (denorm) | uniq (row_id, property_id), (property_id, value_text) |
| 11 | database_views | View configuration. | database_id, name, type (table|board|list|gallery|calendar|timeline), config JSON (filters, sort, group), sort_position | (database_id, sort_position) |
| 12 | comments | Page or block comments. | workspace_id, page_id, block_id (nullable), parent_comment_id (thread), author_id, body, body_html (sanitized), resolved_at, resolved_by | (page_id, created_at), (block_id), resolved_at |
| 13 | mentions | @user mentions inside comments / blocks. | workspace_id, source_type (comment|block), source_id, user_id, read_at | (user_id, read_at) |
| 14 | files | Uploaded file objects. | workspace_id, uploader_id, disk, path, mime, size_bytes, original_name, checksum, attached_count, deletable_at | workspace_id, checksum |
| 15 | templates | Reusable page or database templates. | workspace_id (nullable for global), category, name, description, payload JSON (page + blocks), preview_image_url, created_by | (workspace_id, category) |
| 16 | tags | Free-form tags. | workspace_id, name (uniq per workspace), color | uniq (workspace_id, name) |
| 17 | shares | Per-user share grants. | workspace_id, page_id, user_id, role, granted_by, granted_at | uniq (page_id, user_id) |
| 18 | share_links | Tokenized public links. | page_id, token (uniq), mode (view|comment), password_hash (null), expires_at, created_by | uniq token, (page_id) |
| 19 | permissions | Compiled effective permissions cache. | workspace_id, page_id, user_id, role_effective, source (workspace|share|link), computed_at | uniq (page_id, user_id) |
| 20 | activity_logs | Audit trail. | workspace_id, actor_id, entity_type, entity_id, action, payload JSON, ip, ua, created_at | (workspace_id, created_at), (actor_id, created_at), (entity_type, entity_id) |
| 21 | ai_text_transformations | Every AI run on selection. | workspace_id, user_id, action, model, input_text, output_text, applied (bool), tokens_in, tokens_out, cost_usd, created_at | (workspace_id, created_at), (user_id) |
| 22 | rag_chunks | Embedded chunks for RAG. | workspace_id, source_type (page|block|comment|file|template|db_row), source_id, chunk_index, text, embedding JSON, content_hash, indexed_at | (workspace_id), (source_type, source_id), content_hash |
| 23 | settings | Per-workspace and global config. | workspace_id (nullable for global), key, value JSON, updated_by | uniq (workspace_id, key) |
6 · API surface (REST + Sanctum)
All responses paginated (?per_page capped at 100). Cursor pagination on hot lists. Every endpoint goes through a Policy; never trust the client.
| Resource | Endpoints (sample) | Notes |
|---|---|---|
| Auth | POST /api/v1/auth/login, /logout, /me, /tokens | Sanctum personal access tokens. |
| Workspaces | GET/POST /api/v1/workspaces, GET/PATCH/DELETE /api/v1/workspaces/{id}, GET /members, POST /members | Owner-only destructive. |
| Pages | GET /api/v1/workspaces/{ws}/pages?parent=…, POST, PATCH /pages/{id}, POST /pages/{id}/archive, POST /pages/{id}/restore, POST /pages/{id}/move | Cursor-paginate children. |
| Blocks | GET /api/v1/pages/{id}/blocks?after=…, POST /blocks, PATCH /blocks/{id}, POST /blocks/{id}/move, DELETE /blocks/{id} | Bulk patch supported. |
| Databases | POST /api/v1/databases, GET /databases/{id}/rows?view=…, POST /databases/{id}/rows, PATCH /rows/{id}/cells, POST /databases/{id}/views | View config controls filter/sort/group server-side. |
| Templates | GET /api/v1/templates?category=…, POST /templates/{id}/instantiate, POST /pages/{id}/save_as_template | Global templates seeded. |
| Search | GET /api/v1/search?q=…&types=page,block,file,database&workspace=… | Meilisearch-backed. |
| Comments | GET /api/v1/pages/{id}/comments, POST /comments, POST /comments/{id}/resolve | Mentions broadcast a notification. |
| Files | POST /api/v1/files/presign, POST /files/commit, GET /files/{id}/signed-url | Direct-to-S3 upload, server commits metadata. |
| Sharing | POST /api/v1/pages/{id}/share-link, DELETE /share-links/{token}, GET /public/{token} | Public read endpoint rate-limited. |
| AI | POST /api/v1/ai/transform (SSE stream), POST /ai/generate | Selection-scoped, never auto-applies. |
| RAG | POST /api/v1/rag/query, POST /rag/reindex (admin), GET /rag/status | Answers cite source pages. |
| Activity | GET /api/v1/workspaces/{id}/activity?entity=… | Read-only. |
| Settings | GET /api/v1/workspaces/{id}/settings, PATCH /settings/{key} | Admin gated. |
7 · Implementation phases (P0 → P6)
| Phase | Goal | Scope (must-haves) | Out of scope |
|---|---|---|---|
| P0 | Foundation | users, workspaces, workspace_members, pages, page_blocks (paragraph + h1-h3 + bullet/numbered/checklist + divider), auth, autosave, mobile shell. | Templates, AI, RAG, databases, comments. |
| P1 | Full editor | All 28 block types (incl. callout, code, image, video embed, file, toggle, TOC, breadcrumb, link preview), slash menu, floating toolbar, drag handle, page_versions (event-based), mobile editor polish. | Synced blocks, database views inline, AI block. |
| P2 | Databases | documentation_databases, database_properties, database_rows, database_cell_values, database_views (table/board/list/gallery/calendar). Views surface as block types inside pages. | Formulas, relations, rollups, timeline. |
| P3 | Collaboration | comments, mentions, shares, share_links, permissions cache, activity_logs, Filament admin (users, workspaces, audit). | Realtime cursors, live presence. |
| P4 | AI + RAG | ai_text_transformations, AI selection editor (preview gate), rag_chunks, indexer queue, /api/v1/ai/* • /api/v1/rag/*, citations to source pages, ON/OFF per workspace. | Agents, runs, multi-step tool calls. |
| P5 | Templates + I/O | templates (global + workspace), import (MD/HTML/CSV → database), export (MD/PDF/HTML/JSON), file_versions queued. | DOCX, PDF text extraction. |
| P6 | Admin + scale | queue health, failed jobs panel, storage limits enforcement, public-page rate limit, permissions cache invalidation, Meilisearch tuning. | SwiftUI client (separate spec when ready). |
Policy: each phase ships its own migrations, services, Livewire components, Filament resources (if applicable), tests, and docs/ updates. No phase merges without green CI + a CHANGELOG_AI.md entry.
8 · Test plan
| Layer | Examples |
|---|---|
| Feature (HTTP + DB) | workspace create/invite, page CRUD, nested page move, block reorder, share link redeem, public page rate limit, AI transform happy + denial, RAG query returns citations, version restore. |
| Unit | BlockService position math, PermissionsResolver, SanitizerService, RagChunker, ExportRenderer. |
| Policy | viewer cannot edit, commenter cannot create block, IDOR across workspaces, archived page is read-only. |
| API contract | OpenAPI snapshot test; mobile-shape responses (pagination meta, ISO timestamps, signed URLs). |
| Browser (Dusk, optional) | slash menu opens, drag handle reorders, autosave indicator transitions, command-K search jumps to page. |
| Queue | RAG reindex idempotent on same content_hash; export job finishes; failed jobs retry capped. |
9 · Docs plan
13 mandatory docs/*.md files + 6 .cursor/rules/*.mdc. Each doc carries a SoT spec header (mirrored from its Notion page).
| # | File | Owner spec | Brief |
|---|---|---|---|
| 1 | docs/PRODUCT_OVERVIEW.md | SPEC-STV-00 | Vision, scope, non-goals, arch lock. |
| 2 | docs/ARCHITECTURE.md | SPEC-STV-01 | Modules, service map, diagrams. |
| 3 | docs/DATABASE_SCHEMA.md | SPEC-STV-02 | All 23 tables, columns, indexes, FK, JSON shapes. |
| 4 | docs/API_ENDPOINTS.md | SPEC-STV-03 | Every endpoint, auth, abilities, request/response. |
| 5 | docs/EDITOR_SYSTEM.md | SPEC-STV-04 | Block model, autosave, version history, UX rules. |
| 6 | docs/BLOCK_TYPES.md | SPEC-STV-04 | All 28 block types with content JSON shape. |
| 7 | docs/TEMPLATE_SYSTEM.md | SPEC-STV-06 | Template payload, categories, instantiate flow. |
| 8 | docs/RAG_SYSTEM.md | SPEC-STV-07 | Sources, chunking, embedding, retrieval, secret exclusion. |
| 9 | docs/AI_ASSISTANT.md | SPEC-STV-08 | Actions, prompts, preview gate, abilities. |
| 10 | docs/MOBILE_UX.md | SPEC-STV-10 | Responsive rules, mobile-only flows. |
| 11 | docs/SECURITY.md | SPEC-STV-11 | Threat model, policies, signed URLs, sanitization. |
| 12 | docs/SCALABILITY.md | SPEC-STV-11 | Pagination, caching, queues, indexes. |
| 13 | docs/CHANGELOG_AI.md | SPEC-STV-12 | Append-only log of AI-assisted changes. |
Cursor rules: .cursor/rules/project-overview.mdc, database.mdc, editor.mdc, security.mdc, rag.mdc, mobile.mdc.
10 · §SoT · STV sub-registry (mirrored into parent master §SoT.5)
This is the STV sub-registry of the parent project. The rows below are the canonical list for the STV product line and are pointed to from the parent master §SoT.5 (single source of truth: this section). Conflict ladder within STV: SPEC-STV-HUB > Architecture-tier (-01, -02) > Specification-tier (-03 … -11, -13) > Reference-tier (-12). Cross-product-line conflicts: parent SPEC-HUB v1.4.0+ wins (it defined the §SoT system).
| Spec ID | Title | Version | Status | Authority | Priority | Owner role | Primary sync targets |
|---|---|---|---|---|---|---|---|
| SPEC-STV-HUB | AI-Powered Professional Documentation Workspace — STV sub-pack root (this page, nested under parent SPEC-HUB) | 1.3.0 | Approved | Constitutional | P0 | Product architect | docs/PRODUCT_OVERVIEW.md lock block, docs/SPEC_REGISTRY.md |
| SPEC-STV-00 | Product Overview & Goals | 1.1.0 | Approved | Specification | P0 | Product architect | docs/PRODUCT_OVERVIEW.md |
| SPEC-STV-01 | Architecture & Modules | 1.0.0 | Approved | Architecture | P0 | Backend architect | docs/ARCHITECTURE.md, app/Services/** |
| SPEC-STV-02 | Database Schema | 1.0.0 | Approved | Architecture | P0 | Database architect | database/migrations/**, docs/DATABASE_SCHEMA.md |
| SPEC-STV-03 | API Endpoints | 1.0.0 | Approved | Specification | P0 | Backend architect | routes/api.php, app/Http/Controllers/Api/**, docs/API_ENDPOINTS.md |
| SPEC-STV-04 | Editor System & Block Types | 1.0.0 | Approved | Specification | P0 | Frontend lead | resources/js/editor/**, app/Services/Blocks/**, docs/EDITOR_SYSTEM.md, docs/BLOCK_TYPES.md |
| SPEC-STV-05 | Databases / Tables | 1.0.0 | Approved | Specification | P1 | Backend architect | app/Services/Databases/**, docs/DATABASE_SCHEMA.md (db tables section) |
| SPEC-STV-06 | Template System | 1.0.0 | Approved | Specification | P1 | Frontend lead | app/Services/Templates/**, docs/TEMPLATE_SYSTEM.md |
| SPEC-STV-07 | RAG Knowledge Base | 1.0.0 | Approved | Specification | P0 | RAG engineer | app/Services/Rag/**, docs/RAG_SYSTEM.md |
| SPEC-STV-08 | AI Writing Assistant | 1.0.0 | Approved | Specification | P0 | AI workflow lead | app/Services/Ai/**, resources/js/ai-selection/**, docs/AI_ASSISTANT.md |
| SPEC-STV-09 | Search | 1.0.0 | Approved | Specification | P1 | Backend architect | app/Services/Search/**, Meilisearch config |
| SPEC-STV-10 | Mobile & Desktop UX | 1.0.0 | Approved | Specification | P0 | Frontend lead | resources/views/**, resources/js/ui/**, docs/MOBILE_UX.md |
| SPEC-STV-11 | Sharing, Permissions, Security, Scalability, Admin | 1.0.0 | Approved | Specification | P0 | Security lead | app/Policies/**, app/Filament/**, docs/SECURITY.md, docs/SCALABILITY.md |
| SPEC-STV-12 | Comments, Activity Log, Import/Export, Testing, Docs, CHANGELOG | 1.0.0 | Approved | Reference | P1 | Docs lead | app/Services/Activity/**, docs/CHANGELOG_AI.md, .cursor/rules/** |
| SPEC-STV-13 | Mobile Gestures & Text Selection Editor | 1.0.0 | Approved | Specification | P0 | Frontend lead (mobile) | docs/MOBILE_GESTURES_AND_TEXT_SELECTION_EDITOR.md, resources/js/editor/mobile/**, resources/js/ai-selection/mobile/**, .cursor/rules/mobile.mdc |
11 · Acceptance criteria (project is shippable when)
- User can sign up, create a workspace, invite a member with a role.
- User can create pages and subpages with unlimited nesting.
- Block editor supports all 28 types; slash menu, drag handle, floating toolbar work on desktop and mobile.
- Autosave is visible and reliable; no edit is lost on tab close.
- Version history records every meaningful edit and supports restore.
- User can create a database, define properties, add rows, switch between table / board / list / gallery / calendar views, filter and sort server-side.
- Templates: instantiate from library; save page as template; preview before instantiate.
- AI selection editor: select text → ask → preview → replace / insert below / copy / discard. Never auto-applies. Rate-limited.
- RAG: workspace-scoped index runs in queue; AI Q&A cites internal pages; ON/OFF per workspace.
- Global search via
Cmd/Ctrl + K: pages, blocks, files, comments, databases, templates.
- Sharing: private / workspace / per-user / tokenized public link. View, comment, edit modes. Public pages rate-limited.
- Comments + mentions + activity feed work; admin sees full audit log.
- Mobile web is fluent: editor, search, share, AI, RAG all usable on phone.
- All 13
docs/*.mdmirror their Notion specs and passclaude-rules-lint+spec-registry-lint.
- Pest test suite green; API contract test green; policy tests green.
- No secret value reachable through any response, doc, or RAG chunk.
- UI is clean, modern, fast, and original (no Notion branding or copyrighted assets).
12 · Open questions (carry into next refactor pass)
- Self-host vs SaaS pricing model — affects storage limits + plans table shape (not in v1 schema).
- Realtime cursors (Yjs / Tiptap collab) — defer until P3 post-launch.
- pgvector opt-in or stay JSON-only for v1? Default: JSON; opt-in flag in
rag_settings.
- Meilisearch managed (cloud) vs self-host — both supported by Scout.
- Block-level encryption for sensitive workspaces — gated to enterprise tier.
- Native iPhone (SwiftUI) cut-in — only after mobile-web parity is signed off.
- AI provider default — OpenAI
gpt-4.1vs Claude3.7-sonnet; per-workspace setting.
- Public share password protection + expiration — design ready, ship in P5.
13 · Sub-pages (live, nested under this hub)
The 13 STV sub-specs are now physically nested under this hub so the tree reads master hub → STV-HUB → STV-XX cleanly. The canonical list is:
- SPEC-STV-00 · Product Overview & Goals — 🎯SPEC-STV-00-Product-Overview
- SPEC-STV-01 · Architecture & Modules — 🏗️SPEC-STV-01-Architecture
- SPEC-STV-03 · API Endpoints Reference — 🔌SPEC-STV-03-API-Endpoints
- SPEC-STV-04 · Editor System & 28 Block Types — ✏️SPEC-STV-04-Editor-System
- SPEC-STV-05 · Databases / Tables System — 📊SPEC-STV-05-Databases
- SPEC-STV-06 · Template System — 📐SPEC-STV-06-Template-System
- SPEC-STV-07 · RAG Knowledge Base — 🧠SPEC-STV-07-RAG-System
- SPEC-STV-08 · AI Writing Assistant — ✨SPEC-STV-08-AI-Assistant
- SPEC-STV-09 · Search — 🔍SPEC-STV-09-Search
- SPEC-STV-10 · Mobile & Desktop UX — 📱SPEC-STV-10-Mobile-UX
- SPEC-STV-11 · Sharing, Permissions, Security, Scalability, Admin — 🛡️SPEC-STV-11-Sharing-Security
- SPEC-STV-12 · Comments, Activity, Import/Export, Testing, Docs, CHANGELOG — 📚SPEC-STV-12-Comments-Activity
- SPEC-STV-13 · Mobile Gestures & Text Selection Editor — 👆SPEC-STV-13-Mobile-Gestures
14 · Cross-cutting non-functional requirements
The 24 modules of §4 each pass through these gates. Treat them as horizontal contracts: any module that fails one of these is not shippable, regardless of which phase landed it. A regression on any §14 gate opens a Hardening (P11) or Performance (P12) ticket in the same edit pass.
§14.1 · Accessibility (WCAG 2.2 AA target)
- Keyboard parity for every editor interaction (slash menu, drag handle, floating toolbar, version restore, slash actions, public reader navigation).
- Focus rings on every interactive element;
prefers-reduced-motionrespected on every animation.
- Color contrast ≥ 4.5:1 for body, ≥ 3:1 for large text; tested in light + dark themes.
- Screen-reader names for icons (
aria-labelor visually-hidden text); no icon-only buttons without labels.
- Skip-to-content links on every page; sensible heading order (no skipped levels) inside the editor.
§14.2 · Internationalization
- All UI strings flow through
__()(Laravel) or the JS equivalent; no hard-coded English in views or components.
- Date and number formatting via
IntlAPIs and LaravelformatLocalized(); nevertoLocaleString()without an explicit locale.
- RTL layout supported in the editor and the public reader (mirrored toolbars, mirrored drag handles, mirrored block menus, mirrored slash menu anchor).
- Content language is per-page (used by AI prompts and search analyzers); UI language is per-user (used by the chrome).
§14.3 · Observability
- Every queued job emits a start and end log line with
workspace_id,actor_id,entity_type,entity_id,duration_ms.
- Every AI call records
provider,model,tokens_in,tokens_out,cost_usdinai_text_transformations.
- Failed jobs panel in Filament admin; Sentry breadcrumbs scoped to
workspace_id(never user PII).
- Slow-query log on MySQL / MariaDB ≥ 200 ms; weekly review by Backend architect.
- A workspace-scoped
/admin/observabilitydashboard (Filament) surfaces queue depth, search latency, AI cost, RAG freshness.
§14.4 · Privacy & data handling
- PII columns explicitly listed in
docs/SECURITY.md; the export pipeline scrubs PII for public exports.
- RAG ingestion excludes any block whose ancestry contains a
private:truemarker; verified by an indexer test.
- Audit log retention: 365 days default, configurable per workspace.
- A user-initiated workspace deletion runs a queued, fully-audited purge job; tombstones land in
activity_logswith apurgeaction.
- All exports of personal content require a fresh password challenge; tokens minted for export are single-use and expire in 15 minutes.
15 · Performance budgets & SLOs
These are aspirational v1 budgets; tightening is a SPEC-STV-HUB minor bump. Failing any budget for two consecutive weeks opens a Hardening or Performance ticket against the offending module.
| Surface | Metric | Budget | Source of truth |
|---|---|---|---|
| Page load (first paint) | P75 over 7d | < 1.5 s desktop, < 2.5 s mobile-web | Web Vitals beacon → activity_logs |
| Block insert latency | P95 keystroke-to-render | < 50 ms | Editor instrumentation |
| Autosave round trip | P95 | < 350 ms LAN, < 800 ms mobile-web | Reverb ping/pong |
| AI selection round trip | P95 first token | < 1.2 s | ai_text_transformations.duration_ms |
| RAG query | P95 | < 600 ms at k=5 | RagService log |
| Search (Cmd/Ctrl + K) | P95 | < 250 ms typo-tolerant | Scout / Meilisearch log |
| Public page render | P95 | < 1.0 s cached | LSCache hit log |
| Queue worker depth | Steady-state | < 100 jobs per workspace | Horizon metrics |
| Storage per workspace | Default cap | 10 GB free tier; configurable per plan | workspaces.storage_limit_bytes |
| Error budget | 30-day | 0.5% non-2xx on /api/v1/** (excl. 401/403) | LSWS access log |
16 · STV-side glossary
| Term | Meaning |
|---|---|
| Workspace | Top-level container; one billing / storage unit; one tenant in v1. |
| Page | A document node in the tree; can host blocks and a database. |
| Block | The atomic editable unit. 28 types in v1. Stored as JSON in page_blocks. |
| Database (STV) | A schema'd collection of rows attached to a page; not a MySQL database. |
| View | A saved filter + sort + group configuration on a database (table / board / list / gallery / calendar). |
| Template | A reusable page-and-blocks payload; global or per-workspace. |
| Share | A per-user grant of a role on a single page. |
| Share link | A tokenized URL granting read or comment access without an account. |
| RAG chunk | An indexed, embedded fragment of workspace content. |
| AI transformation | One run of a selection-scoped AI action; logged in ai_text_transformations. |
| Preview gate | The mandatory accept / replace / insert / discard step before any AI edit lands. |
| Activity log | Append-only audit trail in activity_logs, indexed by actor + entity. |
| Public page | A page exposed via /public/{token}, rate-limited, optionally password-gated. |
| Premium reader | The mobile-first read-only renderer for public pages (SPEC-STV-13 §11). |
| Workspace member | A users row joined to a workspaces row via workspace_members. |
| Role | One of owner / admin / editor / commenter / viewer. |
Back to parent. AI Coding Agent Workspace — Spec Pack — master hub (SPEC-HUB v1.4.0+), §9 hosts the integrated product-line matrix and §10 hosts the production-ready Claude Code build prompt that drives both product lines including this STV sub-pack.