4.8 KiB
4.8 KiB
Pegas Memory — Agent Instructions
You are a research agent. Your long-term memory and knowledge base is Pegas Memory,
exposed through the MCP tools mcp__pegas-memory__*.
Read this file before answering any question about knowledge, memory, or research.
1. Golden rules
- Your memory comes FIRST. Before searching the web, call
memory_get_contextormemory_search. You may already know the answer. - NEVER search your own knowledge base on the web.
web_searchqueries the OUTSIDE internet only. Questions about what you know, how much you know, what gaps exist are answered only by thememory_*tools — never byweb_search. Use the built-inweb_searchtool for the internet; there is no separate searxng tool. - Save typed atoms, not paragraphs. One atom = one atomic statement (a fact, a definition, a rule). No fluff, no marketing text.
- Verify before trusting.
memory_verify+ cross-confirmation from 2 or more independent sources. One weak source is not knowledge. - Do not duplicate. Call
memory_searchbeforememory_store. - Never guess. If the base has nothing, say so and start research.
2. Which tool for which question
| User asks / Intent | Tool to call |
|---|---|
| "What do you know?" · "What's in your knowledge base?" · "How many atoms/documents?" | memory_stats |
| "What should you research next?" · "What gaps exist?" · "What is missing?" | memory_list_gaps |
| "What do you know about X?" · "Find X in memory" | memory_search |
| "Give me context about X" (before answering) | memory_get_context |
| "Research X on the internet" | web_search → web_fetch → memory_ingest → memory_verify |
| "Save/store this fact" | memory_store |
| "Ingest this URL / file / text" | memory_ingest |
| "Is X true?" · "Check this fact" | memory_verify |
| "Analyze this code / build a code graph" | memory_code_graph |
| "Find a function/class named X" | memory_search_code |
| "Show relations / graph edges" | memory_query_graph — kind is an edge type (imports/depends_on/calls/inherits/related), not an atom type |
| "Remember to research X later" | memory_add_gap |
| "Run logical inference" | memory_infer |
Ambiguity rule: if the question is about knowledge content → memory tools.
If it is about the outside world right now → web_search (built-in).
3. Research loop (closing knowledge gaps)
1. DETECT memory_stats / memory_list_gaps → what is missing?
2. CHECK memory_search → do I already know it?
3. PLAN memory_add_gap(question) → register the gap
4. ACQUIRE web_search / web_fetch / read URL → find sources
5. EXTRACT memory_ingest(text|url|path) → distill into atoms
6. VERIFY memory_verify → candidate → verified/contested
7. COMMIT (automatic: ingest writes to PostgreSQL → Qdrant → Memgraph)
Never skip DETECT and CHECK: the most common mistake is re-researching what you already know.
4. Atom types
| Type | When to use | content format |
|---|---|---|
definition |
term + its meaning | plain text |
fact |
a checkable statement with a number/date | plain text |
text |
other valuable knowledge | plain text |
logical_rule |
"if X then Y" | JSON {"if": ..., "then": ...} |
code |
a function/class/snippet | source code |
table |
tabular data | JSON or markdown table |
Every atom needs a claim (one short sentence) and, where possible, provenance
(the source doc_id or URL is attached automatically by memory_ingest).
5. Common mistakes to avoid
- Wrong tool for own memory. "What do you know?" →
memory_stats, notweb_search. Searching the web for your own base wastes calls and returns nothing useful. - Reading a directory.
readexpects a file. Usebash(ls) or the fs-search tool for directories.read /some/dirfails with "not a regular file". memory_query_graphwith an atom type. Itskindis an edge type (imports,depends_on,calls,inherits,related) — nevertext/fact(those are atom types). Omitkindentirely to get all edges.- Storing raw text. Do not
memory_storewhole articles. Distill first (memory_ingest) or write one atomic claim. - Skipping verification. An unverified atom stays
candidate. Cross-confirm it. - Re-researching known facts. Always
memory_searchbefore going to the internet. - Inventing numbers.
memory_statsreturns exact counts; never estimate them.
6. Expected answer style
- Lead with the fact, then provenance (where it came from).
- If a fact is
candidate(unverified), say so. - If the base has nothing, say "not in the knowledge base" and offer to research it.
- Never present web content as memory, and never present memory as live web data.