Skip to content

Your team of AI agents, on your Mac, Windows or Linux. Agents that talk in channels, write code, review each other and use your tools, on the Claude Code, Codex, OpenCode or Pi you already have. Anything that touches the real world waits for your yes.

Let a new workspace bring the wiki, the same one (#153)

Eduardo Machadobbd041267761
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bee891e..975a390 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,14 +12,14 @@ What changed in each version of Tucano. The format follows [Keep a Changelog](ht
> - **A resposta começa enquanto você digita.** O Tucano já abre o Claude Code de quem vai responder: o router escolhe quem responde num canal em 1,5 s em vez de 2,8 s, e numa DM parada há mais de 5 minutos a resposta começa meio segundo antes.
> - **Um agente só acorda outro quando precisa.** Quando um agente menciona outro na resposta, o router lê e chama só quem tem algo a fazer: um agradecimento ou um “combinado” não acordam ninguém. Na dúvida, chama.
> - **O app abre fora do instalador mesmo com uma versão estranha.** O atualizador, que nem é usado ali, conferia a versão ao abrir e derrubava o app.
-> - **Workspaces.** Empresa e emprego, por exemplo, em workspaces separados: cada um com seus agentes, conversas, conectores e credenciais, memórias e rotinas, e um não vê o outro. Você troca pelo nome no topo da barra lateral, que mostra as não lidas e aprovações dos outros; as rotinas de todos continuam rodando. Ao criar, você marca o que levar do workspace atual (configurações gerais, contexto, agentes, canais, skills, conectores e credenciais, rotinas); duplicar leva tudo isso, nunca as conversas nem as memórias.
+> - **Workspaces.** Empresa e emprego, por exemplo, em workspaces separados: cada um com seus agentes, conversas, conectores e credenciais, memórias e rotinas, e um não vê o outro. Você troca pelo nome no topo da barra lateral, que mostra as não lidas e aprovações dos outros; as rotinas de todos continuam rodando. Ao criar, você marca o que levar do workspace atual (configurações gerais, contexto, wiki, agentes, canais, skills, conectores e credenciais, rotinas; a wiki é a mesma, não uma cópia); duplicar leva tudo isso, nunca as conversas nem as memórias.
> - **Agentes no Grok.** Um agente pode rodar no Grok CLI, com a assinatura do grok.com, como roda no Cursor CLI. Cada resposta usa uma pasta própria: os seus plugins, skills e hooks não carregam, e só as ferramentas do Tucano ficam à mão.
> - **Um conector que falha diz por quê.** O passo da resposta mostra o motivo em vermelho, e o agente recebe o mesmo motivo pra explicar, em vez de um ✗ sem nada.
> - **Os passos mostram o que o agente fez.** Cada consulta mostra o SQL ou o que foi pedido, e o que voltou ("120 linhas"); um comando mostra o comando inteiro, e o SQL quando roda um; uma skill diz qual foi lida. Tudo aparece enquanto o agente trabalha, sem nenhum segredo na tela.
### Added
-- **Workspaces.** Keep a company and a day job, say, apart: each workspace has its own agents, conversations, connectors and credentials, memories, routines, engine folders and browser sessions, and none sees another's. Switch from the name at the top of the sidebar, which shows the others' unread and pending approvals (and nothing else of them); every workspace's routines and triggers keep running while another is on screen, each on its own webhook and git proxy ports. Creating one asks what to bring from the workspace you're in, each ticked on its own: the general settings (your name, language, router and memory models, limits, quiet hours), the context, agents, channels, skills, connectors with their credentials, routines. What depends on something left behind comes without it (agents without connectors have no grants), and with nothing ticked it starts empty with the introduction. Duplicating ticks everything; never messages, memories or usage. Settings › General names the workspace apart from what the agents call you, and its Danger area deletes a workspace with all its data, Claude Code's transcripts of its agents included. The folder you had is the default workspace, unchanged, and keeps Telegram and opening at login. It's a separation of data, not an OS sandbox: an agent on your computer still reaches the same disk. Thanks [@b7s](https://github.com/b7s)! ([#63](https://github.com/eduwxyz/tucano/pull/63))
+- **Workspaces.** Keep a company and a day job, say, apart: each workspace has its own agents, conversations, connectors and credentials, memories, routines, engine folders and browser sessions, and none sees another's. Switch from the name at the top of the sidebar, which shows the others' unread and pending approvals (and nothing else of them); every workspace's routines and triggers keep running while another is on screen, each on its own webhook and git proxy ports. Creating one asks what to bring from the workspace you're in, each ticked on its own: the general settings (your name, language, router and memory models, limits, quiet hours), the context, the wiki (the same one, not a copy: what one keeps the other reads), agents, channels, skills, connectors with their credentials, routines. What depends on something left behind comes without it (agents without connectors have no grants), and with nothing ticked it starts empty with the introduction. Duplicating ticks everything; never messages, memories or usage. Settings › General names the workspace apart from what the agents call you, and its Danger area deletes a workspace with all its data, Claude Code's transcripts of its agents included. The folder you had is the default workspace, unchanged, and keeps Telegram and opening at login. It's a separation of data, not an OS sandbox: an agent on your computer still reaches the same disk. Thanks [@b7s](https://github.com/b7s)! ([#63](https://github.com/eduwxyz/tucano/pull/63))
- **Agents on Grok.** An agent can run on the [Grok CLI](https://x.ai/cli) with a grok.com subscription, the way it runs on Cursor CLI: sign in with `grok login` and pick a Grok model. Each reply runs in a folder and a home of its own, so your MCP servers, skills, hooks and plugins (Grok's and the ones installed for Claude Code or Cursor) don't load, Grok's own shell and files stay off, and Tucano's tools are the only ones it has. An `XAI_API_KEY` in the environment is set aside when grok.com is signed in, so the subscription isn't billed per token. The official installer is macOS and Linux. Thanks [@matheus-apolonio](https://github.com/matheus-apolonio)! ([#87](https://github.com/eduwxyz/tucano/pull/87))
### Changed
diff --git a/docs/workspaces.md b/docs/workspaces.md
index 96a9a0a..38efa10 100644
--- a/docs/workspaces.md
+++ b/docs/workspaces.md
@@ -18,7 +18,8 @@ side effect of pausing. Pause state is saved in each workspace's own database.
Creating and duplicating are one form: a name, and what to bring from a workspace,
each part ticked on its own: the general settings (the person's name, language,
-router and memory models, limits, quiet hours, voice), the context, agents,
+router and memory models, limits, quiet hours, voice), the context, the wiki,
+agents,
channels, skills, connectors with their encrypted credentials (and GitHub's), and
routines. Creating starts from the workspace on screen with only the general
settings ticked; with nothing ticked it starts empty, with the introduction.
@@ -28,6 +29,9 @@ workspace once it's made.
What depends on something left behind comes without it: agents without the
connectors have no grants, a skill of specific agents comes archived without
them, a routine comes only with its agent and place (and a connector it polls).
+The wiki isn't copied: the new workspace uses the same folder, so what one keeps
+the other reads; without it, it gets its own, empty. Deleting a workspace whose
+own wiki another one uses keeps that folder, moved to the first one using it.
With its agents, a set-up workspace skips the introduction; without, the
introduction starts from what came. Never copied: messages, memories,
conversation summaries, approvals, usage history, artifacts, running services,
diff --git a/src/core/db.ts b/src/core/db.ts
index 20f736d..a95c64f 100644
--- a/src/core/db.ts
+++ b/src/core/db.ts
@@ -342,7 +342,8 @@ export class Db {
// VACUUM removes deleted history from its pages; no engine/browser files copy.
// The extra Claude Code and Codex logins stay too (their folders, and the Mac's keychain,
// are the source's): the copy's agents use the usual login.
- duplicateTo(file: string, name: string, parts: WorkspaceParts = ALL_PARTS): void {
+ // `wikiDir`: the source's wiki folder, which the copy uses too when the wiki comes along.
+ duplicateTo(file: string, name: string, parts: WorkspaceParts = ALL_PARTS, wikiDir?: string): void {
if (existsSync(file)) throw new Error('Workspace destination already exists')
// Keep the unsanitized snapshot with its source, not in the new workspace.
// A crash before sanitizing must not leave source memories in the copy.
@@ -369,6 +370,8 @@ export class Db {
DELETE FROM secrets WHERE key LIKE 'telegram:%' OR key = 'github:proxy-key' OR key LIKE '%:oauth_verifier';
`)
target.keepOnly(parts)
+ if (!parts.wiki) target.db.prepare("DELETE FROM settings WHERE key = 'wikiDir'").run() // its own, empty
+ else if (wikiDir) target.setSettings({ wikiDir })
const setup = target.db.prepare("SELECT value FROM settings WHERE key = 'onboarding'").get() as { value: string } | undefined
const onboarding = setup ? JSON.parse(setup.value) as Settings['onboarding'] : undefined
// With its agents, a set-up workspace needs no introduction; without, it starts from what came.
diff --git a/src/core/index.ts b/src/core/index.ts
index 40a4622..d018b77 100644
--- a/src/core/index.ts
+++ b/src/core/index.ts
@@ -303,7 +303,7 @@ const shots = new Map<string, { resolve: (b: Buffer) => void; reject: (e: Error)
// Agents' browsers too (spec §24).
const pages = new Map<string, { resolve: (r: BrowserReply) => void; reject: (e: Error) => void }>()
process.parentPort.on('message', (e) => {
- const r = e.data as { type?: string; id: string; data?: unknown; error?: string; awake?: boolean; agentId?: string; shown?: boolean; conversationId?: string | null; targetDir?: string; name?: string; theme?: unknown; paused?: unknown; parts?: unknown } | undefined
+ const r = e.data as { type?: string; id: string; data?: unknown; error?: string; awake?: boolean; agentId?: string; shown?: boolean; conversationId?: string | null; targetDir?: string; name?: string; theme?: unknown; paused?: unknown; parts?: unknown; path?: unknown } | undefined
if (r?.type === 'workspace-pause') {
try {
if (closing || typeof r.paused !== 'boolean') throw new Error('Workspace cannot change pause state right now')
@@ -323,13 +323,23 @@ process.parentPort.on('message', (e) => {
try {
if (closing || !r.targetDir || !r.name) throw new Error('Workspace cannot be duplicated right now')
mkdirSync(r.targetDir, { recursive: true, mode: 0o700 })
- db.duplicateTo(join(r.targetDir, 'tucano.db'), r.name, r.parts === undefined ? undefined : workspaceParts(r.parts))
+ db.duplicateTo(join(r.targetDir, 'tucano.db'), r.name, r.parts === undefined ? undefined : workspaceParts(r.parts), wiki.dir)
process.parentPort.postMessage({ type: 'workspace-duplicated' })
} catch (error) {
process.parentPort.postMessage({ type: 'workspace-duplicated', error: error instanceof Error ? error.message : String(error) })
}
return
}
+ // The workspace whose folder held this wiki is being deleted: the folder moved here.
+ if (r?.type === 'wiki-relocate') {
+ void Promise.resolve()
+ .then(() => api.setWikiDir({ dir: typeof r.path === 'string' ? r.path : '' }))
+ .then(
+ () => process.parentPort.postMessage({ type: 'wiki-relocated' }),
+ (e: unknown) => process.parentPort.postMessage({ type: 'wiki-relocated', error: e instanceof Error ? e.message : String(e) })
+ )
+ return
+ }
if (r?.type === 'delete-workspace') {
if (closing) return
closing = true
diff --git a/src/main/index.ts b/src/main/index.ts
index 6df72ae..5b10752 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -2,7 +2,7 @@ import { randomBytes } from 'node:crypto'
import { verifyLocalUrl } from '../core/local-paths'
import { app, BrowserWindow, session, type MediaAccessPermissionRequest, dialog, ipcMain, Menu, MessageChannelMain, nativeImage, nativeTheme, net, Notification, powerMonitor, powerSaveBlocker, protocol, safeStorage, shell, Tray, utilityProcess, type UtilityProcess } from 'electron'
import { execFile } from 'node:child_process'
-import { mkdirSync, rmSync, writeFileSync } from 'node:fs'
+import { mkdirSync, renameSync, rmSync, writeFileSync } from 'node:fs'
import { dirname, join, normalize, sep } from 'node:path'
import { pathToFileURL } from 'node:url'
import { L, langOf, setLang, type Lang } from '../shared/lang'
@@ -117,6 +117,7 @@ type CoreRequest =
| { type: 'workspace-cleaned'; agentIds?: string[]; error?: string }
| { type: 'workspace-duplicated'; error?: string }
| { type: 'workspace-paused'; error?: string }
+ | { type: 'wiki-relocated'; error?: string }
| { type: 'secret'; id: string; op: 'encrypt' | 'decrypt'; data: string }
| { type: 'open'; url: string }
| { type: 'open_path'; path: string }
@@ -404,7 +405,7 @@ async function switchWorkspace(id: string): Promise<void> {
function trustedWorkspaceRequest(event: Electron.IpcMainInvokeEvent): void {
if (event.sender !== mainWindow?.webContents || event.senderFrame !== event.sender.mainFrame) throw new Error('Not the app window')
}
-function requestWorkspace(runtime: Runtime, request: object, response: 'workspace-cleaned' | 'workspace-duplicated' | 'workspace-paused'): Promise<string[]> {
+function requestWorkspace(runtime: Runtime, request: object, response: 'workspace-cleaned' | 'workspace-duplicated' | 'workspace-paused' | 'wiki-relocated'): Promise<string[]> {
return new Promise((resolve, reject) => {
const timer = setTimeout(() => { cleanup(); reject(new Error('Workspace operation timed out')) }, 180_000)
const onExit = (): void => { cleanup(); reject(new Error('Workspace stopped before the operation finished')) }
@@ -483,13 +484,19 @@ ipcMain.handle('workspaces:delete', async (event, id: unknown) => {
if (id !== undefined && typeof id !== 'string') throw new Error('Invalid workspace')
const workspace = id === undefined ? registry.selected() : registry.get(id as string)
if (workspace.isDefault) throw new Error(L('O workspace padrão não pode ser excluído.', 'The default workspace cannot be deleted.'))
+ // Workspaces made with this one's wiki brought along use its folder: the wiki stays, moved to them.
+ const inside = (p: string): boolean => p === workspace.dataDir || p.startsWith(workspace.dataDir + sep)
+ const sharers = registry.list().filter((w) => w.id !== workspace.id && inside(cores.get(w.id)?.wikiFolder ?? ''))
+ if (sharers.some((w) => cores.get(w.id)?.summary.status !== 'ready'))
+ throw new Error(L(`A wiki deste workspace também é a de ${sharers.map((w) => `“${w.name}”`).join(', ')}, que não está pronto agora. Tente de novo daqui a pouco.`, `This workspace's wiki is also ${sharers.map((w) => `“${w.name}”`).join(', ')}'s, which isn't ready right now. Try again in a moment.`))
switching = true
try {
const answer = await dialog.showMessageBox(mainWindow!, {
type: 'warning',
title: L('Excluir workspace', 'Delete workspace'),
message: L(`Excluir “${workspace.name}” e todos os seus dados?`, `Delete “${workspace.name}” and all its data?`),
- detail: L('Conversas, agentes, memórias, credenciais, rotinas e backups deste workspace serão apagados. Não dá para desfazer. Pastas de projetos e outros workspaces ficam intactos.', 'Conversations, agents, memories, credentials, routines and backups in this workspace will be deleted. This cannot be undone. Project folders and other workspaces are kept.'),
+ detail: L('Conversas, agentes, memórias, credenciais, rotinas e backups deste workspace serão apagados. Não dá para desfazer. Pastas de projetos e outros workspaces ficam intactos.', 'Conversations, agents, memories, credentials, routines and backups in this workspace will be deleted. This cannot be undone. Project folders and other workspaces are kept.') +
+ (sharers.length ? L(` A wiki fica: ela também é a de “${sharers[0]!.name}” e passa para a pasta dele.`, ` The wiki stays: it's also “${sharers[0]!.name}”'s, and moves to its folder.`) : ''),
buttons: [L('Cancelar', 'Cancel'), L('Excluir todos os dados', 'Delete all data')], defaultId: 0, cancelId: 0, noLink: true
})
if (answer.response !== 1) return
@@ -503,6 +510,18 @@ ipcMain.handle('workspaces:delete', async (event, id: unknown) => {
runtime.child.once('exit', () => { clearTimeout(timer); resolve() })
if (!runtime.child.kill()) { clearTimeout(timer); reject(new Error('Could not stop workspace')) }
})
+ // Each wiki folder still in use moves to the first workspace using it, and they all follow it.
+ for (const folder of new Set(sharers.map((w) => cores.get(w.id)!.wikiFolder))) {
+ const using = sharers.filter((w) => cores.get(w.id)!.wikiFolder === folder)
+ const to = join(using[0]!.dataDir, `wiki-${workspace.id.slice(-7)}`)
+ renameSync(folder, to)
+ try {
+ for (const w of using) await requestWorkspace(cores.get(w.id)!, { type: 'wiki-relocate', path: to }, 'wiki-relocated')
+ } catch (error) {
+ renameSync(to, folder) // back where they all look for it; nothing is deleted
+ throw error
+ }
+ }
const active = registry.selected().id === workspace.id
registry.deleteData(workspace.id)
cores.delete(workspace.id)
diff --git a/src/renderer/src/components/WorkspaceManager.tsx b/src/renderer/src/components/WorkspaceManager.tsx
index c149700..15c2204 100644
--- a/src/renderer/src/components/WorkspaceManager.tsx
+++ b/src/renderer/src/components/WorkspaceManager.tsx
@@ -9,6 +9,7 @@ import { useWorkspaceList } from './Workspaces'
const PARTS = (): Record<WorkspacePart, { label: string; about: string }> => ({
general: { label: L('Configurações gerais', 'General settings'), about: L('Seu nome, o idioma, os modelos do roteador e da memória, limites, horário de silêncio e voz.', 'Your name, the language, the router and memory models, limits, quiet hours and voice.') },
context: { label: L('Contexto', 'Context'), about: L('O texto que entra em toda conversa: quem você é, o que faz, o que importa.', 'The text that goes in every conversation: who you are, what you do, what matters.') },
+ wiki: { label: L('Wiki', 'Wiki'), about: L('A mesma wiki, não uma cópia: o que um workspace guarda o outro lê. Sem ela, começa com uma wiki vazia.', 'The same wiki, not a copy: what one workspace keeps the other reads. Without it, it starts with an empty wiki.') },
agents: { label: L('Agentes', 'Agents'), about: L('Instruções, modelos, computadores e pastas emprestadas, sem as memórias nem os arquivos.', 'Instructions, models, computers and lent folders, without their memories or files.') },
channels: { label: L('Canais', 'Channels'), about: L('Nomes, temas e quem está em cada um, sem as mensagens.', 'Names, topics and who is in each, without the messages.') },
skills: { label: L('Skills', 'Skills'), about: L('Sem os agentes, as de agentes específicos vêm arquivadas.', 'Without the agents, those of specific agents come archived.') },
diff --git a/src/shared/workspaces.ts b/src/shared/workspaces.ts
index fe94de0..cf23f97 100644
--- a/src/shared/workspaces.ts
+++ b/src/shared/workspaces.ts
@@ -8,11 +8,12 @@ export const workspaceLabel = (s: Pick<Settings, 'workspaceName' | 'workspaceLab
// folder, accounts, keys or phone).
export const GENERAL_SETTINGS = ['workspaceName', 'language', 'routerModel', 'memoryModel', 'memoryLearning', 'defaultLimit', 'approvalTtlHours', 'runBudgetPct', 'runStallMinutes', 'quietHours', 'harnesses', 'sounds', 'voice', 'browserJev', 'wikiCapture', 'wikiEdits', 'wikiReview'] as const satisfies readonly (keyof Settings)[]
// What a new workspace takes from another, each picked when creating it (a duplicate takes it all).
+// The wiki isn't copied: the new workspace uses the same one, and what one keeps the other reads.
// Never messages, memories, approvals, usage, computers' files, browser sessions or extra logins.
-export const WORKSPACE_PARTS = ['general', 'context', 'agents', 'channels', 'skills', 'connectors', 'routines'] as const
+export const WORKSPACE_PARTS = ['general', 'context', 'wiki', 'agents', 'channels', 'skills', 'connectors', 'routines'] as const
export type WorkspacePart = (typeof WORKSPACE_PARTS)[number]
export type WorkspaceParts = Record<WorkspacePart, boolean>
-export const ALL_PARTS: WorkspaceParts = { general: true, context: true, agents: true, channels: true, skills: true, connectors: true, routines: true }
+export const ALL_PARTS: WorkspaceParts = { general: true, context: true, wiki: true, agents: true, channels: true, skills: true, connectors: true, routines: true }
export function workspaceParts(raw: unknown): WorkspaceParts {
const from = raw && typeof raw === 'object' && !Array.isArray(raw) ? (raw as Record<string, unknown>) : {}
diff --git a/test/workspace-data.test.ts b/test/workspace-data.test.ts
index 249d37a..e510d59 100644
--- a/test/workspace-data.test.ts
+++ b/test/workspace-data.test.ts
@@ -202,7 +202,7 @@ it('brings only what was picked to a new workspace, and what depends on it comes
source.saveSkill({ id: 'own', name: 'For Lia', description: 'x', body: 'y', agents: ['lia'], state: 'active', createdAt: 1, updatedAt: 1 })
source.saveRoutine({ id: 'daily', name: 'Daily', agentId: 'lia', conversationId: 'eng', prompt: 'p', schedule: { days: [1], time: '09:00' }, enabled: true, createdAt: 1 })
source.saveRoutine({ id: 'poll', name: 'Poll', agentId: 'lia', conversationId: 'dm', prompt: 'p', schedule: { days: [], time: '09:00' }, enabled: true, createdAt: 1, trigger: { kind: 'poll', connectorId: 'linear', tool: 'list', args: {}, everyMinutes: 5 } })
- const none = { general: false, context: false, agents: false, channels: false, skills: false, connectors: false, routines: false }
+ const none = { general: false, context: false, wiki: false, agents: false, channels: false, skills: false, connectors: false, routines: false }
// The general settings only: an empty workspace whose introduction starts from them.
source.duplicateTo(join(dir, 'general.db'), 'General', { ...none, general: true })
@@ -235,6 +235,10 @@ it('brings only what was picked to a new workspace, and what depends on it comes
expect(skills.routines()).toEqual([])
expect(skills.getSettings(defaults).onboarding).toEqual({ done: false })
+ // The wiki: the same folder as the source's (its own one, inside its data, here).
+ source.duplicateTo(join(dir, 'wiki.db'), 'Wiki', { ...none, wiki: true }, join(dir, 'source-wiki'))
+ expect(open(join(dir, 'wiki.db')).getSettings(defaults).wikiDir).toBe(join(dir, 'source-wiki'))
+
// Everything: the duplicate, as before (context and the wiki folder too).
source.duplicateTo(join(dir, 'all.db'), 'All')
const all = open(join(dir, 'all.db'))
diff --git a/test/workspaces.test.ts b/test/workspaces.test.ts
index a07a8a0..5a7529d 100644
--- a/test/workspaces.test.ts
+++ b/test/workspaces.test.ts
@@ -17,7 +17,7 @@ it('suggests the current name with the next available duplicate count', () => {
})
it('reads what comes along to a new workspace, routines only with their agents', () => {
- expect(workspaceParts({ general: true, agents: true, routines: true, extra: true })).toEqual({ general: true, context: false, agents: true, channels: false, skills: false, connectors: false, routines: true })
+ expect(workspaceParts({ general: true, agents: true, routines: true, extra: true })).toEqual({ general: true, context: false, wiki: false, agents: true, channels: false, skills: false, connectors: false, routines: true })
expect(workspaceParts({ routines: true }).routines).toBe(false)
expect(workspaceParts({ general: 'yes' }).general).toBe(false)
expect(Object.values(workspaceParts(null)).some(Boolean)).toBe(false)