Skip to content

Reference

SearchBeta

GET /v1/search finds the sessions and events in your org that contain a word, an id or a tool name. Beta: the contract below can still change.

GET /v1/search is a ranked, org-scoped search over the chain the explorer already shows, with plain-text snippets and a deep link into the session.

It is backed by Postgres indexes that Machinaut hosts and scopes to your org. Search never shows you anything the explorer would not already show you. It is open to every plan tier while it is in Beta.

Requesthttp
GET /v1/search?q=merge&kind=all&project_id=…&from=…&to=…&limit=20&cursor=…
Authorization: Bearer mk_live_…

Parameters

ParameterRule
qRequired. 2 to 200 characters after trimming, at most 8 whitespace-separated terms. Every term must be able to match something, or the request fails with 400 invalid_query.
kindall (default), sessions or events.
project_idOptional. Limits the search to one project.
from, toOptional ISO-8601 dates or date-times, inclusive, on ingest time (server time). The envelope timestamp is asserted by the writer and is not used.
limit1 to 50, default 20.
cursorThe opaque next_cursor from the previous page, for the same query.

Auth works the same way as reading a session.

CallerResult
Browser sessionSearches the session's active org, across all its projects.
Tenant API tokenSearches the token's tenant, across all its projects.
Project-pinned API tokenHeld to its project. project_id=<another> returns 403 project_scope_conflict.
No credential, an unknown key, or a share token (sh_…)401. A public share link reads one chain and never searches.

Requests are rate-limited per org: 429 rate_limited with Retry-After. The default is a burst of 30, then 2 per second.

Matching

Tokenizer. Text is NFKC-normalized and lower-cased, then split on every character outside letters, digits and underscore. Words are 2 to 64 characters long. There is no stemming and no stop-word list, so it works the same for every language and for code, paths and URLs. github.merge indexes as github and merge, and /usr/local/bin as usr, local and bin. Queries use the same tokenizer.

A term matches an event in either of two ways:

  • Word prefix. Each of the term's words is a prefix of an indexed word. merg finds merge, merged and merges.
  • Identifier substring. The whole lower-cased term (3 or more characters) appears inside one of the event's indexed identifiers, such as deploy.promote or sess-demo-2.

Every term must match. There are no operators: no OR, no NOT, no phrases and no regex. A term with no 2-character word that is also under 3 characters can never match anything, so the request is rejected with a 400.

Ranking and its bound

Search takes the newest 1,000 matching events (by ingest time) as candidates and ranks inside that set. truncated: true in the response means more than 1,000 events matched, so older matches were not considered. Use project_id or from / to to narrow the search. The order is:

  1. events where a term is exactly one of the identifiers;
  2. relevance, with matches in a claim statement, intent or message weighted above tool names and results, and those above raw payload text;
  3. newest ingest time;
  4. the event's project, session and sequence number.

The 1,000 cap keeps a query on a large org predictable, because it never sorts the org's whole history. The cap will be raised from production measurements, not by guessing.

What is indexed

Search indexes what the explorer renders for each event, nothing more. Indexed text is capped at 4 KB per event and identifiers at 2 KB. Statement and intent fields are taken first, so a large payload cannot crowd them out.

EventText searched (plus its ids and tool names)
Every record, including withheld onessession and actor ids
Claimthe statement
Decisionthe question (or intent), plus string values in the payload
Actionthe intent, the tool, plus string values in the inputs
Outcomethe result and observed side effects
Observationthe source tool, plus string values in the payload
Evidence setthe item notes
Beliefnothing of its own (the row shows its claim, which is indexed on the claim)
Firewall transitionthe axis, from and to values, and the authority
Sentinel alertthe message, the sentinel name and rule, plus string values in the detail

Never indexed: the envelope's hash, signature, causal parents, clock, versions, schema version and id; the content of a withheld (redacted) record, since Machinaut only holds the redaction marker, so it matches on session and actor ids only; and event types the explorer does not render as chain rows (approval records, quorum records, calibration records and unknown types), which also match on session and actor ids only.

The response

Snippets are lists of plain-text segments, never HTML. Render the match: true runs as marks, as text nodes. Each event hit carries a link into the session explorer. The cursor is bound to the query and pins later pages to the first page's candidate set. With kind=all, the first page returns the top 5 sessions plus one page of events.

Response shapejson
{
  "beta": true,
  "query": { "q": "merge", "kind": "all", "project_id": null, "from": null, "to": null },
  "sessions": [ { "project_id": "…", "session_id": "…", "match_count": 5, "last_ingested_at": "…", "best": { /* an event hit */ } } ],
  "events": [
    { "project_id": "…", "session_id": "…", "seq": 7, "event_type": "action.proposed",
      "stage": "actions", "primitive_id": "…", "field": "intent",
      "snippet": [ { "text": "", "match": false }, { "text": "Merge", "match": true }, { "text": " PR into main", "match": false } ],
      "ingested_at": "…", "link": { "project_id": "…", "session_id": "…", "focus": "…" } }
  ],
  "next_cursor": "…",
  "truncated": false
}

Lifecycle

  • Ingest writes the index columns in the same insert as the event.
  • Rows ingested before search shipped are indexed by a backfill on migration and by a background sweep (every 5 minutes). Until then they do not appear in results.
  • Deleting an event deletes its index entries, including the retention sweep and "Remove sample data".

Planned

These are not built:

  • semantic or vector search;
  • saved searches;
  • cross-org Fleet search;
  • query operators (OR, NOT, phrases) and regex;
  • search over approval holds (the inbox keeps its own filter) and over the audit log;
  • stemming.

Related

Every route is in the API reference. Events reach search through the ingest contract, and the chain it reads is the one the explorer shows.