Docs

Tools

Every client connected to khive, with OAuth or an API key, is offered the same tools. You don't call them yourself: you ask your agent in plain language and it picks the tool. This page lists them, so you can tell what a call did.

Everything a tool stores stays in your own workspace. Read-only tools are marked as such to clients that show it; save_knowledge_atoms, save_knowledge_domains and delete_record are marked as destructive, because they can replace or remove what is already stored. A refused call comes back with a message that says why, for example atom content must be at least 20 words (got 19).

Memory

ToolWhat it does
rememberStores a memory and returns its id. Takes content, and optionally memory_type (episodic or semantic), salience and tags.
recall_memoriesFinds memories by meaning and returns the closest ones with their scores and ids. Takes a query.

A memory is a record. To correct one, pass its id to update_record; to forget one, pass its id to delete_record, and recall_memories stops returning it. To find memories with search_records, search kind memory.

Records and the knowledge graph

Records are entities, such as a service, a person or a document, and notes, such as a decision or an observation. Edges link them with a typed relation.

ToolWhat it does
create_recordCreates an entity (kind: "entity" with an entity_kind and a name) or a note (kind: "note" with a note_kind and content). Returns the whole record, its id included.
get_recordFetches one record by id.
update_recordChanges the name, description, content, tags or properties of a record by id. Fields you leave out stay as they are.
delete_recordDeletes a record by id. Afterwards get_record answers that it is not found.
list_recordsLists records of one kind, with paging. Use it to browse.
search_recordsSearches records of one kind by a query and returns ids, snippets and scores. kind is required: entity, note, memory, task, or a specific kind such as service or decision.
link_recordsLinks two records with a relation, such as depends_on between two services. The relation has to fit the two kinds; a pair that does not fit is refused. Takes one link, or a list of links that are written all together or not at all.
graph_neighborsReturns the records linked to one record, given its id or name, with each edge's relation and weight.
graph_contextReturns the neighbourhood around one or more entities (ids or names) or around a query, for grounding an answer.

Entity kinds: concept, document, dataset, project, person, org, artifact, service, resource. Note kinds: observation, insight, question, decision, reference. For example, asking your agent to record that an API depends on a database ends in calls like these:

create_record   { "kind": "entity", "entity_kind": "service", "name": "orders-api" }
create_record   { "kind": "entity", "entity_kind": "service", "name": "orders-db" }
link_records    { "source_id": "<orders-api id>", "target_id": "<orders-db id>", "relation": "depends_on" }
graph_neighbors { "node_id": "orders-api" }

Tasks

ToolWhat it does
add_taskCreates a task and returns its id. Takes a title, and optionally a priority (p0 to p3, default p2), a due date, tags, an assignee and the tasks it depends_on. A new task starts in inbox.
list_tasksLists tasks, filtered by status, priority or assignee. Done and cancelled tasks are left out unless you ask for status: "done" or "cancelled".
move_taskChanges a task's status, for example to next, active or waiting, with an optional note. Moving a task to cancelled keeps it and its history.
complete_taskMarks a task done, with an optional result note.

Knowledge

Knowledge is reference material you want kept and retrieved as written: atoms, each a piece of text with a slug, grouped into domains. A memory is for a single recollection; an atom is for a document.

ToolWhat it does
save_knowledge_atomsStores atoms, each with a slug, a name and content of at least 20 words. Saving to a slug that already exists replaces that atom. An atom is saved as a draft unless it carries finalized: true.
index_knowledgePrepares saved atoms for search. Pass the slugs you just saved.
search_knowledgeSearches atoms by a query and returns ranked matches. It returns finalized atoms only.
get_knowledge_atomFetches one atom or domain by id or slug.
save_knowledge_domainsGroups atoms into a domain, with a slug, a name, a description of at least 20 words, and the slugs of its members. Saving to a slug that already exists replaces the domain, members included.
suggest_knowledge_domainsReturns the domains that fit a question of at least five words, with ids to pass on.
compose_knowledgeBuilds a briefing from atoms for a question. Given domain_ids or atom_ids, it draws on those atoms. Without ids, the question must be at least ten words, and it picks from finalized atoms only.

So that an atom can be found by search_knowledge, save it with finalized: true and then index it:

save_knowledge_atoms   { "atoms": [ { "slug": "backups", "name": "Backups", "finalized": true,
                          "content": "The staging database is backed up every night at 02:00 UTC. Each backup is kept for fourteen days, and a restore from the latest backup is tested once a month." } ] }
index_knowledge        { "ids": [ "backups" ] }
search_knowledge       { "query": "how long are backups kept" }

To connect a client, see Quickstart. Questions: contact@khive.ai.