init_core_memories
Session bootstrap. One call, complete context.
Every conversation starts cold. The AI has no idea who you are, what you're working on, or what preferences you've set. init_core_memories fixes that in a single API call. It loads behavioral preferences, a navigable map of your stored knowledge, active tasks with progress, pending inter-agent signals, workspace paths, and shared collection memberships. The AI calls it once at conversation start and has everything it needs to act like it remembers you.
One Call, Not Ten
The init payload assembles data from six sources in a single database round-trip: behavioral preferences, topic landscape (macro-topics and regular topics with counts), type distribution, active tasks with checkbox progress, pending signals, and workspace paths. The entire session state is front-loaded so the AI can start working immediately — no follow-up calls needed to piece together context.
What Comes Back
The response contains up to 12 fields. Most are conditionally included — the payload stays minimal when there's nothing to show. Here's the full structure:
core_memories
System-level instructions. Always present, always complete. These are the behavioral rules that apply to every session regardless of topic.
total + types
Total memory count and type distribution as a compressed string: "847 fact, 43 decision, 12 task, 28 preference". Gives the AI a sense of corpus shape before it searches.
macros
Macro-topic clusters sorted by depth. Each entry includes a memory count and active task count: gnosis(1501, 3 tasks) magi(476) battlecruisers(312, 1 task). These are the domains the AI can navigate.
topics
Regular topic keywords sorted by recency. Up to 30 topics with counts: recent first sync(12) mcp(149) auth(34) deploy(67). The AI uses these as search terms when it needs specifics.
preferences
Behavioral preferences injected as a pipe-delimited string. Only preferences tagged behavioral are auto-loaded — domain-specific preferences surface through search when topically relevant. Budget-capped at ~500 tokens to avoid bloating every session.
tasks
Active tasks with checkbox progress. Format: [3/7 active] Build OAuth2 login flow. If you have 1–5 tasks, all are shown. If more than 5, the three most recently updated are shown with a count and a pointer to task_feed for the rest.
collections
Display names of every shared collection you belong to. Present only if you have subscriptions. The AI knows which shared namespaces are available without making a separate call.
signals
Pending inter-agent signals in peek mode. The AI sees what's waiting but doesn't consume the signals — consumption requires an explicit signal(action:"ack") call. This prevents signals from being silently cleared in non-agent contexts.
paths
Workspace paths for the current machine. Activated by passing a machine_id parameter (the machine's hostname). If paths exist but no machine_id was provided, the response includes a path_hint telling the AI how to retrieve them.
Preview-Then-Retrieve
Init does not dump your full memories into the context window. It sends compressed previews — each truncated at roughly 50 characters — with a complete flag indicating whether the preview contains the full content or was truncated.
The AI Decides What to Read
When complete is true, the preview contains the entire memory and the AI uses it directly. When complete is false, the preview is a truncated summary. The AI scans all previews, identifies the 2–3 that matter for the current conversation, and calls memory_retrieve to get only those in full. The server never makes that choice — the AI does, because the AI knows what the user is asking about.
Why this matters for token budgets
A typical search returns 32 results. As full content, that could be 3,000–5,000 tokens. As previews, the same 32 results fit in roughly 400 tokens. The AI reads all 32 previews, picks the ones it needs, and retrieves only those. The difference compounds across a session — an AI that makes five searches saves 15,000–25,000 tokens compared to a system that returns full content every time.
Behavioral preferences skip this system entirely. They're always injected in full because they affect every turn regardless of topic. But they're budget-capped (approximately 500 tokens for preferences, 200 for user-tagged facts) so they don't crowd out working context.
Piggybacked Search
init_core_memories accepts an optional query parameter. When provided, the server runs a semantic search alongside the init assembly. The top results come back in the same response — no second tool call, no additional round-trip.
Optional, But Saves a Round-Trip
Most init calls run without a query — the payload itself (preferences, tasks, topics, signals) is all the AI needs to start. The query parameter exists for cases where the AI already knows what the conversation is about and wants to pre-fetch relevant memories in the same call instead of making a separate search afterward.
How the piggybacked search works
The search runs through the same pipeline as memory_search — full vector retrieval, cross-encoder reranking — but with two differences:
- Auto-expansion: The top 3 results with a relevance score of 75 or above are returned with full content, skipping the preview stage. High-confidence matches are immediately usable without a follow-up retrieve call.
Noise filtering prevents the AI from wasting the search on generic queries. If the AI passes something like "general preferences" or "recent memories" (queries composed entirely of meta-words), the search is skipped and the AI is told to use specific topic nouns instead. This catches a common pattern where AI models reflexively search for vague terms on their first turn.
Deduplication removes behavioral preferences that were already injected earlier in the response. If a preference appears in both the auto-loaded preferences and the search results, it shows up once.
The Topic Landscape
The macros and topics fields form a navigable map of the user's entire memory corpus. They serve different purposes.
Macro-Topics: Depth
Up to 20 macro-topics sorted by memory count. These are the domains: project names, technologies, major areas of work. Each includes a count of memories and a count of active tasks. The AI sees gnosis(1501, 3 tasks) and knows this is a deep, actively worked domain.
Topics: Recency
Up to 30 regular topics sorted by when they were last used, not by count. These are the specific keywords: auth, deploy, mcp, redis. Recency sorting means the AI sees what you've been working on lately, not just what has the most history.
How the landscape stays current
Topic counts and recency data are maintained in a pre-computed index that updates as memories are added, edited, or deleted. The init call reads this index directly — it does not scan the full corpus at query time. If the index is missing or corrupted, the system falls back to a live aggregation query and schedules an asynchronous rebuild. The rebuild runs in the background without blocking the init response.
Task counts within macro-topics come from the same index. When a task is created with macro_topics: ["gnosis"], the count increments. When it's marked done, the count decrements. The AI always sees current numbers.
Design Rationale
The init payload was iterated through dozens of permutations to balance actionability, navigability, and compatibility with small models. The result loads a complete session context in a single call without overwhelming the context window.
Tradeoffs and constraints
Several design choices reflect specific constraints:
- Behavioral preferences are always injected; domain preferences are not. A preference like "no preambles" affects every turn. A preference like "use tabs in Python" only matters when writing Python. Injecting every preference would waste tokens in most sessions. Behavioral preferences are identified by a
behavioraltag and budget-capped so they fit regardless of how many exist. - Tasks use adaptive display. Zero tasks: a feature hint pointing to
task_feed. One to five tasks: all shown with progress. More than five: the three most recently updated, plus a count and direction totask_feed. This prevents task-heavy users from having their init response dominated by a task list. - Signals are peek-only. Early versions consumed signals during init, which silently cleared them when init was called in contexts where the AI wasn't going to process them. Peek mode means signals persist until explicitly acknowledged.
- Paths require a machine_id. Workspace paths are machine-specific. Injecting paths for a different machine would confuse the AI. When no
machine_idis provided but paths exist, the response includes a hint telling the AI how to get the hostname and pass it next time. - Collections are resolved to display names. Internally, collections use slug identifiers. The init response resolves these to human-readable display names so the AI can refer to collections by the names the user chose.
Parameters
Both parameters are optional. The simplest invocation is init_core_memories() with no arguments.
machine_id string, optional
Hostname of the current machine. When provided, workspace paths tagged with this identifier are included in the response. AI clients with shell access can obtain this by running hostname. Omit when running without filesystem access.
query string, optional
A search query to run alongside initialization. Results are included in the same response, saving a round-trip. Top 3 results with scores of 75 or above are auto-expanded with full content. The AI extracts relevant nouns and passes them as the query — Gnosis never sees the user's original message, only the search terms the AI chooses to send.
First Session
When a new user calls init_core_memories for the first time, the response is nearly empty — no topics, no preferences, no tasks. Instead, the system injects an onboarding quiz as a task. The AI sees the quiz, walks the user through a series of questions about their work, preferences, and tooling, and stores the answers as structured memories. By the end of the first conversation, the next init call returns a populated landscape.
The quiz is injected once. Subsequent init calls load whatever the user has stored since then. There is no tutorial mode, no special first-run UI — just a task that bootstraps the memory corpus through normal conversation.