Logo Persona Knowledge

Persona Knowledge

Tổ chức
acnlabs
persona-knowledge

Persistent, incremental, searchable persona knowledge base. Ingests data from Obsidian vaults, chat exports, X/Twitter archives, and more into a MemPalace-backed store with a Karpathy LLM Wiki knowledge layer. Exports training/ directories for persona-model-trainer.

Add to TypingMind

Tổng quan

Nhà phát hànhacnlabs
Kho mãOpenPersona
Tên kỹ năngpersona-knowledge
Sao
56
Bản fork
5
Tệp đi kèm
14
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 14 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được acnlabs công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Persona Knowledge trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/acnlabs/OpenPersona/tree/main/skills/persona-knowledge
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/acnlabs/OpenPersona.git /tmp/OpenPersona
mkdir -p .claude/skills
cp -r /tmp/OpenPersona/skills/persona-knowledge .claude/skills/persona-knowledge
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Persona Knowledge trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Persona Knowledge ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Persona Knowledge với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

persona-knowledge

Persistent, incremental, searchable persona knowledge base — the data layer between raw sources and persona training.

Architecture: MemPalace (storage + search) + Knowledge Graph (relationships + timeline) + Karpathy LLM Wiki (knowledge accumulation)

Dependency chain: data sources → persona-knowledge → anyone-skill / persona-model-trainer


When to use this skill

Trigger phrases:

  • "create a dataset for this persona"
  • "add data to the dataset"
  • "import my Obsidian vault"
  • "import my Twitter archive"
  • "build a knowledge base for X"
  • "export training data"
  • "search the persona dataset"

Not suitable when:

  • User wants a quick one-shot distillation without persistent storage (use anyone-skill alone)
  • User only has < 50 messages of data (too little to warrant a dataset)

Phase 1: Init

Create a new persona dataset:

bash
python scripts/init_knowledge.py --slug {slug} --name "Display Name"

This creates ~/.openpersona/knowledge/{slug}/ with:

~/.openpersona/knowledge/{slug}/
  dataset.json                 # metadata: slug, name, created_at, stats
  .mempalace/                  # MemPalace local data (per-dataset isolation via palace_path)
    palace/                    # MemPalace internal store (ChromaDB + KG)
  sources/                     # immutable source file backups
    .source-index.json         # per-file metadata: hash, import time, line count, PII flags
  wiki/                        # Karpathy wiki (LLM-maintained derived artifact)
    _schema.md                 # wiki maintenance rules
    identity.md
    voice.md
    values.md
    thinking.md
    relationships.md           # generated from Knowledge Graph
    timeline.md                # generated from Knowledge Graph
    _contradictions.md
    _changelog.md
    _evidence.md

MemPalace palace structure:

  • One Wing per persona (named by slug)
  • Halls mapped to 5 persona dimensions:
    • hall_facts — Identity (background, career, education)
    • hall_events — Memory (key events, turning points)
    • hall_preferences — Personality (values, preferences, boundaries)
    • hall_discoveries — Procedure (mental models, decision heuristics)
    • hall_voice — Interaction (vocabulary, rhythm, humor, emotional temperature)

Gate: Confirm slug and display name with the user before proceeding.


Phase 2: Ingest

Import data sources into the dataset. Can be called multiple times for incremental ingestion.

bash
python scripts/ingest.py --slug {slug} --source <path> [--adapter <name>] [--since <date>]

Three adapters cover all supported formats:

SourceAdapterDetection
Obsidian vaultuniversalDirectory containing .obsidian/ or *.md files
GBrain export diruniversalMarkdown directory with .raw/ sidecar dirs
.md / .txt / .csv / .pdfuniversalFile extension
.jsonl / .jsonuniversalFile extension
GBrain JSON exportuniversal.json with memories key or --entity flag
WhatsApp .txt exportchat_exportMatches WhatsApp timestamp pattern
Telegram result.jsonchat_exportJSON with chats key
Signal exportchat_exportJSON with Signal message format
iMessage .dbchat_exportSQLite with message + handle tables
X (Twitter) archivesocialDirectory containing data/tweets.js
Instagram archivesocialDirectory containing content/posts_1.json

Ingest pipeline (per source):

  1. Parse — adapter converts source to unified [{role, content, timestamp, source_file, source_type}]
  2. PII scan — flag SSN, credit card, email, password patterns
  3. Hash dedup — SHA-256 content hash, skip already-ingested entries
  4. Write sources/ — save parsed data as JSONL backup (immutable, one file per source)
  5. Store in MemPalace — verbatim text into ChromaDB via palace wing/hall structure
  6. Extract KG triples — detect entities and relationships, write to Knowledge Graph with temporal validity
  7. Report — print source name, message count, assistant turns, PII flags, new KG entities

After each source is ingested, report:

✅ whatsapp-2024.txt → 1,247 messages (892 assistant turns)
   PII: none detected
   KG: +3 entities, +7 relationships
   → sources/whatsapp-2024.jsonl

Phase 3: Wiki Build (agent task — not a script)

After ingesting new data, the agent reads MemPalace content and Knowledge Graph relationships, then builds or updates the wiki pages following the Karpathy LLM Wiki pattern.

This phase is driven by agent intelligence (SKILL.md instructions), not by automated scripts. The LLM decides which pages to update, how to phrase entries, and how to tag evidence.

Ingest operation (after each Phase 2 run)

  1. Read new data from MemPalace (search the wing for recently added entries)
  2. For each relevant wiki page, check if the new data adds, contradicts, or refines existing content
  3. Update 5-15 wiki pages with new information, using evidence tags:
    • [L1:source] — direct quote, traceable
    • [L2] — reported/paraphrased, verifiable
    • [L3:inferred] — reasonably inferred from multiple signals
    • [L4:inspired] — impression-based
  4. Add backlinks between related pages using [[page]] wikilink syntax
  5. Record contradictions in _contradictions.md with both sides cited
  6. Append entry to _changelog.md
  7. Update counts in _evidence.md

Query operation

When the user asks a question about the persona:

  1. Search MemPalace semantically for relevant memories
  2. Navigate wiki pages for structured knowledge
  3. Synthesize an answer
  4. If the query reveals new insights, write them back to the appropriate wiki page

Lint operation

Run periodically or before export:

bash
python scripts/lint_wiki.py --slug {slug}

Checks:

  • Broken [[links]] (referenced page doesn't exist)
  • Empty pages (created but never populated)
  • Contradictions without resolution notes
  • Evidence coverage (pages with < 2 evidence tags)
  • Source coverage (MemPalace entries not reflected in any wiki page)

Wiki page structure (see references/wiki-schema.md for full spec)

Each page follows this template:

markdown
# {Page Title}

> One-sentence summary of this page's scope.

## Content

{Structured content with [L?:source] evidence tags and [[backlinks]]}

## Sources

- {source_file}: {what was extracted} [L?]

## See also

- [[related_page]]

Knowledge Graph–driven pages

relationships.md and timeline.md are generated from the Knowledge Graph, not written freehand:

python
from mempalace.knowledge_graph import KnowledgeGraph
kg = KnowledgeGraph(palace_path)
kg.timeline(slug)           # → chronological event list for timeline.md
kg.query_entity(slug)       # → current relationships for relationships.md

After generating, the agent may annotate with evidence tags and additional context.


Phase 4: Export

Generate a training/ directory compatible with persona-model-trainer:

bash
python scripts/export_training.py --slug {slug} --output training/

Each export is automatically versioned (v1, v2, …). Override with --version:

bash
python scripts/export_training.py --slug {slug} --output training/ --version v3

List export history:

bash
python scripts/export_training.py --slug {slug} --list
# v1  2026-04-01 10:00  142 turns  sha256:a3f9c2d1  3 sources
# v2  2026-04-10 14:22  198 turns  sha256:c7d2e1f3  4 sources

Output:

training/
  raw/                      # copied from sources/ (authentic voice, unmodified)
  conversations.jsonl       # generated from wiki pages (structured Q-A pairs)
  profile.md                # summarized from wiki identity/voice/values
  metadata.json             # slug, source count, turn count, export version + hash

How each file is built:

  • training/raw/ — direct copy of sources/*.jsonl and sources/*.txt files
  • training/conversations.jsonl — the agent reads wiki pages and generates distilled user/assistant turn pairs representing the persona's voice, knowledge, and values
  • training/profile.md — 300-500 word character sheet derived from identity.md, voice.md, values.md
  • training/metadata.json — slug, name, subject_type, created_at, source_count, total_words, distilled_turns, raw_files + versioning fields:
    • export_version — version tag (e.g. "v2")
    • export_hash — SHA-256 of conversations.jsonl (e.g. "sha256:c7d2e1f3...")
    • source_snapshot — {filename: sha256_hash} dict of all source files at export time

Export history is appended to dataset.json → export_history[] after each run.

Downstream traceability: persona-model-trainer's pipeline.sh reads export_version and export_hash from metadata.json and injects them as dataset_version / dataset_export_hash into training_summary.json, forming a complete provenance chain from source data to trained model adapter.

This output is directly consumable by persona-model-trainer's prepare_data.py — no changes needed downstream.

→ Next step — train a local persona model:

bash
bash skills/persona-model-trainer/scripts/pipeline.sh \
  --slug {slug} \
  --model google/gemma-4-E4B-it \
  --source ./training \
  --method mlx \       # or: unsloth (NVIDIA GPU) / colab (no GPU)
  --preset gemma4 \
  --probes ./training/probes.json

Full guide: persona-model-trainer/references/pipeline-guide.md


Phase 5: Search

Query the dataset using MemPalace's semantic search and Knowledge Graph:

bash
# Semantic search across all stored memories
mempalace search "how does this person handle conflict" --wing {slug}

# Knowledge Graph: look up an entity's relationships
python scripts/query_kg.py --slug {slug} --entity "Tom"

# Knowledge Graph: shortest path between two entities
python scripts/query_kg.py --slug {slug} --path "Tom" "Alice"

# Knowledge Graph: overall statistics
python scripts/query_kg.py --slug {slug} --stats

# Knowledge Graph: JSON output (for programmatic use)
python scripts/query_kg.py --slug {slug} --entity "Tom" --json

# Wake-up summary (~170 tokens)
mempalace wake-up --wing {slug}

The agent can also search programmatically during wiki build or distillation:

python
from mempalace.searcher import search_memories
results = search_memories("vocabulary patterns", palace_path="~/.openpersona/knowledge/{slug}/.mempalace/palace")

Phase 6: Maintain

Ongoing dataset management:

  • Add new source: run Phase 2 (Ingest) again with new files → triggers wiki update
  • Remove source: delete from sources/ + re-index → run wiki lint to flag orphaned content
  • Wiki lint: python scripts/lint_wiki.py --slug {slug} — health check
  • Dataset stats: python scripts/init_knowledge.py --slug {slug} --stats — show current stats
  • List datasets: ls ~/.openpersona/knowledge/ — all available datasets

Tools

ToolPurpose
BashRun init, ingest, export, lint scripts; MemPalace CLI commands
ReadLoad source files, wiki pages, dataset.json
WriteUpdate wiki pages, write training exports
WebSearchFetch public figure data for ingestion

Scripts

ScriptPurpose
scripts/init_knowledge.pyInitialize knowledge directory + MemPalace wing + KG
scripts/ingest.pyUnified ingestion: adapter dispatch + PII scan + dedup + MemPalace + KG
scripts/export_training.pyExport sources/ + wiki → training/ directory
scripts/lint_wiki.pyWiki health check: broken links, contradictions, coverage gaps
scripts/query_kg.pyKnowledge Graph query: entity lookup, shortest path, statistics

Adapters

AdapterSourcesFormat
universalObsidian vault, GBrain export, .md, .txt, .csv, .pdf, .jsonl, .jsonAll pure file reading
chat_exportWhatsApp / Telegram / Signal / iMessage.txt / JSON / SQLite (special parsing)
socialX (Twitter) / Instagram archiveJS wrapper stripping + archive dirs

References

  • references/wiki-schema.md — Karpathy wiki structure specification and maintenance rules
  • references/source-formats.md — supported data source formats and adapter details

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Persona Knowledge làm được gì?

Persistent, incremental, searchable persona knowledge base. Ingests data from Obsidian vaults, chat exports, X/Twitter archives, and more into a MemPalace-backed store with a Karpathy LLM Wiki knowledge layer. Exports training/ directories for persona-model-trainer.

Vì sao nên dùng Persona Knowledge trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Persona Knowledge là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Persona Knowledge trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/acnlabs/OpenPersona/tree/main/skills/persona-knowledge. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Persona Knowledge?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Persona Knowledge với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Persona Knowledge với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Persona Knowledge có miễn phí không?

Có. Kỹ năng này được acnlabs phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇