# Citizen AI (cf.cplace.lowcode.ai)

## Overview

Citizen AI provides AI-powered chat and page-assistant widgets for cplace pages. It lets users have
conversational, context-aware interactions with an AI assistant — asking questions about the current page, exploring
relationships and attached files, and (via the scripted Chat Widget) performing configured read/write actions. The
app supplies the platform AI infrastructure (model connections, memory persistence, tool execution) that these
widgets build on.

**Plugin:** `cf.cplace.citizenAi`

**Repository:** `cplace-citizen-ai`

## Dependencies

- `cf.cplace.platform` (cplace Basis) — always pre-installed

> Dependencies were not confirmed via a live workspace investigation; only the always-present platform base is listed.

## Types Provided

Not observed. This README was authored from existing in-repo widget specifications without a live-workspace
investigation, so no type definitions were confirmed for this app. Citizen AI is used primarily through the widgets
listed below. Run the standard investigation (see `INVESTIGATION-PROMPT.md`) to populate types if needed.

## Widgets Provided

| Widget | Widget Kind | Description | Use Case |
|--------|-------------|-------------|----------|
| Ask Your Page | `cf.cplace.citizenAi.askYourPageWidget` | Zero-configuration, read-only AI assistant that understands the current page's attributes, relationships, and attached files and answers natural-language questions with links to related pages. Maintains per-user conversation history per page. | Exploring information-rich or highly-connected pages; documentation and knowledge Q&A; relationship navigation. |
| Citizen AI Streaming Chat | *(widget kind not documented)* | The recommended AI chat widget for new use cases; replacement for the deprecated Chat Widget. Detail is not yet documented in this repo (no widget specification available). | New AI chat use cases — use in place of the deprecated Chat Widget. |
| Chat Widget (deprecated) | `cf.cplace.lowcode.ai.chatWidget` | **Deprecated** — use Citizen AI Streaming Chat instead. A script-based (CplaceJS `checkAccess()` / `call()`) chat interface supporting custom data sources, custom tools, configurable memory, and shared or per-user history. Will be removed in a future version. | Legacy custom AI assistants; new work should use Citizen AI Streaming Chat. |

## Use Cases

- **Page exploration and discovery** — let users ask "what is this page about?", "what files are attached?", or
  "when was this last modified?" via the Ask Your Page widget.
- **Relationship navigation** — answer "which pages reference this one?" or "what tasks are linked to this
  milestone?" without leaving the page.
- **Custom AI assistants** — build page-specific assistants with scripted behavior, custom tools, and configurable
  data sources (Streaming Chat for new work; the deprecated Chat Widget for existing configurations).
- **AI-assisted page operations** — via the scripted Chat Widget, perform configured read/write actions on pages.

## Usage Notes

- **Prefer Citizen AI Streaming Chat for new chat use cases.** The Chat Widget (`cf.cplace.lowcode.ai.chatWidget`)
  is deprecated and will be removed; do not build new configurations on it.
- **Ask Your Page is read-only and zero-config.** It requires no Low-Code scripting but only works within a page
  context; embedded outside a page it falls back to read-only/no-context. For AI-driven writes, use a scripted chat
  widget with custom tools.
- **Permissions:** embedding the widgets requires Low-Code permission; once embedded, any user with page-view access
  can use them. Widgets only work where the Citizen AI app is present in the space.
- **Memory:** conversation history is persisted (per-user by default) and bounded by a configurable message limit
  (Ask Your Page default 30), with oldest messages evicted first.

## Investigation Details

- **Source:** Authored from in-repo widget specifications
  (`src/plugins/core/widget-specifications/cf.cplace.lowcode.ai.chatWidget/`,
  `.../cf.cplace.citizenAi.askYourPageWidget/`) and `_catalog-data.json`.
- **Live workspace investigation:** Not run. Types were not observed; the "Citizen AI Streaming Chat" widget has no
  widget specification in the repo yet and is documented by name/role only.
