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.

Warn without blocking long skill recipes (#174)

Gian Moraes69e6ecf9505f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ec9ae77..572e784 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,10 @@ What changed in each version of Tucano. The format follows [Keep a Changelog](ht
## [Unreleased]
+### Changed
+
+- **Long skill recipes are kept whole.** A recipe over 20,000 characters was refused when written or proposed, cut when linked from Claude Code or Codex, and left out of an imported team. Now 10,000 characters is a recommendation: past it, Tucano says by how much and keeps the whole recipe, up to a million characters.
+
## [0.2.16] - 2026-11-07
> **Em português:**
diff --git a/src/core/agent-import.ts b/src/core/agent-import.ts
index 85c4194..984ebff 100644
--- a/src/core/agent-import.ts
+++ b/src/core/agent-import.ts
@@ -17,6 +17,7 @@ import { channelName, codexValue, customModel, MAX_AGENT_ROUTINES, type Agent, t
import { cleanLook } from './agent-look'
import type { Db } from './db'
import { frontmatter } from './local-skills'
+import { overlongSkillNote } from '../shared/skills'
import { skillName } from './skills'
import type { Zip } from './zip'
@@ -55,7 +56,6 @@ const MAX_TEXT = 1_000_000
const MAX_INSTRUCTIONS = 32_000
const MAX_PICTURE_BYTES = 145_000 // as a data URL it stays under cleanLook's cap
const MAX_MEMORY = 300
-const MAX_SKILL_BODY = 20_000
// What one file brings at most; the rest is counted in the summary.
export const IMPORT_CAPS = { agents: 40, channels: 30, skills: 20, routines: 20, memories: 40 }
const SUMMARY_LINES = 40
@@ -119,10 +119,6 @@ function readSkills(zip: Zip, paths: unknown, prefix: string, notes: string[]):
const nm = skillName(fm.name || folder.split('/').pop()!)
const body = fm.body.trim()
if (!nm || !body) return []
- if (body.length > MAX_SKILL_BODY) {
- notes.push(L(`a skill ${nm} (receita longa demais)`, `the ${nm} skill (recipe too long)`))
- return []
- }
const extraFiles = [...zip.entries.keys()].filter((f) => f.startsWith(`${folder}/`) && f !== `${folder}/SKILL.md`).length
return [{ name: nm, description: str(fm.description, 1_000) || nm, body, extraFiles }]
})
@@ -467,6 +463,8 @@ export function applyForeignTeam(db: Db, team: ForeignTeam, opts: { defaultLimit
left.push(L(`@${handle}: a skill ${k.name} (já existe uma com esse nome)`, `@${handle}: the ${k.name} skill (one with that name already exists)`))
continue
}
+ const note = overlongSkillNote(k.name, k.body.length)
+ if (note) left.push(`@${handle}: ${note}`)
const at = Date.now()
const id = randomUUID()
db.saveSkill({ id, name: nm, description: k.description, body: k.body, agents: [agent.id], state: 'active', createdAt: at, updatedAt: at })
diff --git a/src/core/local-skills.ts b/src/core/local-skills.ts
index 35cb96a..d6de480 100644
--- a/src/core/local-skills.ts
+++ b/src/core/local-skills.ts
@@ -84,7 +84,7 @@ function skill(file: string, origin: string): LocalSkill | undefined {
try {
const fm = frontmatter(readFileSync(file, 'utf8'))
const dir = dirname(file)
- return { source: file, name: fm.name || basename(dir), description: fm.description || '', origin, ...contents(dir) }
+ return { source: file, name: fm.name || basename(dir), description: fm.description || '', bodyLength: fm.body.trim().length, origin, ...contents(dir) }
} catch {
return undefined
}
diff --git a/src/core/skills.ts b/src/core/skills.ts
index 040364a..f8e1eb3 100644
--- a/src/core/skills.ts
+++ b/src/core/skills.ts
@@ -5,6 +5,7 @@
// version before it, so any can be undone.
import { randomUUID } from 'node:crypto'
import { L } from '../shared/lang'
+import { MAX_SKILL_BODY_LENGTH, skillLengthNote, tooLongSkill } from '../shared/skills'
import type { CoreEvent } from '../shared/rpc'
import { skillApplies, type Agent, type Skill, type SkillInput } from '../shared/types'
import type { Db } from './db'
@@ -13,7 +14,6 @@ import { frontmatter, readLinked } from './local-skills'
import { readdirSync, readFileSync } from 'node:fs'
import { basename, dirname } from 'node:path'
-const MAX_BODY = 20_000
const MAX_PENDING = 5 // per agent, so an agent can't flood the review
export const LER_SKILL: ToolDef = {
@@ -136,7 +136,7 @@ export class Skills {
if (!name) throw new Error(L('Dê um nome pra skill.', 'Give the skill a name.'))
if (!description) throw new Error(L('Diga quando usar.', 'Say when to use it.'))
if (!body) throw new Error(L('Escreva a receita.', 'Write the recipe.'))
- if (body.length > MAX_BODY) throw new Error(L(`A receita passou de ${MAX_BODY} caracteres.`, `The recipe is over ${MAX_BODY} characters.`))
+ if (body.length > MAX_SKILL_BODY_LENGTH) throw new Error(tooLongSkill())
if (this.active(name, input.id)) throw new Error(exists(name))
if (prev && prev.state === 'active' && (prev.name !== name || prev.description !== description || prev.body !== body)) this.keep(prev, 'me')
const at = this.now()
@@ -161,8 +161,9 @@ export class Skills {
const name = skillName(fm.name || basename(dirname(source)) || '')
if (!name) throw new Error(L('Essa skill não tem nome.', "That skill has no name."))
if (this.active(name)) throw new Error(exists(name))
+ if (fm.body.trim().length > MAX_SKILL_BODY_LENGTH) throw new Error(tooLongSkill())
const at = this.now()
- return this.store({ id: randomUUID(), name, description: fm.description || name, body: fm.body.trim().slice(0, MAX_BODY), agents: [...new Set(agents)], state: 'active', source, createdAt: at, updatedAt: at })
+ return this.store({ id: randomUUID(), name, description: fm.description || name, body: fm.body.trim(), agents: [...new Set(agents)], state: 'active', source, createdAt: at, updatedAt: at })
}
// `ler_skill`: a linked one is read from its file now, and can open its other files.
@@ -175,7 +176,8 @@ export class Skills {
try {
if (file) return { reply: `# ${k.name} · ${file}\n\n${readLinked(k.source, file)}`, skill: k }
const body = readLinked(k.source)
- if (body !== k.body) this.store({ ...k, body: body.slice(0, MAX_BODY) }) // the page shows the version the agents read
+ if (body.length > MAX_SKILL_BODY_LENGTH) return { reply: tooLongSkill(), error: true }
+ if (body !== k.body) this.store({ ...k, body }) // the page shows the version the agents read
return { reply: `# ${k.name}\n${L('Quando usar', 'When to use')}: ${k.description}\n\n${body}${filesNote(k.source)}`, skill: k }
} catch (e) {
return {
@@ -194,7 +196,7 @@ export class Skills {
const description = text('quando_usar')
const body = text('receita')
if (!name || !description || !body) return { reply: L('Faltou nome, quando_usar ou receita.', 'Missing nome, quando_usar or receita.'), error: true }
- if (body.length > MAX_BODY) return { reply: L(`A receita passou de ${MAX_BODY} caracteres: resuma.`, `The recipe is over ${MAX_BODY} characters: shorten it.`), error: true }
+ if (body.length > MAX_SKILL_BODY_LENGTH) return { reply: tooLongSkill(), error: true }
const all = this.deps.db.skills()
if (all.filter((s) => s.state === 'pending' && s.proposedBy === agent.id).length >= MAX_PENDING)
return { reply: L(`Você já tem ${MAX_PENDING} propostas esperando revisão. Espere o usuário decidir.`, `You already have ${MAX_PENDING} proposals waiting for review. Wait for the user to decide.`), error: true }
@@ -229,11 +231,12 @@ export class Skills {
L(`${agent.name} propõe ${current ? 'mudar a skill' : 'uma skill'}`, `${agent.name} proposes ${current ? 'a change to a skill' : 'a skill'}`),
`${name}: ${description.replace(/[.\s]+$/, '')}. ${L('Revise em Skills.', 'Review it in Skills.')}`
)
+ const note = skillLengthNote(body.length)
return {
- reply: L(
+ reply: `${L(
`Proposta enviada (${current ? 'mudança na skill' : 'skill nova'} "${name}"). Ela só vale depois que o usuário aprovar, na tela de Skills.`,
`Proposal sent (${current ? 'change to the skill' : 'new skill'} "${name}"). It only counts once the user approves it, on the Skills screen.`
- ),
+ )}${note ? `\n\n${note}` : ''}`,
skill: k
}
}
diff --git a/src/core/team.ts b/src/core/team.ts
index c894176..fc0fb44 100644
--- a/src/core/team.ts
+++ b/src/core/team.ts
@@ -6,6 +6,7 @@ import { existsSync, mkdirSync, readdirSync, rmSync, statSync } from 'node:fs'
import { randomUUID } from 'node:crypto'
import { join } from 'node:path'
import { L, locale } from '../shared/lang'
+import { overlongSkillNote } from '../shared/skills'
import { describeSchedule, MAX_AGENT_ROUTINES, modelInfo, type Agent, type AgentColor, type Effort, type GrantLevel, type Routine, type Schedule, type Trigger } from '../shared/types'
import { cleanLook } from './agent-look'
import type { Db } from './db'
@@ -131,6 +132,7 @@ export function importTeam(db: Db, text: string, defaultLimit: number, by = db.o
const connectors = db.connectors()
const connectorId = (name: string): string | undefined => connectors.find((c) => c.name === name)?.id
const added = { agents: 0, skills: 0, channels: 0, routines: 0, skipped: [] as string[] }
+ const longSkills: string[] = []
for (const a of data.agents ?? []) {
if (db.agents().some((x) => x.handle === a.handle)) continue
@@ -161,6 +163,8 @@ export function importTeam(db: Db, text: string, defaultLimit: number, by = db.o
for (const k of data.skills ?? []) {
if (db.skills().some((x) => x.state === 'active' && x.name === k.name)) continue
+ const note = overlongSkillNote(k.name, k.body.length)
+ if (note) longSkills.push(note)
const at = Date.now()
db.saveSkill({ id: randomUUID(), name: k.name, description: k.description, body: k.body, agents: k.agents.flatMap((h) => byHandle(h) ?? []), state: 'active', createdAt: at, updatedAt: at })
added.skills++
@@ -214,7 +218,8 @@ export function importTeam(db: Db, text: string, defaultLimit: number, by = db.o
added.routines && L(`${added.routines} rotina${added.routines > 1 ? 's' : ''} (desligadas)`, `${added.routines} routine${added.routines > 1 ? 's' : ''} (off)`)
].filter(Boolean)
const done = parts.length ? L(`Importei ${parts.join(', ')}.`, `Imported ${parts.join(', ')}.`) : L('Nada novo: tudo já existia aqui.', 'Nothing new: everything already existed here.')
- return `${done}${added.skipped.length ? L(` Ficou de fora: ${added.skipped.join('; ')}.`, ` Left out: ${added.skipped.join('; ')}.`) : ''}`
+ const long = longSkills.length ? L(` Skills longas: ${longSkills.join('; ')}.`, ` Long skills: ${longSkills.join('; ')}.`) : ''
+ return `${done}${added.skipped.length ? L(` Ficou de fora: ${added.skipped.join('; ')}.`, ` Left out: ${added.skipped.join('; ')}.`) : ''}${long}`
}
// ---------- backups ----------
diff --git a/src/renderer/src/assets/tucano-export-skill.md b/src/renderer/src/assets/tucano-export-skill.md
index 6653fc3..4a46a30 100644
--- a/src/renderer/src/assets/tucano-export-skill.md
+++ b/src/renderer/src/assets/tucano-export-skill.md
@@ -40,8 +40,9 @@ Copy, don't compose. Whatever you can't read here, leave out and list in the rep
report. Tucano asks for credentials through its own connectors.
- `picture`: the path of its picture in the zip, when it has one.
- `skills`: the paths of its skill folders (20 at most per agent). Each `SKILL.md` starts with a
- frontmatter block holding `name` and `description`, followed by the recipe, up to 20,000 characters.
- Tucano reads that file alone, so don't copy scripts, data or anything else into the folder.
+ frontmatter block holding `name` and `description`, followed by the recipe. Recipes over 10,000
+ characters are imported whole, with a recommendation to shorten them. Tucano reads that file alone,
+ so don't copy scripts, data or anything else into the folder.
- `routines`: its scheduled tasks (20 at most per agent), each with `name`, `prompt` (what the task
asks), `days` (any of `sun mon tue wed thu fri sat`), `time` (`HH:MM`, 24-hour clock) and `timezone`
(an IANA name, like `Europe/Lisbon`). Add `"once": true` to a task that runs a single time. Tucano runs
diff --git a/src/renderer/src/components/Onboarding.tsx b/src/renderer/src/components/Onboarding.tsx
index b52f27c..84cbe4b 100644
--- a/src/renderer/src/components/Onboarding.tsx
+++ b/src/renderer/src/components/Onboarding.tsx
@@ -6,6 +6,7 @@
// the person lands in a channel watching it work. Then "Primeiros passos" in the sidebar
// walks through the rest, checking itself off as each feature gets used.
import { L, lang } from '../../../shared/lang'
+import { RECOMMENDED_SKILL_BODY_LENGTH, skillLengthNote } from '../../../shared/skills'
import { createContext, useCallback, useContext, useEffect, useRef, useState, type ReactNode } from 'react'
import {
ENGINES,
@@ -667,6 +668,7 @@ function SkillsStep({ picked, setPicked, onBack, onNext }: { picked: string[]; s
<strong>{k.name}</strong> <span className="tag">{k.origin}</span>
<span className="onb-skill__desc">{k.description}</span>
{k.scripts && <span className="small warn-text">{L('Tem scripts: precisa de um agente com computador.', 'It has scripts: needs an agent with a computer.')}</span>}
+ {k.bodyLength > RECOMMENDED_SKILL_BODY_LENGTH && <span className="small warn-text" role="status">{skillLengthNote(k.bodyLength)}</span>}
</span>
</button>
))}
diff --git a/src/renderer/src/components/Skills.tsx b/src/renderer/src/components/Skills.tsx
index e3a8c28..363fada 100644
--- a/src/renderer/src/components/Skills.tsx
+++ b/src/renderer/src/components/Skills.tsx
@@ -26,6 +26,7 @@ import {
isTeam,
amAdmin
} from '../store'
+import { RECOMMENDED_SKILL_BODY_LENGTH, skillLengthNote } from '../../../shared/skills'
import { Card, Field, Sheet } from './Pages'
import { AdminOnly } from './People'
import { confirmDialog } from './Dialogs'
@@ -245,6 +246,7 @@ function SkillPage({ skill: k, stat, onBack, onEdit }: { skill: Skill; stat?: Sk
)}
<section className="read-group">
<h2>{L('Receita', 'Recipe')}</h2>
+ {k.source && k.body.length > RECOMMENDED_SKILL_BODY_LENGTH && <p className="hint hint--warn" role="status">{skillLengthNote(k.body.length)}</p>}
{k.body.trim() ? (
<article className="recipe">
<Markdown urlTransform={safeUrl} remarkPlugins={[remarkGfm]}>{k.body}</Markdown>
@@ -339,6 +341,7 @@ function AddFromTerminal({ onClose }: { onClose: () => void }): ReactNode {
{on && <span className="tag tag--ok">{L('em uso', 'in use')}</span>}
</span>
<span className="skill-add__desc">{l.description}</span>
+ {l.bodyLength > RECOMMENDED_SKILL_BODY_LENGTH && <span className="warn-text small" role="status">{skillLengthNote(l.bodyLength)}</span>}
</button>
)
})}
@@ -351,6 +354,7 @@ function AddFromTerminal({ onClose }: { onClose: () => void }): ReactNode {
</button>
<h3>{picked.name}</h3>
<p>{picked.description}</p>
+ {picked.bodyLength > RECOMMENDED_SKILL_BODY_LENGTH && <p className="warn-text small" role="status">{skillLengthNote(picked.bodyLength)}</p>}
{picked.scripts && <p className="warn-text small">{L('Tem scripts: só roda com um agente que tenha computador (Linux ou este computador).', 'It has scripts: it only runs with an agent that has a computer (Linux or this computer).')}</p>}
<span className="skill-add__label">{L('Quem usa?', 'Who uses it?')}</span>
<AgentPicker value={agents} onChange={setAgents} />
@@ -449,6 +453,7 @@ function Proposal({ proposal: p }: { proposal: Skill }): ReactNode {
</span>
</header>
{p.reason && <p className="proposal__why">“{p.reason}”</p>}
+ {p.body.length > RECOMMENDED_SKILL_BODY_LENGTH && <p className="hint hint--warn" role="status">{skillLengthNote(p.body.length)}</p>}
{current ? (
<Diff before={`${current.description}\n\n${current.body}`} after={`${p.description}\n\n${p.body}`} />
) : (
@@ -528,9 +533,12 @@ function SkillForm({ draft, onChange, onClose }: { draft: SkillInput; onChange:
{L('Ligada a', 'Linked to')} <span className="mono">{draft.source}</span>: {L('a receita muda lá, e os agentes leem sempre a versão de agora. Aqui você escolhe quem usa.', 'the recipe changes there, and agents always read the current version. Here you pick who uses it.')}
</p>
) : (
- <Field label={L('Receita', 'Recipe')} hint={L('Os passos, em Markdown: comandos exatos, armadilhas, como conferir.', 'The steps, in Markdown: exact commands, pitfalls, how to check.')}>
- <textarea rows={10} className="mono" value={draft.body} onChange={(e) => set({ body: e.target.value })} />
- </Field>
+ <>
+ <Field label={L('Receita', 'Recipe')} hint={L('Os passos, em Markdown: comandos exatos, armadilhas, como conferir.', 'The steps, in Markdown: exact commands, pitfalls, how to check.')}>
+ <textarea rows={10} className="mono" value={draft.body} onChange={(e) => set({ body: e.target.value })} />
+ </Field>
+ {draft.body.length > RECOMMENDED_SKILL_BODY_LENGTH && <p className="hint hint--warn" role="status">{skillLengthNote(draft.body.length)}</p>}
+ </>
)}
<Field label={L('Quem usa', 'Who uses it')}>
<AgentPicker value={draft.agents} onChange={(agents) => set({ agents })} />
diff --git a/src/shared/skills.ts b/src/shared/skills.ts
new file mode 100644
index 0000000..336e2b0
--- /dev/null
+++ b/src/shared/skills.ts
@@ -0,0 +1,23 @@
+import { L, locale } from './lang'
+
+export const RECOMMENDED_SKILL_BODY_LENGTH = 10_000
+// Past the recommendation a recipe is kept whole; this is only the ceiling for one that isn't a
+// recipe at all (a file pasted by mistake, an agent writing on and on), far above any real one.
+export const MAX_SKILL_BODY_LENGTH = 1_000_000
+export const tooLongSkill = (): string =>
+ L(`A receita passou de ${MAX_SKILL_BODY_LENGTH.toLocaleString(locale())} caracteres.`, `The recipe is over ${MAX_SKILL_BODY_LENGTH.toLocaleString(locale())} characters.`)
+
+export function skillLengthNote(length: number): string {
+ const excess = length - RECOMMENDED_SKILL_BODY_LENGTH
+ return excess > 0
+ ? L(
+ `Receita longa: ${length.toLocaleString(locale())} caracteres, ${excess.toLocaleString(locale())} acima do recomendado de ${RECOMMENDED_SKILL_BODY_LENGTH.toLocaleString(locale())}. Recomendamos encurtar; a receita inteira será mantida.`,
+ `Long recipe: ${length.toLocaleString(locale())} characters, ${excess.toLocaleString(locale())} over the ${RECOMMENDED_SKILL_BODY_LENGTH.toLocaleString(locale())}-character recommendation. Consider shortening it; the full recipe will be kept.`
+ )
+ : ''
+}
+
+export const overlongSkillNote = (name: string, length: number): string => {
+ const note = skillLengthNote(length)
+ return note ? `${name} · ${note}` : ''
+}
diff --git a/src/shared/types.ts b/src/shared/types.ts
index 174bdf2..516e1ba 100644
--- a/src/shared/types.ts
+++ b/src/shared/types.ts
@@ -881,6 +881,7 @@ export interface LocalSkill {
source: string // the SKILL.md
name: string
description: string
+ bodyLength: number // recipe characters, excluding frontmatter
origin: string // "Claude Code", "Plugin <name>", "Codex"
files: string[] // its other text files, relative to its folder
scripts: boolean // it has scripts: an agent needs a computer to run them
diff --git a/test/agent-import.test.ts b/test/agent-import.test.ts
index a2d4414..e9b90f2 100644
--- a/test/agent-import.test.ts
+++ b/test/agent-import.test.ts
@@ -263,6 +263,17 @@ describe('importing agents from Grok Bot, through our skill', () => {
'agents/ledger/skills/reconcile/template.txt': 'x'
})
+ it('imports long skills whole and reports how far they exceed the recommendation', () => {
+ const source = files()
+ const body = 'x'.repeat(32_345)
+ source['agents/ledger/skills/reconcile/SKILL.md'] = `---\nname: reconcile\ndescription: When reconciling\n---\n${body}`
+ const db = fresh()
+ const team = readForeignZip(zipFromBuffer(zip(source)))
+ const r = applyForeignTeam(db, team, opts)
+ expect(db.skills()[0]?.body).toHaveLength(32_345)
+ expect(r.summary).toContain('22.345 acima do recomendado de 10.000')
+ })
+
it('brings agents, skills, routines off, memories to confirm and group chats as channels', () => {
const db = fresh()
db.createConversation({ id: 'g', kind: 'channel', name: 'geral', members: [] })
diff --git a/test/local-skills.test.ts b/test/local-skills.test.ts
index 89fe8bc..557a12a 100644
--- a/test/local-skills.test.ts
+++ b/test/local-skills.test.ts
@@ -37,6 +37,12 @@ describe('local skills', () => {
expect(frontmatter('---\nname: a\ndescription: |\n um\n dois\nlicense: MIT\n---\ncorpo')).toEqual({ name: 'a', description: 'um dois', body: 'corpo' })
})
+ it('counts the recipe body for a non-blocking length recommendation', () => {
+ const body = 'x'.repeat(32_345)
+ put(join(home, '.claude/skills/longa/SKILL.md'), `---\nname: longa\n---\n${body}`)
+ expect(findLocalSkills(home).find((k) => k.name === 'longa')?.bodyLength).toBe(32_345)
+ })
+
it("finds the user's Claude Code skills, the turned-on plugins' and Codex's, with their files and scripts", () => {
const found = findLocalSkills(home)
expect(found.map((k) => [k.name, k.origin])).toEqual([['video', 'Claude Code'], ['verify', 'Plugin sdd'], ['humanize', 'Plugin root'], ['imediato', 'Codex']])
diff --git a/test/skills.test.ts b/test/skills.test.ts
index 9c0d700..74809bb 100644
--- a/test/skills.test.ts
+++ b/test/skills.test.ts
@@ -1,4 +1,4 @@
-import { mkdtempSync } from 'node:fs'
+import { mkdtempSync, writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
@@ -38,6 +38,33 @@ describe('skills', () => {
expect(() => skills.save({ ...recipe, body: 'outra' })).toThrow('Já existe uma skill chamada testes-do-core.')
})
+ it('keeps long recipes whole and recommends shortening without blocking proposals', () => {
+ const body = 'x'.repeat(32_345)
+ const saved = skills.save({ ...recipe, body })
+ expect(saved.body).toHaveLength(32_345)
+
+ const proposed = skills.propose(db.agent('a1')!, { nome: 'longa', quando_usar: 'Sempre', receita: body })
+ expect(proposed.skill?.body).toHaveLength(32_345)
+ expect(proposed.reply).toContain('Receita longa: 32.345 caracteres')
+ expect(proposed.reply).toContain('22.345 acima do recomendado de 10.000')
+ expect(skills.save({ ...recipe, name: 'outra', body }).body).toHaveLength(32_345)
+
+ const source = join(mkdtempSync(join(tmpdir(), 'ad-skill-')), 'SKILL.md')
+ writeFileSync(source, `---\nname: longa\ndescription: Sempre\n---\n${body}`)
+ const linked = skills.link(source, ['a1'])
+ expect(linked.body).toHaveLength(32_345)
+ expect(skills.read(db.agent('a1')!, { nome: 'longa' }).reply.endsWith(body)).toBe(true)
+ })
+
+ it('refuses only what is past a million characters: not a recipe at all', () => {
+ const huge = 'x'.repeat(1_000_001)
+ expect(() => skills.save({ ...recipe, body: huge })).toThrow('1.000.000')
+ expect(skills.propose(db.agent('a1')!, { nome: 'enorme', quando_usar: 'Sempre', receita: huge })).toMatchObject({ error: true })
+ const source = join(mkdtempSync(join(tmpdir(), 'ad-skill-')), 'SKILL.md')
+ writeFileSync(source, `---\nname: enorme\ndescription: Sempre\n---\n${huge}`)
+ expect(() => skills.link(source, ['a1'])).toThrow('1.000.000')
+ })
+
it("an agent's new skill waits for me, and only its proposer gets it once approved", () => {
const r = skills.propose(db.agent('a1')!, { nome: 'abrir PR', quando_usar: 'Ao terminar uma tarefa', receita: 'git push … (feito pelo Eduardo)', motivo: 'faço sempre igual' })
expect(r.skill).toMatchObject({ state: 'pending', name: 'abrir-pr', proposedBy: 'a1', agents: ['a1'] })
diff --git a/test/team.test.ts b/test/team.test.ts
index 4f48bb7..4a32bd4 100644
--- a/test/team.test.ts
+++ b/test/team.test.ts
@@ -44,6 +44,16 @@ describe('the team as a file', () => {
expect(() => importTeam(b, '# outro arquivo', 1)).toThrow('não é um time exportado')
})
+ it('imports a long team skill whole and reports the excess over the recommendation', () => {
+ const source = fresh()
+ source.saveAgent(agent('s', 'staff'))
+ source.saveSkill({ id: 'long', name: 'longa', description: 'Ao usar', body: 'x'.repeat(32_345), agents: ['s'], state: 'active', createdAt: 1, updatedAt: 1 })
+ const target = fresh()
+ const summary = importTeam(target, exportTeam(source), 2_000_000)
+ expect(target.skills()[0]?.body).toHaveLength(32_345)
+ expect(summary).toContain('22.345 acima do recomendado de 10.000')
+ })
+
it('backs up the database to a file', () => {
const a = fresh()
a.saveAgent(agent('s', 'staff'))