Repository navigation
Desktop app
Generated from docs/desktop-app.md: edit it there, changes made in the wiki are replaced.
The Moki desktop app is a thin visual layer over the framework. It has no AI of its own: it shows the project files, lets the QA read and edit them, and opens the AI tool the QA already uses with the request ready. Skills, workflows and project context stay plain files that any AI tool can use without the app.
Each conversation has its own chat:<id> board key in Workspace, rendered by ChatView. The original chat key and its preferences remain compatible. The ribbon and Ctrl+L focus an open chat (Ctrl+L is left to a focused terminal); + › Chats creates another tab with its own draft through NewMenu. The chat header holds the model selector beside history, without a visible label. History opens the shared modal with a searchable conversation list, then focuses an existing tab for that conversation or opens one. Call… › In the chat uses chatRequest and the existing prepareLaunch validation, then sends it at once in a new tab, preserving other tabs and drafts.
chat.ts is tool-neutral, with one adapter per AI: Claude Code keeps one process per conversation with newline-delimited JSON on stdin/stdout; Codex (codex exec --json, exec resume <id>) runs one process per message, reads it from stdin and gets the project context with the first message of a new session, since it has no system-prompt file. Its MCP servers and plugin instructions are the same -c overrides its terminal gets. chat-conversations.ts owns live processes and tool progress, saves the question as soon as it is sent, and reports every change; chat-store.ts writes transcripts atomically under the active project's .chats/. Paths reject escaping symlinks and junctions. The context and MCP launch files of each start are written to the active workspace's temporary/ (out of the project tree) and deleted once the tool has read them. Changes reach the UI as qa:chat-changed notices (batched), with a 2-second safety refresh while an answer runs; a hidden tab does not stop the process. ELECTRON_RUN_AS_NODE is never passed to the real tool. Workspace changes and app shutdown close live conversations.
The optional model in each conversation is saved immediately when selected. chat-models.ts supplies Claude aliases and the active Codex profile's local models_cache.json, with default and custom identifiers available without a catalog. The service validates identifiers and refuses changes during an answer. Before the next message, a changed model restarts an idle Claude process with the saved session id; Codex already starts per message. The adapters pass --model or -m; older records without the field keep the tool's default configuration.
Claude artifact links in an answer (artifact-links.ts, the same rule in the window and the main process) open in artifact-viewer-host.ts: a separate WebContentsView over the chat tab with a persistent claude.ai session, no preload, Node access or Moki IPC, and only clipboard writing allowed. artifact-viewer.ts owns the allowed hosts (claude.ai and its sign-in), HTTPS checks and rectangle validation; other pages open in the browser. showArtifact validates the project and the link; the host clamps the view to the main window and hides it when the tab is hidden or a modal covers it. Downloads start in the project's inbox. UI checks use a local page in place of claude.ai and a script in place of Claude; they do not sign in or invoke billable AI services.
ai-accounts.ts lists the profile folders of each AI with a known mechanism: Claude Code (~/.claude, ~/.claude-<name>, e-mail from .claude.json, CLAUDE_CONFIG_DIR) and Codex (~/.codex, ~/.codex-<name>, e-mail from the id_token in auth.json, CODEX_HOME). The active account per AI and the hidden ones are kept in <data>/workspaces/ai-accounts.json (the first version's claude-profile.json is read once); the active one is set in the main process's environment (cleared for the default), which terminals, the external launcher, the chat and the plan usage inherit, so a choice applies to what starts afterwards; the plan usage cache is kept per account. Without a saved choice, the variable Moki started with stays; one outside the user folder is left as it is. Account ids are folder names checked per AI; a new one is made only from a slug; the account in use cannot be hidden. AiAccounts is the block per AI in Settings › My AIs and the quick switch in the status bar's Usage (for an AI with more than one visible account).
| Path | Role |
|---|---|
scripts/qa.ts |
The qa command: opens the app (default), the terminal menu (--terminal) or prepares a request directly (--project … --tool …) |
desktop/main.ts |
Electron main process: one window, one validated IPC channel, project folder watcher |
desktop/preload.ts |
Bridge exposed to the UI as window.qa (call, watch, onChanged, openLink, term) |
desktop/service.ts |
Everything the UI can ask for: projects, file tree, read/write files, activity state, inbox, agent library and agents per project, linked folder, installed skills and agents, launching AI tools. Validates every input |
desktop/skill-registry.ts |
Searches the public SkillMD registry (api.skillmd.com) and installs a skill bundle, checking every file's sha256 and writing only inside the chosen skills folder |
desktop/craft-download.ts |
Downloads an ArtCraft Launcher app (fixed list CRAFT_APPS in scripts/lib/core.ts) from its GitHub release and checks its SHA-256; it never installs or runs the file. The "+" menu › Download ArtCraft apps… opens the list |
desktop/editor-extension.ts |
Settings › My AIs: each AI tool's version (--version), the Moki extension installed in VS Code or Cursor (--list-extensions) and installing it (--install-extension) from release/moki-<version>.vsix in a checkout, or else from the Moki release of the app's version, only when GitHub vouches for its SHA-256 (releaseByTag, checksum and download of craft-download.ts). Commands come from TOOLS; arguments are fixed or a path Moki made |
desktop/claude-import.ts |
Reads an uploaded .claude folder, skills/ or agents/ folder, single skill or .zip of those and checks every item (valid name, SKILL.md and description, no secret, not a Moki name); limits 1000 files, 5 MB per file, 50 MB total; symbolic links are not followed; settings.json, hooks/, commands/, CLAUDE.md and .mcp.json are listed and never imported. Agents kept in subfolders of agents/ (at any depth) are read like loose ones, named by their file; the same name in two folders blocks the repeated one (duplicate) and offers the first by path; they always install flat (agents/<name>.md), and a README.md or a non-.md file there is listed by its full path as not imported. It writes nothing: claudeUploadPick / claudeUploadPreview in the service only read, claudeUploadApply writes after the user marks items and confirms (items already installed are never replaced; a linked folder's .claude is backed up first; a failure removes what was created) |
desktop/fs-guard.ts |
Path confinement (resolveInside), file type rules (editable, openable) and the size limits of what is previewed (PDF 30 MB, image 10 MB) |
desktop/html-preview.ts + desktop/preview-annotations.mjs
|
Capability URLs for local HTML and web assets, with script execution in an opaque sandbox. The injected preview helper exchanges selections and highlight anchors through bounded messages; it has no IPC or Node access |
desktop/html-comments.ts |
HTML passage comments in the project’s .moki-html-comments.json, separate from the page source; context anchors, missing-passage notices and rename handling |
scripts/lib/office-word.ts + scripts/lib/office-sheet.ts
|
Native Office styles, text/value edits and native comments; untouched package parts are preserved. XML/package limits, signed/protected-file checks and SHA-256 version checks protect writes |
desktop/office-convert.ts |
Legacy .doc/.xls conversion by installed Word/Excel or LibreOffice, into a new copy without overwriting the source |
desktop/file-protocol.ts |
The moki-file:// protocol: capability URLs for the PDFs and images the app shows, read by URL with Range instead of sent as bytes (see the security model). Pure of Electron; main.ts wires it |
desktop/pdfcraft.ts |
PDF comments and page edits through PdfCraft (pdfcraft-cli run --script): builds and checks the steps, runs them confined to the project folder |
desktop/launcher.ts |
Opens AI tools: terminal tools in a terminal tab of the app (or a new terminal window when node-pty is missing), editors with the request on the clipboard. Claude Code and Codex sessions get the app-only plugins in adapters/app-plugins/ (ponytail, rtk; caveman, codegraph and superpowers when the project turns them on (the Plugins section of the project panel, or Settings → Skills → Plugins)). With codegraph on, an AI terminal opened in the app (qa:term-new) goes through service.codegraphPrepare like any other launch: the linked folder is indexed once when the command exists, and a notice on how to install it is shown when it does not |
desktop/terminals.ts + app/src/components/TerminalView.tsx
|
Terminal tabs, as in Orca: a pseudo-terminal per tab (node-pty) in the main process, drawn with xterm.js. The "+" menu opens the user's shell or an AI tool (Claude Code, Codex, Gemini CLI, Antigravity CLI, Cursor Agent) in the framework root. The UI can only start commands the main process prepared, type into, resize and close them. Leaving the project does not stop a terminal: it keeps running in the main process, which keeps the end of its output (256 KB), and its tab comes back with that output when the project opens again. Closing its tab or quitting the app (also by a signal) stops it. When a terminal that ran a step of an operation ends, the main process tells the run, whatever is on screen |
desktop/usage.ts + desktop/proc-memory.ts + app/src/components/UsageStatus.tsx
|
The status bar numbers: plan usage of the AI tools, and the memory of Moki and of the terminals of each project. Memory is shown as PSS on Linux and as private bytes on Windows and RSS (working set) on macOS. RSS counts the memory that processes share (system libraries, Chromium's own code) once in every process that uses it, so adding the RSS of Moki's many processes counts that shared part several times. PSS splits a shared page among the processes that use it, so the sum is the memory they really take. On Linux the status bar button and the Resource Manager show PSS (read from /proc/<pid>/smaps_rollup, asynchronously, for Moki's processes and for every process of each terminal) and the Resource Manager also shows the RSS total; when the file cannot be read for a process (old kernel, another user, a process that just exited) that process counts with its RSS. qa:usage keeps app and bytes as the figure of the bar and adds appRss, rssBytes and kind (pss, private or rss). The process list is read at most every 2.5 seconds and the window polls every 5 s with the Resource Manager open, 30 s visible, 60 s hidden |
desktop/run-tool.ts |
Runs in the terminal tab or new window (Windows): reads the request from a UTF-8 JSON file and starts the tool |
scripts/lib/core.ts |
Shared core (also used by the terminal menu): projects, runs, skills, request building |
scripts/lib/agents.ts |
Agent model shared with the validator and the build: parsing, validation, listing, duplication, Claude Code subagents (agents.md) |
scripts/lib/docx.ts |
Word (.docx) to Markdown, so any AI can read stories written in Word |
scripts/lib/markdown.mjs |
Markdown to HTML (escapes all HTML from the document); also used for PDF reports |
app/ |
UI (React + TypeScript, built by Vite into app/dist/): start screen, Obsidian-like workspace, launch dialog, agent library |
app/src/components/ClaudeUpload.tsx |
The upload of skills, agents and activities (desktop/claude-import.ts reads a .claude folder, skills/, agents/ or activities/ folders, a single skill, a single agent or activity .md, or a .zip of those; dragged in through preload filePath and claudeUploadPath, or chosen). Grouped by kind (agents also by the subfolder they came from), each with "Select all" / "Clear selection" (blocked items are never marked); nothing is written before the user confirms. Scopes: a project, all projects, or bring from the project settings ("Bring to this project", shown as "All projects"): skills in the user folders linked to the project (linkedSkills), agents in Moki's format (libraryAgentText) and activities in the workspace library, the last two with no tag so they are for every project, recorded in library/uploads.json (scripts/lib/uploads.ts) as brought by that project: the workspace settings mark them (BroughtMark) and the project's panel lists the agents it brought. The project settings (scopes={['bring', 'project']}) and Settings › Skills with a project open also offer "This project only" (project): the project folder, or the linked folder's .claude after the "CHANGES" confirmation and a backup; no link, agent tag or record (an activity, which lives only in the workspace library, keeps the project's tag). onInstalled receives the scope used, so Set up project links only what bring installed. |
app/src/components/SkillsDialog.tsx |
"Skills & agents" (box in the ribbon): Find skills (SkillMD search by text or preset category, install for this project or for all projects), Upload (ClaudeUpload.tsx, also in Set up project and in Settings › Skills › Add a skill, which starts on all projects and with a project open also offers this project only; on the start screen without a project it is the only way to add and installs for all projects), Create agent (AgentForm.tsx: a Claude Code subagent closed to the installed skills it may use; project agents may also use the usable Moki skills), This repository (ProjectPanel.tsx) and Global (GlobalPanel.tsx) |
app/src/components/ProjectItems.tsx |
The "Skills and agents (N)" card of the project panel (SidePanel.tsx, between the assistant card and Executions; open while there is something to show; its list scrolls inside 168 px and the card never shrinks). Rows are split under "Skills (n)" and "Agents (n)" headings; a kind with nothing has no heading. They are: the project's own skills and agents, the global skills it links, and Moki's skills and agents set as defaults or reached through the project's tag. A row opens its file in the app when it is inside the project; ▶ sends the request (Workspace.tsx callItem); a non-missing row can also be dragged onto an AI terminal (see Skills and agents below). No linking or unlinking here: that stays in Project settings |
app/src/components/ProjectPanel.tsx |
"This repository" tab ("This project" without a linked folder): the skills and agents installed only for this project — <linked folder>/.claude/{skills,agents}, or workspace/projects/<id>/{skills,agents} — to remove. Requests opened from the project name them |
app/src/components/GlobalPanel.tsx + GlobalDialog.tsx
|
Skills (~/.claude/skills, ~/.agents/skills) and agents (~/.claude/agents) installed for all projects, to open or remove; a skill leaves every global folder. Shown in the Global tab and, without opening a project, from Skills & agents for all projects → Manage on the start screen |
app/src/components/SetupDialog.tsx |
"Project settings": opens from the project panel and the project folder's ⋯ menu (the tree lists no README.md or project.json), after creating a project or linking a folder, or to review a proposed plan. One framed section per kind: the name and description; the instructions at start; the agents (enabled, the star marks defaults); default and global skills; default activities and operations; plugins. setupProject in the service writes project.json (name, description, linkedSkills — names of skills installed in ~/.claude/skills or ~/.agents/skills, nothing copied — defaults and startInstructions); a default agent is enabled and a default global skill linked. The agents, the person's activities and the templates mirror the workspace settings through the project's own tag: projectLinks shows how each reaches the project (reachOf in scripts/lib/tags.mjs: every project, a shared tag — locked —, its own tag, or not), setProjectLinks adds or removes that tag (withProject) and picks the template in use; MCP servers are listed read-only. A new AI terminal of the project (qa:term-new) starts with startOf: one default activity without files is its own request; otherwise buildStartPrompt (scripts/lib/core.ts) names the agents, skills, activities and instructions and asks the AI to wait; plain opens it without them. Requests name each linked skill with its SKILL.md path; skills no longer installed are left out, and the Global tab shows which projects link each skill. "Find new skills" opens the registry search prefilled with the description. Optionally it then opens the "Prepare the project" activity (setup), where the AI proposes context changes in proposed-updates.md and waits for approval. The project panel shows the name and description read-only. |
app/src/components/AiToolsPage.tsx |
Settings › My AIs: the terminal and editor AI tools with path, version and the Moki extension, one row each: the main action as an icon, the others in its … menu; Make default (prefs.ts qa-tool, where the side panel, notes, the wizard, operations and skill forms start; choosing another AI there does not change it); Install a missing terminal AI through a terminal tab (run-tool.ts asks y first); Download a missing editor; Install the Moki extension and open. The tool catalog (ToolCatalog.tsx) sends an AI not found here to this tab |
flowchart LR
UI["UI (app/)<br/>React, sandboxed"] -->|"window.qa.call"| P["preload.ts"]
P -->|"IPC qa:call"| M["main.ts<br/>checks the caller"]
M --> S["service.ts<br/>validates inputs"]
S --> G["fs-guard.ts<br/>stays inside the project"]
S --> C["scripts/lib/core.ts"]
S --> L["launcher.ts"]
L -->|"terminal tab"| T["Claude Code, Codex,<br/>Gemini CLI, Antigravity CLI,<br/>Cursor Agent"]
G --> W["workspace/projects/ID"]
-
Renderer locked down:
contextIsolation,sandbox, no Node integration, strict Content-Security-Policy, no navigation, no new windows (web links go to the default browser), all permission requests denied. -
moki-file://protocol (desktop/file-protocol.ts, registered indesktop/main.ts): a PDF or image tab holds a URL, not its bytes.readFilethroughqa:call(which is trusted-caller only) returns, besidessizeandmtime,moki-file://<token>/: a random 192-bit token the main process maps to the fileresolveInsidealready confined to the project (or its linked folder). The protocol handler only gets the request, not the calling frame, so the token is the credential: it is given only to the window that asked, dies when that window closes, when the window opens another project, and (checked on every request) when the workspace or the project changes. It serves onlyGETandHEAD(405otherwise), only PDF and the image types, only up to the sizereadFileallows, withRange(206; a malformed or unsatisfiable range is416withContent-Range: bytes */size; several ranges in one header, or another unit, are ignored and the whole file is sent). The path after the token is ignored (it never selects a file), nothing is listed, and the real path is resolved again on every request: a file replaced by a symlink out of the project, removed, grown past the limit or no longer a file stops being served. Every failure (unknown, revoked or foreign token,.., denied type, missing file) is the same404, with the same headers and body. A window keeps at most 64 grants; the same file with the same size and modification time keeps its URL, and a changed file gets a new one. The content security policy allows only that scheme, not*:connect-src moki-file:,img-src 'self' data: moki-file:,frame-src blob: moki-file: moki-preview:. The scheme list inmain.ts(registerSchemesAsPrivileged) is one call, beforeready. -
HTML previews use
moki-preview://<192-bit-token>/<relative-path>for an HTML file and allowlisted web assets inside its project or linked folder. GET/HEAD only, 30 MB per asset, no hidden paths or directory listing, real-path checks on every request and the same window/project/workspace revocation as file grants. The iframe permits scripts and forms withoutallow-same-origin; its CSP permits local assets, modules and fetch, blocks external resources, nested frames and form submissions. Frame navigation outside local preview schemes is refused. Comments use a bounded selection/highlight message helper and a project-local metadata file; the source HTML is unchanged. - IDE extension shortcut is the cat icon immediately above New note in the fixed rail, on Home and in a project. The dialog names each editor once and uses a short Open button. It reuses the checksum-verified installer from My AIs only when the extension version differs, then opens the project’s linked folder or the framework root.
-
One IPC channel (
qa:call) that only accepts calls from the app's own page and only the service's method names. - Every input validated in the main process: project ids must exist; paths are resolved inside the project folder (symlinks included); activities, tools and languages come from fixed lists; inbox files must exist.
-
Agents: built-in agents are read-only; only the user's own agents (in
workspace/library/agents/) can be saved or deleted, always resolved inside that folder and validated before saving. A launch with an agent requires it to be usable and enabled in the project. -
Workspaces (
desktop/workspaces.ts,app/src/screens/WorkspacePicker.tsx): the app starts on a workspace picker, like Obsidian's vault switcher.<root>/workspaceis the default workspace; others are folders with the same layout, under<root>/workspaces/or chosen by the user, listed in<root>/workspaces/workspaces.json. Selecting one pointsworkspaceDir()(scripts/lib/repo.mjs) at it, and the app setsQA_WORKSPACEfor the tools and helper commands it starts. Requests from another workspace name its folder. The switcher stays at the bottom of the start-screen sidebar. Creating a workspace and opening a folder as one stay on the picker only while the built-in workspace is the only one; after another exists, those two actions are on Manage workspaces, and the picker keeps the list. -
Tags and search (
scripts/lib/core.ts,desktop/search.ts,app/src/components/TagPicker.tsx,SearchPanel.tsx): tags on projects (project.json) and files (<project>/tags.json) share context between projects of the workspace; the launch dialog's context step lists it and the service recomputes it before building the request. The magnifier on the icon rail (Ctrl+Shift+F) searches project names and text files, filtered by tags. -
My folder: "Choose my folder" (welcome screen, the link button in the ribbon) picks a folder in the native dialog. "Open a project" on the start screen does it before the project exists:
pickFolderreturns the project already linked to the chosen folder (it just opens) or the folder and a suggested name; the user names the project andcreateProject(starterminimal) links it. The UI only sends back the path of the folder last picked in the dialog; any other path is refused. "Open in Moki" on a folder (Windows Explorer, registered by the NSIS includedesktop/installer.nsh; Linux Open with,inode/directory) orMoki <folder>reaches the app as an argument:desktop/shell-folder.tstakes the folder,main.tskeeps it (a second launch sendsqa:open-folderto the window) and the UI takes it withopenedFolder, which gives the same answer aspickFolder(a linked folder opens its project, a new one opens the quick-project dialog filled in); the path never comes from the UI. In the tree the linked folder is the node@folder(live,TreeNode.linked= its path): every file call resolves@folder/…inside that folder (projectPath, confined byresolveInside), the main process watches it too (ignoringnode_modules,.gitand build folders), file tags stay for the project's own files, andopenInEditoropens it in an installed editor tool (VS Code, Cursor). Folders inside Moki and the user folder itself are refused. Linking marks that folder'srepositories[]entry inproject.jsonwithlinkedFolder: trueand copies its AI settings (.claude,.agents,.codex,.gemini,.cursor,CLAUDE.md,AGENTS.md,GEMINI.md, skippingnode_modulesand.claude/worktrees) to.moki-backup/link-<date>/inside that folder and, when the folder has a.gitdirectory, adds.moki-backup/to.git/info/exclude(local, unversioned); nothing else in the folder changes. Requests opened from the project name the linked folder. -
Installed skills and agents: names are only accepted from the service's own listings (
projectItems,globalItems); removing moves to the system trash (shell.trashItem). Linking authorizes nothing: every install, agent or removal in a linked folder's.claudeasks the user to confirm that action, backs up the current.claudetobackups/claude-<date>/first, and is always refused when itsrepositories[]entry sayswriteAllowed: false. Registry skills are third-party content: the install confirmation shows the registry audit and each file is checked against its sha256. -
Editing for existing
.mdand.txtfiles throughwriteFile; native.docxand.xlsxtext/value changes and comments througheditOffice, with a SHA-256 base version and an atomic replacement. Protected/signed packages are read only. Formula results are recalculated by the spreadsheet program on opening, not by Moki. Legacy.doc/.xlsconversion uses a temporary directory and creates a distinct.docx/.xlsxcopy with exclusive creation. Opening with the default program only for document and image types — never executables or scripts. Open with (the "…" next to it, Excel, Word and PDF files,desktop/open-with.ts): the programs come from the system (Linux: GIO; macOS: Launch Services; Windows: its own "Open with" dialog) and the one chosen must be among them when it is opened. "Always open … with the chosen program" is a preference of the app on this computer: Moki never changes the system's default program (the "Always" option of the Windows dialog is Windows' own). -
PDF comments and page edits (
desktop/pdfcraft.ts,app/src/components/PdfDoc.tsx): the app never writes PDF bytes itself; PdfCraft (pdfcraft-cli, on PATH or in its install folder: on Windows besidepdfcraft.exe, which its MSI leaves off PATH; on macOS the CLI is a separate download from the DMG, looked up in/opt/homebrew/bin,/usr/local/bin,~/.local/bin,~/bin) does, with a fixed set of operations (comments: highlight by text or by a selection's quads, reply, edit, delete; pages: rotate, delete, move one page, insert a blank page; title and author). Only.pdffiles inside the project,--rootset to the project folder, every change checked in the main process, the steps passed in a temporary file (mode 600) removed right after, never through a shell. Files ininbox/are never changed, and page edits (which have no undo once saved) never save over any file: the first such change saves<name>-edited.pdfbeside it, and later changes save that copy in place. Pages are drawn by pdf.js with its worker bundled into the page and started from ablob:URL (worker-src blob:); pdf.js reads the file from itsmoki-file://URL with Range requests and only the ranges the pages on screen need, so the bytes are neither sent over the IPC nor kept in the page; "Native viewer" switches back to Chromium's viewer, and the app falls back to it when pdf.js cannot open a file. -
Notes between PDF pages (
desktop/pdf-notes.ts,app/src/components/PdfDoc.tsx): the page toolbar adds a new note directly, and an existing note can be dragged between pages. Cards have editable titles, resizable height, selectable border colors, and the normal note editor with collapsible tools. The project-local.moki-pdf-notes.jsonstores links, page positions, card heights and border colors;.moki-note-titles.jsonstores display titles without renaming note files or breaking their links. These do not modify the PDF, and other PDF viewers do not show the notes. Page edits made in Moki carry the links to edited copies and update their positions; if a page is deleted, its notes follow the preceding surviving page (or the beginning). Changes made to the PDF outside Moki cannot be tracked. Loose notes remain on this computer, even if linked from a project. Removing a link does not delete the note. Concurrent note edits are checked before saving to prevent silent overwrites. - AI tools are started from the fixed tool list. User text only travels as the prompt: on Windows through a UTF-8 file (never through a batch file); on macOS/Linux as a single-quoted argument.
-
Call… uses
InvokeCatalog.tsxinsideLaunchDialog.tsx: one searchable list of activities, enabled agents, usable skills and operations, shared by the project panel and the running AI terminal. Ctrl+Shift+K (Cmd+Shift+K on macOS) opens it too. After choosing, the same files, shared context, agent and note form prepares the request. This terminal fixes the target at dialog opening and pastes without Enter or clearing the draft. The service shares request validation withlaunch;terminals.pasteRequestchecks the live process, tool metadata and owning project again, strips terminal controls and newlines, and writes plain input. Shells, editors, closed terminals and other projects are refused. Tracking stays prepared. New terminal keeps the existing tool launch. An operation always opens its own form because every step has a separate terminal; the list explains why. Optional plugins remain in the assistant card. -
Skills and agents in the project panel come from one list,
scripts/lib/project-items.ts(projectItems): skills installed only for the project, global skills it links (~/.claude/skills,~/.agents/skills) and Moki's ArtCraft skills, its defaults, and the agents installed for it or that Moki's library reaches it through its own tag or a shared tag, and those for every project (no tag) that this project brought (library/uploads.json); the other agents for every project are not listed. A link that is gone is listed as missing, without ▶. The same list feeds the start prompt of an AI opened in the project (buildStartPrompt,items: path and one-line description, cut at 140 characters; past 40 items only names) and the CLI'sdeliver. ▶ and Use in the terminal (the context menu of a Context or Notes file in the tree, and the button of an open note) send one short request built bybuildInvokePrompt: Use the<name>skill: read<path>and follow its procedure and approval gates, Act as the<name>agent: read<path>and follow it, or Read<paths>and use them as context for what I ask next. With an AI terminal in focus (the same one Call… uses) the service pastes it throughterminals.pasteRequest: plain input, never Enter, the draft kept. Dragging a skill or agent row onto the area of an AI terminal does the same for that terminal, in focus or not (Workspace.tsxpasteItem): the row carries{ project, kind, name }under the typeapplication/x-moki-item(app/src/item-drag.ts),TerminalViewaccepts it on its container only while the item being dragged is of its own project (a drag's data can only be read at the drop, so the item is kept fromdragstarttodragend), shows a veil over the terminal, and at the drop calls the sameinvokeItemwith that terminal's id; any other drag, including files from the computer, is left to the workspace's own drop. A terminal that is not an AI, not running or of another project is refused by the service with its message, and nothing is sent or opened. Without one,qa:term-newopens a new AI terminal (the AI picked in the card, else the default) with the request as its first prompt; the window sends only the target ({ kind, name }or{ kind: 'file', paths }) and the main process asksservice.invokePromptto write the text. The path of a skill or agent always comes from the project's list, never from the window; a file only fromcontext/ornotes/of the open project, existing, not hidden, of a text, Office or PDF type, and text files are read for the credential patterns ofscripts/lib/secret-patterns.mjs(more than 20 files, or one that looks like a secret, refuses the whole request). No shared context from tags and no run: those stay in Call…. Limit: the prompt gives pointers (path and, at the start, a line of description), and the AI decides whether to open the files; nothing here can make a tool read them. Nothing is written to the project's or the linked folder'sCLAUDE.md,AGENTS.mdor.claude. -
Activities in the project panel (
app/src/components/ActivitiesCard.tsx) lists the activities pinned to the project (project.jsonpinnedActivities, set with the 📌 of the Call picker throughsetActivityPin; distinct from the workspace's ⭐ favorites), then the runs under way, those waiting for the person first. Finished, cancelled and unreadable runs are not listed. Operations (OperationsPanel.tsx) is its own card below, with Under way and Finished. The file tree calls the existingruns/folder "Deliveries" and lists, straight under it, only the existing files each run'sartifactsname inside that run; run folders are not walked and nothing is moved. Opening the project with no activity (theopenrequest of the IDE panel's agent cards andqa --activity open; it is not offered as an activity), talking and resuming are not recorded as requests. Activity launch requests are kept in local UI preferences per workspace and project, distinct from actual runs. The request asks the AI to use a unique slug if it creates a run; only an exact matching run replaces the waiting request. If the tool merely prepares a prompt or the AI does not use that slug, the request remains separate: Moki never invents a run or its status. Removing a request from the list does not delete project files. -
Markdown is rendered with all HTML escaped (including attribute quotes); links are handled by the app, not followed by the page. A
mermaidorexcalidrawfence is drawn in the app after that (Mermaid withsecurityLevel: 'strict'and no HTML labels; Excalidraw only from a scene whosetypeisexcalidraw). The/menu inserts either fence, in the formatted editor and in the Markdown source. A drawing can be edited and is saved back into the same fence; Mermaid stays source. Formatted editing is a TipTap editor on the same Markdown file: headings, lists, task lists and images (paste or drop). A mermaid or excalidraw fence stays a card in that editor and is drawn there; saving writes the same fence back. In the plain source editor the same fence is one closed line (Drawing or Diagram): the text around it stays a normal field, the edit icon opens an Excalidraw scene that fills the window, and Code shows the fence when it is needed. A drawn diagram fits the width of its card, and the same zoom as a PDF (50% to 300%) applies to a drawing and to a Mermaid diagram. Exporting a note to PDF asks the same local Edge/Chrome/Chromium to draw each diagram and embeds one PNG of the whole drawing; a diagram that cannot be drawn stays as its code block. The installed framework carries the drawing bundle fromapp:build(scripts/lib/diagram-frame.iife.js, not versioned); a checkout without that file builds it with esbuild, and a PDF with no diagram never loads it. The page's content security policy is unchanged. Visual editing maps supported rendered text back to the original source, preserving unchanged spacing and line endings even when headings and lists are adjacent. A note's formatted view uses that same editor, so it can be typed in; a note whose formatting cannot round-trip stays as a reading view and asks for the source. On the start screen, Pinned, Projects, Favorites and Loose notes keep their headings in place, and each list scrolls on its own. A heading collapses its list; dragging the line between two open lists changes their height, and a double click on that line shares the height equally again. The choice is remembered on this computer. Unsupported formatting uses the source editor, and changes that would remove comment marks are refused with a notice. Comments and their optional palette colors are stored in an HTML comment block in the Markdown file, so other Markdown viewers hide them; older comments keep the theme color until changed. - Run details for an activity open in the main area, in the same place as an operation run, and the project panel stays on the right. The view shows status, the current step, completed steps, approvals and file paths, and can continue the activity in the AI tool. Opening an operation file still offers Open operation in the side panel; choosing an operation from Execuções opens its run in the main area.
-
Exporting a note (
exportNoteindesktop/service.ts, menu inapp/src/components/NoteDialog.tsx): through the sameqa:callchannel, with no new IPC. Onlynotes/<file>.mdof a listed project; the destination comes from a native save dialog opened by the main process (saveFileindesktop/main.ts), never from the page, so it is the one place the app writes outside the workspace, and only where the person chose. Markdown and text are written directly; the PDF runsscripts/pdf.mjs(shipped inframework/scripts) as a child process withexecFile(Electron as Node, no shell) in a temporary folder removed afterwards, with the project's document template as--style; with no Edge/Chrome/Chromium the error says so. Nothing is written intonotes/. -
Downloading ArtCraft apps (
desktop/craft-download.ts,app/src/components/CraftDownloads.tsx): only the fixedCRAFT_APPSlist (repositorystorytold/<id>); the files offered are chosen from the latest release by exact name for this system and its package family (Windows:.msi, portable.zip; macOS:.dmg; Linux:.rpmfor Fedora/RHEL/SUSE or.debfor Debian/Ubuntu byID/ID_LIKEin os-release, then AppImage and.tar.gz; unknown distro: only AppImage and.tar.gz), the recommended one first; the person picks one, and the main process accepts only a name from the list it recomputes (the UI cannot ask for a.debon Fedora), its name must be plain (letters, digits,.,_,-) and the URL is built by Moki, never copied from the release data. A SHA-256 from GitHub or the release'sSHA256SUMS.txtis mandatory (without one nothing is downloaded); the file is written as.partwhile hashed (1 GiB limit) and kept only if the hash matches. The destination comes from the system save dialog, never from the UI. Moki never installs or runs the file; it shows the folder. -
IDE Companion (
ide/vscode/,ide/mcp/): no desktop UI and no write tools. Everything goes throughdesktop/companion.ts, opened for one project: file ids are checked against that project's own files (context first, then its other folders) or the context shared with it by tags, paths are resolved withresolveInside, secret-looking files are never listed or read, a PDF is returned as its text, andask/manualresources need the person's selection. The MCP server is fixed to its project when it starts.
npm run setup # install + build (also after each git pull)
npm run app:build # build only: Vite (UI) + esbuild (main, preload, run-tool) into app/dist and app/dist-electron
npm run app:dev # build and open the app
qa # open the app (after npm link)Both build folders are ignored by Git.
Development helpers (environment variables of the main process):
| Variable | Effect |
|---|---|
QA_OPEN_PROJECT=<id> |
Opens that project directly |
QA_OPEN_VIEW=library / launch
|
Opens the agent library / the launch wizard (with QA_OPEN_PROJECT) |
QA_SCREENSHOT=<file.png> |
Saves a screenshot of the window and quits (visual checks) |
QA_ROOT=<folder> |
Chooses the framework folder (the installed app defaults to Documents/Moki). If that location is in a Git checkout, the installed framework uses the user's application data directory and the workspace data stays at the chosen location. |
npm run dist:win # release/Moki Setup <version>.exe (NSIS, per-user, desktop + Start-menu shortcuts)
npm run dist:mac # .dmg (build on macOS)
npm run dist:linux # .AppImage (build on Linux)- The build stages only the built app and a minimal
package.jsoninbuild/app(electron-builder two-package layout);release/andbuild/are ignored by Git. - The installer carries the framework files (
extraResources→resources/framework). They are refreshed when their content changes (a hash of the files, so the app and the IDE extension with the same framework never redo it), normally in Documents/Moki or theQA_ROOToverride. The refresh writes file by file: an item another program holds open (an AI tool watching.claude/skillsor.agents/skills) is skipped, Moki opens with a warning and tries again on the next start. If that destination is in a Git checkout or worktree, the app installs its framework underMoki/frameworkin the user's application data directory (Local AppData on Windows, Application Support on macOS, or the XDG data directory on Linux). The workspace registry and default workspace stay at their original paths. -
node-ptyis an optional dependency (N-API, no rebuild for Electron): prebuilt for Windows/macOS, compiled bynpm installon Linux, which needs a C++ compiler (Fedora:gcc-c++, Ubuntu:build-essential). Without it the build warns and the app opens AI tools in external terminal windows. It is unpacked fromapp.asar. -
run-tool.mjsis unpacked fromapp.asarand run by the app's own executable in Node mode, so AI tools can be opened on computers without Node.js. -
parse-worker.mjs(the Word and spreadsheet preview parser, run in aworker_threadsworker bydesktop/parse-pool.ts) is its own self-contained bundle, also unpacked fromapp.asarbecause a worker cannot load from inside it. The worker starts on first use, ends after 30 s idle, and any worker failure (cannot start, crash, timeout) parses the file inline instead. - Not code-signed yet: Windows SmartScreen shows a warning on first run.
-
npm auditreports a moderate issue insprintf-js, a build-time dependency of electron-builder; it is not shipped inside the app.
tests/desktop.test.ts exercises the service without Electron: project creation, file tree, reading and editing, path confinement, launch validation, agent library and agents per project, Word extraction, Markdown escaping and the launcher's quoting. AI tools are never started in tests. tests/routines.test.ts covers the schedule (including summer time), a missed run, change detection, and a routine that watches one work item: the first look is a baseline, a new revision becomes a proposal waiting for approval, and the same revision does not notify again.
A routine lives in the project's hidden .routines/<id>/ folder (an older routines/ folder holding routines is moved there once, as it is) and owns the clock, the comparison and the notification. Each check keeps the readable content of every watched item (contents/), writes an update report of the items that changed, field by field (reports/<execution>.json, trimmed with its execution), and sends one notification: the number of updates, or "No updates." The report opens in the app; Start update activity writes it as Markdown to the project's temporary/ and launches the routine-update activity with it. Saving it also writes an operation in the user's library; the operation prepares the proposal, and applying it still needs an explicit approval. The scheduler runs in the app process. Keeping it alive after the window closes, and opening Moki at sign-in, are both off until the person turns them on in Settings → Routines and notifications. A desktop without a tray still runs the clock.
Azure DevOps MCP responses may wrap JSON in an untrusted-content envelope. The routine reader validates its matching delimiters and parses the JSON as data; content inside an item never becomes an instruction. Plain JSON responses continue to work.
For hierarchical wit_query results (get_results or wiql), leave the advanced list and identifier fields empty to use automatic item reading. The reader collects unique source and target IDs from workItemRelations, then reads their fields and revisions in batches through wit_work_item (get_batch) on the same read-only connection and with the query's project parameter. Repeated references produce one checkpoint per item. Missing items, duplicate or unexpected batch IDs, missing revisions, and failed batches fail the check without accepting a partial baseline. Explicit advanced fields and other query formats retain their existing interpretation.
The MCP query defaults to a top limit of 50 and supplies no continuation cursor. If the unique item count reaches that limit, the check stops; increase the query's top parameter or narrow its filter to obtain a result below the limit. Reading remains bounded by the routine's item and size limits. The first successful check records a baseline; later checks detect item revisions and items entering or leaving the query.
- Code signing for the installer, and automatic updates.
- Approvals and context proposals as buttons in the side panel.
Generated from docs/ of Orsi88/moki at main (416a793). Edit the files there; changes made in the wiki are replaced.
🇺🇸 English
Start here
Everyday use
- Projects and workspaces
- Files and the editor
- Notes and quick assistants
- AI terminals
- Calling activities, agents and skills
- Runs and deliverables
- Settings
- Routines and notifications
- Mycroft
- Project links
Capabilities and workflows
Integrations
Help
About
Contributing
🇧🇷 Português
Comece por aqui
Dia a dia
- Projetos e workspaces
- Arquivos e editor
- Notas e assistentes rápidos
- Terminais de IA
- Chamar atividades, agentes e skills
- Execuções e entregas
- Configurações
- Rotinas e notificações
- Ensinar o Moki com o Mycroft
- Links do projeto
Capacidades e fluxos
- Skills de QA e agentes
- Atividades
- Agents and operations
- Receitas de operação
- Especialistas de engenharia
Integrações
Ajuda
Sobre
Para quem contribui