<ide_opened_file>The user opened the file [REDACTED]/Desktop/research-project/.env in the IDE. This may or may not be related to the current task.</ide_opened_file>
<pasted_content id="1830">
Use the create-agent-with-sanity-context skill (install it first: npx skills add sanity-io/context --all).
Build a minimal TypeScript Node project that connects an AI agent to my Sanity Context MCP endpoint (Knowledge Base mode).
Step 1 only:
1. Connect and print the list of tools the endpoint serves
2. Run one agent with this question: "Does structured graph memory outperform simple caption memory for long-term video memory? Cite the exact sources and the benchmark, model and subset behind every number."
3. Print the answer and which tools/entries it used
Keep it simple. Do not build the multi-agent council yet.
</pasted_content id="1830">
I'll start by checking the project, then install the skill.
The endpoint works and serves 3 Knowledge Base tools. Next I'll find which @ai-sdk/google major works with ai@6, as you asked, not the latest ai@7.
The pipeline works end to end, but your knowledge base is empty, so the agent had nothing to cite.
src/index.ts: the dropped connection didn't cut it short. The file is complete (93 lines) and typechecks.
What the run showed:
1. Tools: the endpoint serves initial_context, knowledge_base_read and knowledge_base_search.
2. Agent: Gemini (gemini-3.5-flash) ran 5 searches against knowledge base kbeZdQSQKQXx: "graph memory caption memory", "memory", "video", "structured" and "graph". All of them came back empty, so it read no entries.
3. Answer: it said the knowledge base contains nothing on the question and didn't make up numbers, which is the behaviour your instructions ask for.
I checked the raw /initial-context endpoint directly to rule out a bug on my side. It reports:
```
0 entries.
```
Next step for you: add entries to "Evidence Lab: Physical Memory research" in Sanity, such as the papers or notes on graph memory vs. caption memory, then run npm start again. You don't need to change any code.
What's in the project:
- package.json and tsconfig.json. npm start runs the agent with tsx --env-file=.env, so there's no dotenv dependency.
- Packages: ai@6.0.300, @ai-sdk/mcp@1.0.90 and @ai-sdk/google@3.0.130. That Google major is the one that works with ai@6, though the latest ai is 7.
- .gitignore covers .env, and .env.example is a template with placeholder values. No secrets are hardcoded. The Sanity token is sent as Authorization: Bearer <token>.
- As the skill recommends, the code fetches the knowledge base outline once over HTTP and puts it in the system prompt. It then stops passing the initial_context tool to the model, which saves one tool call. All 3 tools are still printed.
- Setting GEMINI_MODEL in .env overrides the model.
The skill also installed .agents/skills/ into the project. Decide whether to commit that or add it to .gitignore. Nothing has been committed yet.
<pasted_content id="1830">
I want every claim the agent makes to be checkable.
Make the agent return its claims as JSON. Each claim should have: the claim itself, its sources (the entry path and the exact quote it relied on), and the benchmark, dataset, model and metric if it mentions a result.
Add a verifier written in plain code, not an LLM. For each claim it should:
Print each claim with a plain label, VERIFIED or REJECTED, and show the proof:
The knowledge base is built now, so run npm start when you're done and show me the output.
</pasted_content id="1830">
I'll look at the knowledge base outline and a sample entry first, so the verifier matches the real entry format.
<ide_opened_file>The user opened the file [REDACTED]/Desktop/research-project/src/verify.ts in the IDE. This may or may not be related to the current task.</ide_opened_file>
<pasted_content id="1830">
Billing isn't available, so I need to stay within the Gemini free tier.
Evidence collection works with no Gemini calls: it picked 5 relevant entries totalling about 32k characters (roughly 8k tokens per agent). Now the full run, 5 Gemini requests:
All five agents are in src/council.ts. They aren't separate files or services: each one is a role prompt sent to the same Gemini model.
The four parallel agents are in the AGENTS list at council.ts:55. Each has a name and a role prompt:
- Researcher A: focuses on direct head-to-head results.
- Researcher B: answers independently and looks for evidence for the opposite conclusion.
- Contradiction Hunter: finds where entries disagree.
- Evidence Auditor: checks that comparisons are like-for-like.
The Judge isn't in that list. Its prompt is written inline at council.ts:150.
The rest of the agent code:
- Output shapes: agentSchema is the format the four agents return, and judgeSchema is the Judge's.
- Shared rules: CLAIM_RULES, just above AGENTS, holds the claim and quote rules added to every agent's prompt.
- Where they run: inside runCouncil. Line 108 sends one generateObject call per agent, all in parallel. The Judge call follows.
- Where it's called: index.ts:62, after the evidence has been collected.
To add an agent or change one's behaviour, edit its name and role in the AGENTS list. It's then included in the parallel calls and the Judge's briefing automatically. Each agent you add costs one more Gemini request per run.