Skip to content

feat(brains): createFromProject high-level helper (#182) - #20

Merged
rrader26 merged 3 commits into
mainfrom
feat/easy-brain-creation
Jul 21, 2026
Merged

feat(brains): createFromProject high-level helper (#182)#20
rrader26 merged 3 commits into
mainfrom
feat/easy-brain-creation

Conversation

@rrader26

Copy link
Copy Markdown
Contributor

Part B of #182 (SDK helper). Pairs with the memory_create_brain MCP tool in memory-thinkfleet (Part A).

What

Adds BrainsResource.createFromProject(opts) — the easy, high-level path to turning a project's memory into a brain:

const brain = await tf.brains.createFromProject({
  externalId: 'my-support-playbook',
  name: 'Support Playbook',
  domain: 'support',
})
// brain.status === 'DRAFT', brain.visibility === 'PRIVATE'
await tf.brains.update(brain.id, { visibility: 'PUBLIC', status: 'PUBLISHED' })
  • Takes { externalId, name, domain?, version?, visibility? } (CreateBrainFromProjectOptions).
  • Builds a sensible CreateBrainRequest with an empty-but-valid Brain Card (empty provenance + empty coverage) and calls the low-level create — which is left untouched.
  • Defaults version 1.0.0, visibility PRIVATE. Not published.
  • Server recomputes coverage from the project's memory (see caveat below).

Also adds BrainReasoningCoverage and card.coverage.reasoning to the SDK's BrainCard type, keeping the Brain Card in step with the server surface. New types exported from the package root.

Note

The current REST POST /brains handler stores card verbatim and does not recompute coverage — only the new memory_create_brain MCP tool does. So over REST the empty coverage is stored as-is until a server-side recompute lands on that route. The helper still sends the empty-but-valid card as the issue specifies.

Checks

npm run typecheck → clean. npm run build → success (CJS/ESM/DTS).

🤖 Generated with Claude Code

rrader2890 and others added 3 commits July 15, 2026 11:41
Add BrainsResource.createFromProject({ externalId, name, domain?, version?,
visibility? }) — the easy path to turning a project's memory into a brain. It
builds a sensible CreateBrainRequest with an empty-but-valid Brain Card
(empty provenance + coverage; the server recomputes coverage from the project's
memory) and calls the low-level create, which is left untouched. Defaults to
version 1.0.0 + PRIVATE; the brain is created DRAFT and is not published.

Also models the induced reasoning layer on BrainCard.coverage
(BrainReasoningCoverage) to keep the SDK's Brain Card type in step with the
server surface. New types exported from the package root.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@rrader26
rrader26 merged commit 8993b6a into main Jul 21, 2026
1 check passed
@rrader26
rrader26 deleted the feat/easy-brain-creation branch July 21, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants