home / skills / jinfanzheng / kode-sdk-csharp / memory

This skill stores and retrieves cross-session user information to personalize interactions, ensuring preferences, identities, and decisions persist across

npx playbooks add skill jinfanzheng/kode-sdk-csharp --skill memory

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
2.4 KB
---
name: memory
description: Persistent memory for cross-session personalization. Trigger when user shares identity, preferences, relationships, or facts worth remembering.
---

## Mental Model

Memory is for **information with recurring value across conversations**. If you'll need it tomorrow/next week, save it. If it's ephemeral (today's weather, casual greeting), don't.

## What to Remember (DO)

| Category | Examples | File |
|----------|----------|------|
| Identity | Name, age, location, occupation | `facts/people.jsonl` |
| Preferences | Languages, frameworks, work style | `facts/preferences.jsonl` |
| Relationships | Colleagues, family, team members | `facts/people.jsonl` |
| Decisions | Conclusions from discussions | `facts/projects.jsonl` |
| Context | Project details, work environment | `facts/projects.jsonl` |

## What NOT to Remember (NEVER)

- Ephemeral greetings ("你好", "hi")
- Temporary states ("今天很忙", "现在在外面")
- One-time questions without context
- Duplicate information already stored
- **Credentials** (passwords, API keys, tokens - even if user shares)

## Action Pattern

When user shares memorable info:

1. **Immediately** call `fs_write` - don't acknowledge first, don't batch
2. Extract structured fields from casual speech
3. Use importance score: 0.9-1.0 (identity), 0.7-0.8 (preferences), 0.5-0.6 (context)

Example:
```
User: "我叫张三,在深圳做后端开发"
→ fs_write path=".memory/facts/people.jsonl" content='{"id":"mem_1704628800000","ts":"2026-01-07T12:00:00.000Z","type":"fact","category":"person","content":"张三,深圳,后端开发","tags":["name","location","occupation"],"importance":0.95}'
```

## Storage Map

```
.memory/
├── profile.json           # Read on session start for context
├── facts/
│   ├── people.jsonl       # Identity, relationships
│   ├── preferences.jsonl  # Tech stack, work style
│   └── projects.jsonl     # Work context, decisions
└── conversations/
    └── YYYY-MM-DD.jsonl   # Session summaries
```

## Entry Schema

```json
{"id":"mem_{{timestamp}}","ts":"{{ISO8601}}","type":"fact","category":"{{person|preference|project}}","content":"{{concise content in user's language}}","tags":["{{retrieval keywords}}"],"importance":{{0.5-1.0}}
```

## Retrieval

Session start: `fs_read` `profile.json`
Search: `fs_grep` pattern="{{keyword}}" path=".memory/"

Overview

This skill implements persistent memory for cross-session personalization. It saves user identity, preferences, relationships, decisions, and project context that are likely to be useful across future conversations. It explicitly avoids storing ephemeral states or sensitive credentials.

How this skill works

When the user shares lasting facts, the agent extracts structured fields and immediately writes entries to the file store using a JSONL schema. Memory entries include id, timestamp, type, category, concise content, retrieval tags, and an importance score to guide later retrieval. On session start the agent reads profile.json for context and uses file search to locate relevant memories during conversations.

When to use it

  • User states stable identity details (name, location, occupation).
  • User shares lasting preferences (languages, frameworks, work style).
  • User defines relationships or team members relevant to future tasks.
  • Decisions or conclusions from planning sessions that affect future work.
  • Project context or environment details that will recur across sessions.

Best practices

  • Write memory immediately on receipt—do not wait for acknowledgement or batch writes.
  • Extract concise, structured content and include retrieval tags for searchability.
  • Assign importance scores (0.9–1.0 identity, 0.7–0.8 preferences, 0.5–0.6 context).
  • Never store credentials, API keys, or transient emotional/stateful remarks.
  • Avoid duplicating existing entries; check for matches before writing.

Example use cases

  • User introduces themselves: save name, location, and role for personalized greetings.
  • User states preferred programming languages: reuse when suggesting code examples.
  • Project kickoff: capture project constraints and decisions for follow-up sessions.
  • Team mapping: store colleague relationships to resolve ownership and contact references.
  • Long-term preference changes: record to adjust future recommendations and tone.

FAQ

What should never be saved in memory?

Do not store passwords, API keys, tokens, ephemeral greetings, temporary states, or one-off questions without context.

How quickly should memory be persisted?

Persist immediately upon recognizing memorable information using a single fs_write call; do not wait for user confirmation or batch writes.