feat(brains): createFromProject high-level helper (#182) - #20
Merged
Conversation
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>
# Conflicts: # package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part B of #182 (SDK helper). Pairs with the
memory_create_brainMCP 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:{ externalId, name, domain?, version?, visibility? }(CreateBrainFromProjectOptions).CreateBrainRequestwith an empty-but-valid Brain Card (emptyprovenance+ emptycoverage) and calls the low-levelcreate— which is left untouched.version1.0.0,visibilityPRIVATE. Not published.Also adds
BrainReasoningCoverageandcard.coverage.reasoningto the SDK'sBrainCardtype, keeping the Brain Card in step with the server surface. New types exported from the package root.Note
The current REST
POST /brainshandler storescardverbatim and does not recompute coverage — only the newmemory_create_brainMCP 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