Packages
Write export JSDoc for a package
Agent playbook — written for the agent connected to your account; you can read along
Search detail (entity: "package:…") shows an Exports table whose Purpose
column comes from each export's JSDoc. When JSDoc is missing, Purpose falls back
to the generic string Package export. Agents skim that column first when
choosing among sibling exports. Export-specific limits and call gotchas belong
here, not in MCP server instructions or account memories
(Where agent guidance lives).
TypeScript types and the export name give call shape when present. They do not
say when or why to pick one export over another, and on exposed exports
they do not protect callers who pass plain objects through execute (see
Runtime input checking). README
## Intent is package-scoped and often does not name every export. Neither
replaces per-export JSDoc.
Do not add a package manifest field, runtime object, saved value, or other Kody primitive solely to track export purpose. Put it in JSDoc on the exported function.
When you create or materially change a public export:
- Write JSDoc immediately above the exported function (or above
export defaultfor a local binding in the same file). - Start with one line that states what the export does and when to call it.
- Add
@paramfor each input. - Add
@returns. - Add
@examplethat importskody:@scope/id/exportand calls it.
If the export's package.json exports entry has a types condition, put the
JSDoc on that types file — search reads the types module when it exists. JSDoc
on an imported re-export (export default foo where foo is imported) is not
attributed; implement the function in the export file (or a local binding in
that file) so the comment sits on the exported symbol.
/**
* Format a Discord moderation report for a channel.
* Use when a human or job needs a readable summary of recent flags.
*
* @param input - Channel id and optional lookback window
* @returns Markdown report body
*
* @example
* import formatReport from 'kody:@scope/discord/format-report'
*
* const report = await formatReport({ channelId: '123' })
*/
export default async function formatReport(input: {
channelId: string
lookbackHours?: number
}): Promise<{ markdown: string }> {
return { markdown: '' }
}Treat missing or generic Purpose (Package export.) as unfinished work, the
same as a missing README ## Intent section.