360 Secure SkillHub
360 安全技能中心

Knowledge Graph Update

核心功能:每日UTC6点自动(支持手动触发)处理近24小时清理后会话记录,按用户、产品、人脉等领域分类,运用演绎/归纳/溯因推理更新对应上下文文件,生成可验证预测与变更日志。典型场景:每日同步会话中的行为偏好、策略信息、人脉动态等,构建动态知识图谱。输入为清理后的会话文件,输出为更新后的多领域上下文文件及变更记录。

h-mascot
h-mascot
热度 24.86
最近更新 2026-06-04 00:17:25
分类:知识依赖:代码执行 / 读写文件 / 内部调用大模型应用场景:数据处理 / 自动化脚本 / 摘要总结 / 笔记整理

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add ec-knowledge-graph
Metadata
name
knowledge-graph-update
description
Daily cron that processes cleaned session transcripts and updates multiple context files (user-model, soteria, contacts, curacel). Applies Memory-as-Reasoning principles across all knowledge domains.
framework_reference
https://blog.plasticlabs.ai/blog/Memory-as-Reasoning

Knowledge Graph Update Skill

Framework Reference

Source: Plastic Labs "Memory as Reasoning"

Core thesis: Memory in agentic systems should be treated as a dynamic reasoning task, not static storage. Use logical reasoning (deductive, inductive, abductive) to derive predictions from observations. Conclusions should be atomic, composable, and scaffold on each other to form a "tree of logical reasoning."

Key principles:

  • Memory = prediction, not storage
  • Surprisal (errors) = signal for improvement
  • No "neural inertia" — update without bias when evidence contradicts
  • Natural language certainty, not arbitrary numbers
  • Composable conclusions that scaffold new reasoning

Overview

This skill processes cleaned session transcripts and extracts learnings to update our knowledge graph - a collection of context files that represent what we know about different domains.


Knowledge Domains

Domain Context File What It Captures
Henry user-model.md Behavior predictions, preferences, work patterns
Soteria memory/soteria-context.md Product knowledge, strategy, market insights
Contacts memory/contacts.md People, relationships, communication preferences
Curacel memory/curacel-context.md Company knowledge, team, processes
Tools TOOLS.md Technical configurations, APIs, credentials

Cron Schedule

Daily at 06:00 UTC (before Henry's typical day starts)

{
  "name": "knowledge-graph-update",
  "schedule": { "kind": "cron", "expr": "0 6 * * *", "tz": "UTC" },
  "sessionTarget": "isolated",
  "payload": {
    "kind": "agentTurn",
    "message": "Run knowledge graph update. Process sessions from the last 24 hours in memory/sessions/. For each session, extract learnings and update the appropriate context files (user-model.md, soteria-context.md, contacts.md, curacel-context.md). Use Memory-as-Reasoning protocol from skills/knowledge-graph-update/SKILL.md. Report what was updated."
  }
}

Processing Protocol

Step 1: Find New Sessions

# Sessions modified in last 24 hours
find ~/clawd/memory/sessions/ -name "*_clean.md" -mtime -1

Or use last-processed timestamp:

cat ~/clawd/memory/knowledge-graph-last-run.txt

Step 2: For Each Session, Classify Content

Read the session and identify mentions of:

Signal Domain Action
Henry preference/correction Henry Update user-model.md
Soteria discussion Soteria Update soteria-context.md
Person mentioned with new info Contacts Update contacts.md
Curacel process/decision Curacel Update curacel-context.md
Tool config/API discovered Tools Update TOOLS.md

Step 3: Apply Reasoning Protocol

For each learning, use the three reasoning types:

Deductive: What can we conclude with certainty? Inductive: What patterns emerge from observations? Abductive: What's the best explanation for behavior?

Step 4: Update Context Files

Use natural language certainty (not arbitrary labels like HIGH/MEDIUM/LOW):

### [Category]
**Observation:** [What was observed]
**Evidence:** [Session hash + specific data points]
**Certainty:** This is [highly/moderately/loosely] certain because [specific reason]
**Reasoning:** [Logic chain - can reference other conclusions]
**Scaffolds to:** [Conclusions that build on this one]
**Predictions:** [Testable predictions to validate]

Example:

### Communication: Directness
**Observation:** Terse, lowercase, minimal punctuation
**Evidence:** 100+ sessions (01228421, 02f88c74, ...), zero exceptions
**Certainty:** Highly certain - consistent across 2+ months, no counter-examples
**Reasoning:** (Inductive) Pattern holds across all contexts → core trait
**Scaffolds to:** Efficiency-over-politeness value, Time-scarcity model
**Predictions:** Verbose responses skimmed, warm-ups ignored

Step 5: Log Changes

Append detailed change log to memory/knowledge-graph-changelog.md:

### [DATE] Update

**Sessions processed:** [count]
**Timestamp:** [YYYY-MM-DD HH:MM UTC]

---

**user-model.md:**

[Detailed changes - what sections updated, what predictions added/validated]


**soteria-context.md:**

[Detailed changes - new topics, strategy updates, etc.]


**contacts.md:**

[Detailed changes - new contacts, updated info]


**curacel-context.md:**

[Detailed changes - team updates, process changes]


---

**Key learnings:**
- [Summary 1]
- [Summary 2]

Example output:

### 2026-02-04 Update

**Sessions processed:** 29
**Timestamp:** 2026-02-04 06:13 UTC

---

**user-model.md:**
- Added 3rd validation for "warm-ups ignored"
- Updated validated predictions section
- Added NEW prediction: "Verifies before shipped"

**soteria-context.md:**
- Added TPA Target Research Update section
- Added Apollo/Lemlist Campaign Audit section
- Updated TPA research findings (20+ targets identified)

**contacts.md:**
- NEW: Pete McCabe (Personify Health)
- NEW: George Pantos (UMR)

**curacel-context.md:**
- Added AI Competency Framework section

---

**Key learnings:**
- Henry ignores warm-ups (validated 3x)
- Henry verifies before claiming "shipped"
- TPA segment gap identified (4→150 leads needed)

This provides a complete audit trail of exactly what changed in each file. 👩‍🚀

Step 6: Update Last-Run Timestamp

date -u +"%Y-%m-%dT%H:%M:%SZ" > ~/clawd/memory/knowledge-graph-last-run.txt

Step 7: Promote Validated Predictions to Rules

Flow: user-model.md (predictions) → SOUL.md/memory.md (rules)

Promotion criteria:

  • Certainty: HIGH
  • Validated: 3+ times (prediction confirmed by behavior)
  • No recent contradictions

Process:

  1. Scan user-model.md for predictions marked [VALIDATED x3+]
  2. For each candidate:
    • Check if rule already exists in memory.md
    • If not, add to memory.md Pre-Action Checkpoint or relevant section
  3. Log promotion to changelog

Promotion format for memory.md:

## [Rule Name] (promoted from user-model.md, [DATE])
**Rule:** [What to do/not do]
**Why:** [Brief reasoning from user-model.md]

Tracking validations in user-model.md:

**Predictions:**
- Verbose responses skimmed [VALIDATED x3: 2026-01-15, 2026-01-22, 2026-02-01]
- Warm-ups ignored [VALIDATED x2: 2026-01-20, 2026-01-28]

When a prediction hits 3 validations → promote to memory.md → mark as [PROMOTED]

What gets promoted WHERE:

Prediction Type Promote To
Behavioral rules (do/don't) memory.md Pre-Action Checkpoint
Communication style SOUL.md (if Ada-specific)
Tool preferences TOOLS.md
Process preferences memory.md relevant section

Scaffolded Reasoning (Key Concept)

Conclusions should BUILD on each other, not stand alone.

Instead of flat facts:

- Henry prefers direct communication
- Henry works late
- Henry dislikes cheerleading

Build a reasoning tree:

Observation: Henry uses terse, lowercase messages (100+ sessions)
├── Inductive: Values efficiency over pleasantries
│   ├── Prediction: Skip warm-ups, lead with answers
│   └── Derived: Time is his scarcest resource
│       └── Prediction: Long responses = waste of his time
└── Abductive: Optimizes for signal-to-noise
    ├── Prediction: Will skim verbose responses
    └── Derived: Prefers action over discussion
        └── Prediction: "Ship it" > "Let's plan"

Each conclusion can be a PREMISE for new reasoning.


Prediction Validation Loop

Surprisal = Signal. When predictions fail, that's the most valuable learning.

Track Active Predictions

In each context file, maintain:

## Active Predictions (to validate)
- [ ] Henry will dismiss verbose responses (test: next long reply)
- [ ] Soteria pricing should be usage-based (test: customer feedback)
- [x] ~~Henry prefers PNG tables~~ VALIDATED 2026-01-31

When Prediction Fails

  1. Log the failure (what happened vs what was predicted)
  2. Analyze why (missing context? wrong reasoning?)
  3. Update the model
  4. This is the MOST valuable data - don't hide it

Identity Modeling (Beyond Preferences)

Don't just capture WHAT someone prefers. Model WHO they are:

Dimensions to Track

Dimension Questions Example
Decision Style Fast/slow? Data-driven/intuitive? Henry: Fast, evidence-led, action-biased
Risk Tolerance Conservative/aggressive? Henry: Bold internally, careful externally
Values Hierarchy What matters most? Efficiency > Politeness > Comfort
Stress Indicators What signals overload? Short responses, delayed replies?
Energy Sources What energizes vs drains? Building > Planning, Shipping > Discussing
Communication Patterns How do they express? Terse, lowercase, task-first

Psychology, Not Just Preferences

### Decision-Making Model (Henry)
**Style:** Fast executor, evidence-led skeptic
**Evidence:** Pushes back on unsubstantiated claims, but moves fast on data
**Reasoning:** Values both rigor AND speed - wants evidence but won't over-analyze
**Prediction:** Best approach = "Here's the data, here's my recommendation, here's why"

Domain-Specific Extraction

Henry (user-model.md)

Look for:

  • Explicit preferences ("I prefer X", "don't do Y")
  • Behavioral patterns (work hours, communication style)
  • Corrections (when Henry fixes something)
  • Reactions (what he likes/dislikes)
  • Decision patterns (how does he choose?)
  • Values revealed (what does he prioritize?)
  • Psychology (what drives him?)

Soteria (soteria-context.md)

Look for:

  • Product discussions (features, roadmap)
  • Strategy decisions
  • Market insights
  • Technical architecture
  • Team/hiring discussions

Contacts (contacts.md)

Look for:

  • New people mentioned
  • Email addresses, titles, companies
  • Relationship context (investor, customer, partner)
  • Communication preferences
  • Last interaction

Curacel (curacel-context.md)

Look for:

  • Team updates
  • Process decisions
  • Customer mentions
  • Product changes
  • Metrics/KPIs

Tools (TOOLS.md)

Look for:

  • New API keys/credentials
  • Configuration changes
  • New tools discovered
  • Integration details

Context File Formats

user-model.md (Tree Structure)

## [Domain] - e.g., Communication

### [Root Observation]
**Evidence:** [sessions, count]
**Certainty:** [natural language explanation]

#### Derived Conclusions (scaffold)
├── [Inductive conclusion]
│   **Reasoning:** [logic]
│   **Predictions:** [testable]
│   └── [Further derived conclusion]
│       **Predictions:** [testable]
└── [Abductive conclusion]
    **Reasoning:** [best explanation]
    **Predictions:** [testable]

## Active Predictions (to validate)
- [ ] [Prediction] — test: [how to validate]
- [x] ~~[Validated prediction]~~ — confirmed [date]

contacts.md

### [Name]
- **Email:** email@example.com
- **Company:** Company Name
- **Role:** Title
- **Relationship:** investor/customer/partner/etc
- **Notes:** Context, preferences
- **Last seen:** YYYY-MM-DD (session hash)

soteria-context.md

### [Topic]
**Current state:** What we know
**Decisions made:** Key decisions
**Open questions:** Unresolved items
**Last updated:** YYYY-MM-DD

curacel-context.md

### [Topic]
**Current state:** What we know
**Team involved:** Who's working on it
**Last updated:** YYYY-MM-DD

Manual Trigger

To run manually:

# Via cron tool
cron action=run jobId=knowledge-graph-update

# Or spawn directly
sessions_spawn(task="Run knowledge graph update for the last 7 days...")

Anti-Patterns

❌ Storing raw facts without reasoning ❌ Ignoring contradictions — update when new evidence conflicts ❌ Missing evidence — always link to session source ❌ Orphan updates — no implications derived ❌ Stale data — not updating last-seen timestamps


Files

File Purpose
user-model.md Henry behavior model
memory/soteria-context.md Soteria AI knowledge
memory/contacts.md People relationships
memory/curacel-context.md Curacel knowledge
TOOLS.md Technical configurations
memory/knowledge-graph-changelog.md Update history
memory/knowledge-graph-last-run.txt Last run timestamp

"The question isn't how best to store your data, but how best to reason over it to get the most accurate topological representation." — Plastic Labs