Company Context
Use company_context as the first retrieval step for internal historical context. Its search command queries indexed company memory across enabled sources such as Slack channels, Google Docs (--source docs), Google Calendar, Linear, and user-visible Granola notes (--source granola). It also has dedicated commands for user-visible Slack DMs and DM conversations. Always pair indexed results with the relevant direct source tools, then reconcile and collate both evidence sets before answering.
For aggregation, grouping, joins, or fields that the search surface does not expose, use the scoped read-only SQL command. Database grants and row-level security still apply, and output is capped:
company_context query "SELECT source, count(*) FROM company_context_documents GROUP BY source" --limit 100 --json
Use one row-returning query. The command runs it inside a read-only transaction with a bounded timeout, so writes and multiple statements are rejected. For exact or not-yet-projected Slack results, query company_context_slack_messages and company_context_slack_users. These security-invoker views expose normalized fields while preserving channel RLS; users are limited to authors visible through that scope, and raw payloads remain inaccessible. Bound message queries by channel and/or time when possible:
company_context query "SELECT m.occurred_at, u.display_name, m.text, m.permalink FROM company_context_slack_messages m LEFT JOIN company_context_slack_users u ON u.user_id = m.user_id WHERE m.channel_id = 'CHANNEL_ID' AND m.occurred_at >= now() - interval '7 days' ORDER BY m.occurred_at DESC" --limit 100 --json
When the company-context service is deployed, the preview company_context v2 search and company_context v2 read DOCUMENT_ID commands query its API, which returns only documents visible to the requester: Slack channel days and files, Google Docs and PDFs, Google Calendar events, Granola notes, and custom documents granted to the requester in named sources (such as archives of retired internal tools, notes, and memory). Narrow searches with repeatable --type (slack_message, slack_file, drive_doc, calendar_event, granola_note, custom_doc), --channel-id, --file-id, and --source, with RFC 3339 --after/--before, and, for custom documents, with --metadata '{"KEY": "VALUE"}', which keeps documents whose returned metadata contains that JSON object (exact, case-sensitive values; external_id included); --limit is at most 50 and there is no pagination. The commands report an error when COMPANY_CONTEXT_API_URL is unset, meaning the service is not deployed.
Default Workflow
- Search company context first:
company_context search "QUERY" --limit 10 --json
For DM-specific questions, use the dedicated DM search surface:
company_context search-dms "QUERY" --limit 10 --json
company_context search-dm-conversations "PERSON OR QUERY" --limit 10 --json
- Read promising documents before answering:
company_context read "DOCUMENT_ID" --max-chars 8000 --related --json
- Check live/source tools for the same query and relevant source filters. Do this even when indexed results look strong:
slack search "QUERY"
linear search "QUERY"
gsuite drive list --query "QUERY"
gsuite calendar events --query "QUERY"
Use the source-specific tools that match the question. For broad cross-source questions, check all likely sources.
- For time-sensitive or "latest" asks, check index freshness:
company_context latest-date
company_context latest-date --source slack
company_context latest-date --source docs --source-type google_doc
company_context latest-date --source linear
latest-date always outputs JSON, so it does not accept a --json flag.
- If results are weak, broaden or target source filters:
company_context search "QUERY" --source slack --limit 10 --json
company_context search "QUERY" --source docs --source-type google_doc --limit 10 --json
company_context search "QUERY" --source google_calendar --limit 10 --json
company_context search "QUERY" --source linear --limit 10 --json
company_context search "QUERY" --source granola --limit 10 --json
company_context search-dms "QUERY" --limit 10 --json
- Collate indexed and live results before answering:
- Prefer direct live-tool evidence for current state, exact source objects, and canonical fields.
- Prefer indexed context for historical recall, older discussions, and cross-source semantic matches.
- Treat disagreement as a signal to explain the mismatch, including dates and source links when available.
- Avoid claiming completeness unless the direct source tool or owning API supports that claim.
When To Fall Back
Use extra direct-tool depth after the default indexed-plus-live pass when:
- The user asks for the current Slack thread, a specific Slack channel/message/file, or a direct source object that
company_context did not return.
- The user asks to create, update, comment on, or inspect an exact Linear issue/project.
- The user gives an exact Google Doc, Drive, Calendar, or Linear URL/id.
company_context returns an auth, permission, connection, or malformed-response error.
- The question requires a canonical exhaustive answer. Company context is indexed retrieval; use the owning API/database for definitive inventories or yes/no internal-history claims when the user asks for completeness.
Answering Rules
- Lead with the answer and include the evidence source when it matters: source, source type, date, title, and URL/permalink if present.
- Say how indexed context and live source-tool results agree, differ, or complement each other.
- If freshness matters, use
latest-date to inspect the indexed cutoff and direct source tools for live corroboration.
- Do not copy long private documents or message dumps into the reply. Summarize narrowly and quote only short snippets when useful.
- If no indexed context is found after reasonable query variants, say that plainly and name the live tools checked.