← Receivers

rag:search

rag family

Search the OO-Brain knowledge corpus (Supabase pgvector). Hybrid retrieval: vector cosine + tsvector BM25 fused with RRF. Returns top-k chunks + a query_id. Always follow with rag:mark to close the quality loop.

Effect
ask
Awaits an outcome — the call returns the response below.
Caller
read_corpus
The class of authority the caller must already hold, decided from the attested context with no round trip.
Cost
1 credits
What one call costs, so you can budget before acting.
Reversible
no
This cannot be undone. Dry-run it first where the contract allows.
Idempotent
yes
Safe to retry as-is.

Send it with your agent

One click hands your coding agent a prompt that registers the substrate, reads this contract, and makes the call. Launch opens the app; the others copy the prompt.

Claude Code
Codex
Cursor
Gemini CLI
Claude Desktop
ChatGPT
curl -X POST https://one.ie/api/ask/rag:search \
  -H "Authorization: Bearer $ONE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"data": { "query": <string> }}'

The key is never in a link. npx -y @oneie/cli login writes it to ~/.config/oneie/key on your machine.

Request

Validated before dispatch — an invalid payload is refused with the fix, never half-applied.

  • query string required Natural-language query. Full sentence beats keywords.
  • k number optional Chunks to return (1–20, default 5).
  • corpus string optional Which imported brain (@-pointer, e.g. '@oo-brain'). Authority-walked against your workspace; omit for the platform default.
  • vault oo-brain | agency-operator | personal-brain | all optional
  • filter_path_prefix string optional
  • filter_tags string[] optional

Response

What comes back from the call.

  • ok boolean
  • query_id string | null UUID to pass to rag:mark. Null when no chunks matched.
  • chunks object[]
  • query string
  • vault string

Traffic

Every call to rag:search, counted where it is dispatched — over HTTP or in-process alike. Aggregate only — no actor, no payload, no workspace.

Counting…

Wiring

Every place in the open source that names rag:search, and the file that answers it. Read from the tree at build time — a receiver is reached by NAME through one door, so there is no import edge to follow and a grep is the honest shape of the question. Structure, not volume — the count is in Traffic above.

Called from

API route 1
  • one.ie/web/src/lib/context-pack.ts:161
Agent runtime 1
  • channels/src/pipeline.ts:315

Answered by

rag:search one.ie/web/src/lib/resolvers/rag.ts:487 Dispatched through POST /api/ask/rag:search, after the envelope validates the payload.
JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "query": {
      "type": "string",
      "description": "Natural-language query. Full sentence beats keywords."
    },
    "k": {
      "default": 5,
      "description": "Chunks to return (1–20, default 5).",
      "type": "integer",
      "minimum": 1,
      "maximum": 20
    },
    "corpus": {
      "default": "@oo-brain",
      "description": "Which imported brain (@-pointer, e.g. '@oo-brain'). Authority-walked against your workspace; omit for the platform default.",
      "type": "string"
    },
    "vault": {
      "default": "all",
      "type": "string",
      "enum": [
        "oo-brain",
        "agency-operator",
        "personal-brain",
        "all"
      ]
    },
    "filter_path_prefix": {
      "type": "string"
    },
    "filter_tags": {
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "required": [
    "query"
  ]
}
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "ok": {
      "type": "boolean"
    },
    "query_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "UUID to pass to rag:mark. Null when no chunks matched."
    },
    "chunks": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "vault_name": {
            "type": "string"
          },
          "file_path": {
            "type": "string"
          },
          "chunk_content": {
            "type": "string"
          },
          "contextual_blurb": {
            "type": "string"
          },
          "rrf_score": {
            "type": "number"
          },
          "frontmatter": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          }
        },
        "required": [
          "vault_name",
          "file_path",
          "chunk_content"
        ]
      }
    },
    "query": {
      "type": "string"
    },
    "vault": {
      "type": "string"
    }
  },
  "required": [
    "ok",
    "query_id",
    "chunks",
    "query",
    "vault"
  ]
}