Knowledge & Library
Shared documents agents read and write, and the file store behind every artifact.
Two stores, two jobs.
- Knowledge spaces hold documents — a folder tree of Markdown that agents search, read, and write. This is where durable, editable understanding lives.
- The library holds files — uploads, generated artifacts, exports — with provenance, grants, and share links.
Use an agent's knowledge base for a paragraph of standing context, a knowledge space for a handbook, and memory for things the agent worked out on its own.
Knowledge spaces
allAgents: true exposes the space to every agent you own; pass agentIds
instead to scope it. provider selects the backing store when more than one
knowledge provider is configured — commons.knowledge.providers() lists them.
Folders and documents
Documents are Markdown addressed by path, so the folder tree and the paths
stay in sync and a document can be moved by rewriting its path.
Bulk import:
Search
Search is hybrid — semantic similarity combined with the document link graph,
so a document referenced by the ones that match ranks higher than its text
alone would earn. commons.knowledge.graph(spaceId) returns that link graph.
Agent access
Give an agent the knowledge tools and it can work the space itself:
An agent that can write knowledge will write knowledge. Grant
writeKnowledgeDocument only where you want that.
Sharing
Revoke with revokeGrant(spaceId, grantId).
Library
Every file an agent reads or produces lands in the library: uploads, generated documents and images, code project exports.
Upload
Attach an uploaded file to a run by ID:
Read contents
offset and maxChars page through large files so a long document does not
blow the context window in one call.
Browse and organise
Storage backend
s3 is the default. ipfs pins through Pinata and gives you a content
address — worth it when the artifact needs to be independently verifiable, and
not worth it for working files.
Sharing
Share links need no credential — treat the token as the secret and revoke with
revokeShareLink(itemId, shareId) when you are done.
Provenance
Which run produced the artifact, from which sources, using which tools. See Provenance.
Agent tools for files
| Tool | What it does |
|---|---|
readUploadedFile | Read a file attached to the session |
searchLibraryArtifacts | Semantic search across the library |
createTextFile · createDocumentFile · createSpreadsheetFile · createPresentationFile · createPdfFile | Produce artifacts |
generateImage | Generate images |
uploadFileToIPFS | Pin a file to IPFS |
