Blocks
Save to knowledge
Save, delete, or prune documents in a workspace knowledge base so agent steps can retrieve them. Source names, bulk items, revision guards, repo indexing.
Write one document into a workspace knowledge base, chunked and embedded, so an agent step bound to the base retrieves it. The source name is the document's identity: save the same name again and the earlier version is replaced; delete mode removes it.
Config
- Knowledge base: pick the base (created in Settings → data → knowledge bases). The AI writes the base's exact name.
- Mode:
savestores the text under the source name;deleteremoves the document with that name (a no-op when absent);prunetreats the source as a prefix and removes every document under it that is not in Keep, the reconcile after a full re-index. - Source name: template-rendered. Use the natural stable name: a file path, a URL, a ticket id. Re-runs replace instead of duplicating.
- Text: template-rendered; usually a whole-string reference to a
prior step's output such as
{{ steps.read_file.output.text }}. Empty text on save removes the document. - Items (bulk): save only, optional: a whole-string reference to
a list of
{source, text}maps. Each item is saved as its own document under this step's Kind and Revision, and Source/Text are ignored. Use it to index a batch of files per loop iteration instead of one per iteration. - Revision: optional number stored with the document (GitHub's push time, a run's start time; never a commit's own timestamp, which a rebase can make older than the previous push). A save, delete or prune older than what is stored is skipped and the output says so, so two runs writing the same document out of order cannot leave the older content behind. Blank means no guard.
- Kind:
prose(paragraph chunks with a short model-written context line per chunk) orsource(a code file: chunks cut at definition boundaries and stamped with the path, no model call).
Output
{ "mode": "save", "source": "lib/mad_max/sms.ex", "chunks": 6, "kind": "source",
"knowledge_id": "…", "knowledge_name": "coworkly repo" }
Patterns
- Index a repository: on each push, read every changed file with
GitHub's
get_fileand save it under its path (kind: source); delete removed paths. A full backfill saves every file in the tree, then prunesowner/repo/against the list it just indexed. A reviewer agent bound to the base then sees the code around a diff, not just the hunk. - Keep docs searchable: a schedule fetches pages and saves each under its URL; a support agent answers from the base.
- Let an agent file what it learned: add the base as a tool on the agent step (Tools → knowledge bases) and the agent saves or deletes documents itself.
- Store or knowledge base? A keyed row another step looks up by key belongs in a data store. Text an agent should find by meaning belongs here.