Token导航 LogoToken导航TokenDH.com
研究检索敏感数据clawhub未标认证来源可访问clear审计通过

memicmemic 文档

Agent Skill

memic 用于查找、检索和筛选相关信息,适合在 OpenClaw 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

11,236

周安装

459

GitHub Stars

2

下载量

3,599
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:memic(memic 文档)
来源仓库:https://github.com/punithg/memic
安装命令:
openclaw skills install memic
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install memic

简介

memic 是 AI 代理的上下文工程平台,支持文档上传与语义检索。

  • 可将相关上下文注入 LLM 提示,提升回答准确性。
  • 兼容多种文件格式,支持结构化与非结构化查询。
  • 嵌入模型选择影响召回质量,需根据任务调整参数。
  • 建议限制单次注入内容长度以避免上下文溢出。memic 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

name
memic-sdk
version
0.3.0
description
Context engineering platform for AI agents. Upload documents, search with semantic + structured queries, and inject relevant context into LLM prompts. Supports RAG, Text2SQL, hybrid search, metadata filters, and multi-tenant isolation. Use this skill to integrate Memic into any AI agent, copilot, or application that needs grounded context from documents and databases.
homepage
https://app.memic.ai
metadata
openclaw
emoji
🧠
primaryEnv
MEMIC_API_KEY
requires
env
bins

Memic — Context Engineering SDK

What is Memic?

Memic is a managed context engineering platform. Instead of stuffing raw documents into your LLM's context window (expensive, slow, hits token limits), Memic handles the entire pipeline — document ingestion, chunking, embedding, vector storage — and gives you a single search API that returns only the relevant pieces. It also supports Text2SQL for structured databases, so one API covers both documents and databases.

The problem it solves: AI agents and LLM apps need grounded context from real data. Without Memic, you'd build and maintain your own chunking pipeline, embedding infrastructure, vector database, and query routing. Memic does all of this as a service — upload files, search with one API call, get back ranked chunks with source attribution.

Key capabilities:

  • Document search (RAG) — Upload PDFs, DOCX, PPTX, TXT, etc. Memic chunks, embeds, and indexes them. Search returns ranked content with file name, page number, and relevance score.
  • Database search (Text2SQL) — Connect PostgreSQL/MySQL. Ask natural language questions, get SQL-generated results back.
  • Hybrid search — Single API auto-routes queries to the right source (documents, database, or both).
  • Multi-tenant isolation — Each API key is scoped to an org/project/environment. No data leaks between tenants.
  • Metadata filters — Filter by reference ID, page range, category, document type.

Your API key auto-resolves all context (org, project, environment) — no IDs needed in API calls.

Coming soon:

  • MCP server — Native Model Context Protocol integration so AI agents (OpenClaw, Claude Code, etc.) can call Memic as a tool directly.
  • Context compaction — Upload raw agent session logs or MEMORY.md files. Memic summarizes, compresses, and indexes them so agents can retrieve past context without re-loading full session history.
  • Bulk context injection — Ingest entire knowledge bases (session JSONL, chat logs, wiki exports) in one call. Memic auto-chunks and indexes for instant search.

When to use this skill: Setting up Memic SDK, uploading documents, searching for context, building RAG pipelines, connecting databases for Text2SQL, debugging integration issues, or reducing LLM token costs by replacing raw context with targeted search.

Quick Start

pip install memic
export MEMIC_API_KEY=mk_your_key_here
from memic import Memic

client = Memic()  # API key auto-resolves org/project/environment

# Upload a document
file = client.upload_file("/path/to/doc.pdf")

# Search — returns only the relevant chunks, not the whole document
results = client.search(query="What are the key findings?", top_k=5)
for r in results:
    print(f"[{r.score:.2f}] {r.file_name} p{r.page_number}: {r.content[:100]}")

First: Understand the Use Case

Ask the developer two questions:

Question 1: Integration Pattern

"How are you planning to use Memic?"

  1. Context tool for an AI agent — Memic provides RAG context for an LLM agent (chatbot, copilot, assistant)
  2. Deterministic service — Direct search API in your app (no LLM involved)

Question 2: Data Source

"What type of data will you be searching?"

  1. Unstructured (Documents) — PDFs, Word docs, text files → semantic vector search
  2. Structured (Databases) — PostgreSQL/MySQL → natural language to SQL
  3. Hybrid — Both document search and database queries via a single API

Prerequisites

  • Python 3.8+
  • A Memic account at https://app.memic.ai
  • An API key (starts with mk_...)

Step 1: Get API Key

  1. Go to https://app.memic.ai → Dashboard → API Keys
  2. Click "Create API Key"
  3. Copy the key

Important: Each API key is scoped to an organization + project + environment. The SDK auto-resolves this context — you never need to pass IDs.

Step 2: Install & Configure

pip install memic
# .env file
MEMIC_API_KEY=mk_your_api_key_here

Step 3: Verify Setup

from memic import Memic

client = Memic()

# Check what your API key resolves to
print(f"Org: {client.org_id}")
print(f"Project: {client.project_id}")
print(f"Environment: {client.environment_slug}")

# List projects in your org
projects = client.list_projects()
for p in projects:
    print(f"  - {p.name} ({p.id})")

If No Data Found

For documents: Upload via dashboard (https://app.memic.ai → Project → Upload) or SDK (see below).

For databases: Go to https://app.memic.ai → Connectors → Add Connector. Enter your PostgreSQL/MySQL connection details.

Core API Reference

Upload Files

# Upload and wait for processing to complete
file = client.upload_file(
    file_path="/path/to/document.pdf",
    reference_id="lesson_123",       # optional — for external system linking
    metadata={"category": "legal"},  # optional — custom key-value pairs
)
print(f"ID: {file.id}, Status: {file.status}")  # status = "ready" when done

Supported formats: PDF, DOCX, DOC, PPTX, XLSX, TXT, MD, HTML, and more.

Check File Status

file = client.get_file_status(file_id="...")
print(f"Status: {file.status}")
print(f"Processing: {file.status.is_processing}")
print(f"Failed: {file.status.is_failed}")
print(f"Chunks: {file.total_chunks}")

Search Documents (Semantic)

results = client.search(
    query="What are the key findings?",
    top_k=10,
    min_score=0.7,
)

print(f"Found {results.total_results} results in {results.search_time_ms}ms")
for r in results:
    print(f"[{r.score:.2f}] {r.file_name} p{r.page_number}: {r.content[:150]}")

Search with Metadata Filters

from memic import MetadataFilters, PageRange

results = client.search(
    query="contract terms",
    top_k=5,
    filters=MetadataFilters(
        reference_id="contract_2024",              # filter by reference
        page_range=PageRange(gte=1, lte=20),       # pages 1-20 only
        category="legal",                          # by category
    )
)

Available filters:

  • reference_id / reference_ids — match file reference IDs
  • page_number / page_numbers — exact page match
  • page_range — page range with gte/lte
  • category — filter by category
  • document_type — filter by document type

Search with File Scoping

# Search only within specific files
results = client.search(
    query="revenue figures",
    file_ids=["file-id-1", "file-id-2"],
    top_k=5,
)

Hybrid Search (Documents + Databases)

When you have both documents and database connectors configured, Memic auto-routes queries:

results = client.search(query="Show me top customers by revenue")

# Check how the query was routed
if results.routing:
    print(f"Route: {results.routing.route}")        # "semantic", "structured", or "hybrid"
    print(f"Reason: {results.routing.reasoning}")

# Document results
if results.has_documents:
    for r in results.results.semantic:
        print(f"[Doc] {r.file_name}: {r.content[:100]}")

# Database results (Text2SQL)
if results.has_structured:
    print(f"SQL: {results.routing.sql_generated}")
    for row in results.results.structured.rows:
        print(f"[DB] {row}")

Chat (RAG with built-in LLM)

response = client._request(
    "POST", "/sdk/chat",
    json={"question": "What are the Q4 results?", "top_k": 5, "min_score": 0.5}
)
print(response["answer"])
print(f"Citations: {response['citations']}")
print(f"Model: {response['model']}")

Integration Patterns

Pattern A: Context Tool for AI Agent

Use Memic to inject grounded context into your LLM:

from memic import Memic
from openai import OpenAI  # or anthropic, etc.

memic = Memic()
llm = OpenAI()

def ask_with_context(question: str) -> str:
    # 1. Get relevant context from Memic
    results = memic.search(query=question, top_k=5, min_score=0.6)

    # 2. Format as LLM context
    context = "\
\
".join([
        f"[Source: {r.file_name}, Page {r.page_number}]\
{r.content}"
        for r in results
    ])

    # 3. Generate grounded response
    response = llm.chat.completions.create(
        model="gpt-4o",
        messages=[
            {"role": "system", "content": f"Answer based on this context:\
\
{context}"},
            {"role": "user", "content": question}
        ]
    )
    return response.choices[0].message.content

answer = ask_with_context("What are the key contract terms?")

Pattern B: OpenClaw / AI Agent Context Optimization

Replace expensive raw-context loading with targeted search to cut token costs:

from memic import Memic

memic = Memic()

# Instead of loading entire documents into context (thousands of tokens),
# search for just the relevant chunks (hundreds of tokens)
results = memic.search(query=user_question, top_k=3, min_score=0.7)

# Only inject what's relevant — typically 90%+ token savings vs raw context
context = "\
".join([r.content for r in results])

Pattern C: Deterministic Search API

Direct integration for app search functionality:

from memic import Memic, MetadataFilters

memic = Memic()

def search_documents(query: str, category: str = None) -> dict:
    filters = MetadataFilters(category=category) if category else None

    results = memic.search(
        query=query,
        top_k=10,
        min_score=0.5,
        filters=filters,
    )

    return {
        "results": [
            {
                "title": r.file_name,
                "snippet": r.content[:300],
                "page": r.page_number,
                "score": r.score,
            }
            for r in results
        ],
        "total": results.total_results,
    }

Debugging

IssueSolution
AuthenticationErrorCheck MEMIC_API_KEY is set and valid
NotFoundErrorAPI key may be scoped to wrong project
Empty resultsCheck files are uploaded and status is READY
Low scoresLower min_score or rephrase query
Timeout on uploadLarge files take longer; increase poll_timeout

Exception Handling

from memic import MemicError, AuthenticationError, NotFoundError, APIError

try:
    results = client.search(query="test")
except AuthenticationError:
    print("Invalid or expired API key")
except NotFoundError:
    print("Resource not found")
except APIError as e:
    print(f"API error {e.status_code}: {e.message}")
except MemicError as e:
    print(f"SDK error: {e}")

Resources

  • SDK: pip install memic | https://pypi.org/project/memic/
  • Dashboard: https://app.memic.ai
  • GitHub: https://github.com/memic-ai/memic-python

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

94.51%
按下载量换算3,401

安全审计

VirusTotal

通过

ClawScan

通过

Static analysis

未展示

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills