About pma-mem
pma-mem is a project knowledge capture and retrieval skill backed by Memos. It helps agents consult decisions, discoveries, and patterns before implementation, while requiring type tags, duplicate checks, and links between related entries.
Key features
- 01Queries and records knowledge through the Memos API
- 02Classifies entries with five type tags
- 03Checks topicHash duplicates before writing
- 04Links related entries with relations
- 05Provides knowledge cleanup and sync workflows
Use cases
- 01Find prior decisions and patterns before implementation
- 02Record debugging findings or technical choices
- 03Save and link multiple knowledge points
- 04Review duplicate or outdated memos
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ zzci/ skills --skill pma-memAfter installing, type/pma-memin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
agents/openai.yamlreferences/classification.mdstorage-api.mdknowledge-sync.mdDetails
From the project READMEKnowledge Palace
Capture and retrieve project knowledge. Storage backend: Memos ($MEMOS_URL, $MEMOS_TOKEN).
Always-On Rules
- Confirm
$MEMOS_URLand$MEMOS_TOKENbefore any operation. If missing, ask the user. - Every knowledge entry must have a type tag.
- Before writing, always check for duplicates by topicHash.
- One memo = one knowledge point. Never bundle multiple topics into a single memo.
- Related knowledge points must be linked via memo relations (
REFERENCE). - Before implementing: query relevant knowledge first. Check for existing decisions, discoveries, and patterns that may apply to the current task.
When to Query
Agents should query the knowledge base in these situations:
- Hitting an error or unexpected behavior: query
#discovery+ keyword — someone may have seen this before - Making a technical choice: query
#decision+ keyword — check if a decision was already made and why - Implementing a pattern: query
#pattern+ keyword — reuse proven approaches - Verifying an assumption: query
#fact+ keyword — confirm before building on it
Knowledge Types
5 types, flat tags, exactly one per memo:
#fact · #event · #discovery · #decision · #pattern
Additional tags are optional and free-form — agent decides based on content.
Full classification rules, content guidelines, and quality checks: see references/classification.md.
Memo Format
## {title}
{content — preserve context and reasoning, not just the conclusion}
#fact
<!-- {topicHash} from:{origin} -->
- Bottom comment is metadata:
topicHash(dedup key, first 8 chars of md5(title)) +from:(knowledge origin, e.g.session,bkd/issueId,manual) - Tags go in content body, not in metadata
Operations
Write
AUTH="Authorization: Bearer $MEMOS_TOKEN"
API="$MEMOS_URL/api/v1"
# 1. Check duplicate by topicHash
HASH=$(echo -n "Title here" | md5sum | cut -c1-8)
EXISTS=$(curl -s -H "$AUTH" \
"$API/memos?filter=content.contains(\"$HASH\")" \
| jq '.memos | length')
# 2. Create (if not exists)
curl -s -X POST -H "$AUTH" -H 'Content-Type: application/json' \
"$API/memos" \
-d '{"content":"## Title\n\nContent\n\n#fact\n\n<!-- '"$HASH"' from:session -->","visibility":"PRIVATE"}' | jq
# 3. Update (if exists and changed)
curl -s -X PATCH -H "$AUTH" -H 'Content-Type: application/json' \
"$API/memos/{uid}?updateMask=content" \
-d '{"content":"...updated..."}' | jq
# 4. Link related memos
curl -s -X PATCH -H "$AUTH" -H 'Content-Type: application/json' \
"$API/memos/{uid}/relations" \
-d '{"relations":[{"relatedMemo":"memos/{otherUid}","type":"REFERENCE"}]}' | jq
Query
Use queries to retrieve knowledge before acting. Return content to the agent context.
# By type
curl -s -H "$AUTH" "$API/memos?filter=tag+in+[\"discovery\"]" \
| jq '.memos[]|{uid,snippet}'
# By type + keyword
curl -s -H "$AUTH" "$API/memos?filter=tag+in+[\"decision\"]" \
| jq '.memos[]|.content' | grep -i "keyword"
# Full-text search
curl -s -H "$AUTH" \
"$API/memos?filter=content.contains(\"keyword\")" \
| jq '.memos[]|{uid,snippet}'
# Get full content
curl -s -H "$AUTH" "$API/memos/{uid}" | jq '.content'
# Follow links
curl -s -H "$AUTH" "$API/memos/{uid}/relations" \
| jq '.relations[].relatedMemo'
Capture
During a conversation, when the user says "remember this" / "save this" / "store this", or when the agent identifies knowledge worth preserving:
- Extract one or more knowledge points from the current conversation
- For each point, assign type + tags, generate topicHash
- Dedup → create/update → link if multiple points
The agent should also proactively suggest capturing when it encounters:
- A non-obvious technical fact confirmed through debugging
- A decision made after weighing alternatives
- A gotcha or pitfall discovered during implementation
- A reusable pattern or workflow that worked well
Consolidate
On-demand: user asks to clean up or the agent notices overlapping memos during a query.
- Load a tag group:
curl -s -H "$AUTH" "$API/memos?filter=tag+in+[\"auth\"]&pageSize=100" | jq - Review for near-duplicates, superseded facts, or fragments
- Merge into one memo, archive originals — see
references/knowledge-sync.mdfor details
Reference Packs
references/classification.mdType definitions, content guidelines, tagging rules, quality checks, consolidation rules.references/storage-api.mdMemos REST API reference (CRUD, filters, relations, pagination, attachments).references/knowledge-sync.mdAutomated sync workflow: scanning, extraction, dedup, incremental update, automation guide.
Quick Routing
- Classifying or formatting knowledge: load
references/classification.md. - API details (updateMask, filters, error codes): load
references/storage-api.md. - Automated sync from task systems: load
references/knowledge-sync.md. - Simple capture or query: use operations above directly.