Hivemind API
Record, recall, search, confirm and archive Hivemind entries, complete to-dos, and read, edit, compact and restore the Hivemind brief.
The Hivemind is the shared memory agents keep for an organization: short entries (one finding or to-do each) and the Hivemind brief, a compacted digest of older entries. These endpoints are the same ones the MCP Hivemind tools use (recall_knowledge, record_knowledge, complete_todo, compact_knowledge and the rest). See the Hivemind guide for how agents and people use it.
The Hivemind used to be called Knowledge. The paths (/api/v2/knowledge), the MCP tool names, the error codes (knowledge_*) and the JSON fields keep that name, so existing integrations keep working.
Kinds: fact, how_to, decision, gotcha, event, todo (something that still needs doing; see To-dos). Statuses: active, archived, superseded (replaced by another entry), compacted (folded into the brief). Link entity types: the same as notes: organization, project, campaign, creator, video, payout_method, payout_structure, payout_payment, member. Links must point to things in the key's organization.
Every write needs the write scope, accepts Idempotency-Key, is limited to 60 Hivemind writes an hour per member, and is recorded in the API audit log with the key and, over MCP, the agent's client name.
Entry fields#
| Field | Description |
|---|---|
id, kind, title, summary, tags, project_id (null = org-wide) | The entry. |
body | Markdown detail (full reads and writes only). has_body says whether there is one. |
status, pinned, valid_until | See above. Entries past valid_until are archived daily and never recalled, except to-dos: on a to-do, valid_until is the due date. |
overdue | true for an open to-do past its due date. |
completed_at | When a to-do was marked done; null while it's open and for other kinds. Full reads also have completed_by and completion_note. |
stale | true when nobody confirmed it for 90 days (or since it was added). Never archived automatically. Always false for a to-do. |
added_by | member_id, member_name, via (ui, api or mcp), client_name (e.g. claude-code), is_agent and a label such as "Added by an agent using claude-code for Sam". |
links | { entity_type, entity_id, name } for each linked entity. |
last_confirmed_at, confirm_count, use_count, version | version is for PATCH (expected_version). |
POST/api/v2/knowledge/recall#
The entries most useful for a task. Needs only the read scope (it bumps each returned entry's use_count).
| Field | Type | Description |
|---|---|---|
task | string | What the agent is about to do, in plain words (required). |
project_id, campaign_id | uuid | Scope. Entries linked to them, or in the project, rank higher. |
creator_ids | uuid[] | Creators the task is about. |
entities | { entity_type, entity_id }[] | Any other entities. |
kinds, tags | string[] | Filters. |
limit | integer | 1 to 20, default 8. |
Returns items (summaries only, never bodies, each with why it matched, score, stale, links and added_by; to-dos also have overdue), brief (version, created_at), compaction_suggested, compaction_reasons, settings and permissions. Archived, superseded, compacted and expired entries are left out; open to-dos stay in after their due date. With "kinds": ["todo"], every open to-do is eligible, so { "task": "what's left to do for the Spring campaign?", "campaign_id": "...", "kinds": ["todo"] } lists them, linked and matching ones first.
curl -X POST -H "Authorization: Bearer tga_<key>" -H "Content-Type: application/json" \
-d '{"task":"Why do this creator'\''s Instagram carousels show zero views?","creator_ids":["3fa85f64-5717-4562-b3fc-2c963f66afa6"]}' \
https://www.trackagoat.com/api/v2/knowledge/recallRanking. Full-text match of the task against the title, then the summary and tags, then the body; how closely the title matches; entries linked to the given entities; the same project (entries in other projects rank lower); pinned; recent; confirmed. Entries that are stale rank lower. An entry has to match the task's words or be linked to one of the given entities to come back.
GET/api/v2/knowledge#
Search and filter. Summaries only, paginated.
| Parameter | Description |
|---|---|
q | Words that must appear (quotes for phrases, - to exclude). |
project_id, project_scope | project_scope is any, project, project_and_org (default with project_id) or org. |
kinds, tags | Comma-separated. |
status | active (default), done (finished to-dos), archived (includes done to-dos), superseded, compacted or all. With kinds=todo and no q, results are soonest due first. |
added_by | any (default), agent (API or MCP) or person (the app). |
entity_type, entity_id | Only entries linked to this entity. |
limit, offset | 1 to 100 (default 25). meta.total and meta.next_offset. |
POST/api/v2/knowledge#
Record one entry. Returns 201 and the full entry.
| Field | Description |
|---|---|
kind, title (3 to 90 characters), summary (10 to 280) | Required. |
body | Markdown, up to 6,000 characters. |
tags | Up to 8; normalised to lowercase kebab-case. |
links | Up to 20 { entity_type, entity_id }. |
project_id, valid_until | valid_until is a date (end of that day, UTC) or timestamp in the future. On a to-do it is the due date, and may be in the past. |
allow_duplicate | Save even when a similar entry exists. |
When an active entry says nearly the same thing (for a to-do: another open to-do) (title and summary similarity of 0.5 or more), nothing is saved and the response is 409 possible_duplicate with meta.candidates (id, title, summary, similarity). Confirm or update one of them instead, or retry with allow_duplicate: true. Less similar entries come back in meta.possibly_related.
GET, PATCH, DELETE /api/v2/knowledge/{id}#
- GET returns the full entry;
metahascan_edit,can_complete(to-dos),can_archive,can_pinand the org's settings. - PATCH changes
kind,title,summary,body,tags,links(replaces them),project_id,valid_untilorpinned, or makes an archived entry active again with"status": "active"(on a done to-do this reopens it, and any member may). Requiresexpected_version; a stale one gets 409knowledge_version_conflictwithmeta.current_version. - DELETE archives it. Body (or query string):
reason(required) and optionalsuperseded_by, the active entry that replaces it. On an open to-do, areasonthat starts with "Done" marks it done instead, likePOST .../complete.
POST/api/v2/knowledge/{id}/confirm#
The entry is still true. Optional note (up to 280 characters). Bumps confirm_count and last_confirmed_at.
POST/api/v2/knowledge/{id}/complete#
Marks a to-do done. Optional body: note (up to 280 characters), what was done. The to-do is archived with the reason Done (or Done: <note>), completed_at is set and it leaves recall and the open to-do list. Any member may complete any to-do. Completing a done to-do changes nothing (meta.changed: false). Another kind of entry gets 409 knowledge_not_todo. Reopen with PATCH { "expected_version": n, "status": "active" }.
curl -X POST -H "Authorization: Bearer tga_<key>" -H "Content-Type: application/json" \
-d '{"note":"Asked on Oct 14; the new handle is @sam.makes"}' \
https://www.trackagoat.com/api/v2/knowledge/3fa85f64-5717-4562-b3fc-2c963f66afa6/completeTo-dos#
A to-do (kind: "todo") is work that still needs doing for the program. It's open while status is active, and valid_until is its due date: past it, overdue is true, and the daily job that archives expired entries skips it. It's done when completed_at is set (status archived). Open to-dos are never compaction candidates, don't count toward the compaction suggestion (the brief's meta.stats counts them as open_todo_count and overdue_todo_count), and POST /compaction refuses them unless listed in include_open_todo_ids. To-dos done more than 30 days ago are candidates (reason done_todo). meta.related_knowledge on a creator, campaign or project includes up to 3 open to-dos linked to it, with due and overdue.
GET/api/v2/knowledge/brief#
The current org brief, or ?project_id= for a project's, or ?version= for an earlier one. data is null when there is none. meta has current_version, stats (active_count, active_summary_chars, stale_count, new_since_brief, open_todo_count, overdue_todo_count and more; the counts behind the suggestion leave to-dos out), compaction_suggested, compaction_reasons, settings and permissions.
PUT/api/v2/knowledge/brief#
Write a new version directly: body (Markdown, up to 4,000 characters), expected_brief_version (0 when there is none), optional project_id and note. A stale version gets 409 knowledge_brief_conflict.
GET/api/v2/knowledge/brief/versions#
Every version, newest first, with a preview, source (compaction, edit or restore), folded_entry_count, note and created_by.
GET/api/v2/knowledge/compaction#
Candidates for compaction: the current brief, expected_brief_version, the budget, candidates (summaries and bodies trimmed to 500 characters, each with reasons: stale, expired, older_than_30_days, unconfirmed, low_use, replaces_older_entries, overlaps, done_todo), groups of overlapping entries, open_todo_count (open to-dos are never candidates), compaction_suggested and how_to_compact.
POST/api/v2/knowledge/compaction#
Commit a compaction in one transaction.
| Field | Description |
|---|---|
expected_brief_version | The version you read (0 when there is none). |
brief | The complete new brief, up to 4,000 characters. |
folded_entry_ids | Entries whose point is now in the brief. They become compacted. |
merged_entries | Up to 20 new consolidated entries (kind, title, summary, optional body, tags, links, project_id) each with replaces: the entries it replaces become superseded, and their links carry over. |
include_pinned_ids | Pinned entries you agreed to fold. Any other pinned entry fails with 409 knowledge_pinned_entries. |
include_open_todo_ids | Open to-dos the person agreed to drop. Any other open to-do fails with 409 knowledge_open_todos. Done to-dos can be folded without it. A merged entry can't be a to-do. |
project_id, note | A project brief (only its entries), and a note for the version history. |
Entries that are not active (or done to-dos) in scope fail with 409 knowledge_invalid_entries. Every org admin gets a notification naming the member and the agent.
POST/api/v2/knowledge/brief/restore#
version to bring back (optional expected_brief_version, project_id, note). It becomes a new version; entries folded or superseded by later compactions become active again (done to-dos go back to done), and the entries those compactions created are archived.
Settings#
Three org settings decide who may compact, edit or restore the brief; pin entries; and archive entries someone else added. Each is admins (the default) or members; org admins always may, and anyone may archive their own entries. They are returned in settings and the connection's permissions (can_compact, can_pin, can_archive_others, and more). A refused call gets 403 knowledge_compaction_admins_only, knowledge_pin_admins_only or knowledge_archive_admins_only. The settings can only be changed in the app, by an org admin.