| name | memory-protocol |
| description | Memory operation rules โ file-based recall/store protocol, field requirements, type registry |
| version | 4.0.0 |
| trigger | ๋ฉ๋ชจ๋ฆฌ ์ ์ฅ, ๊ณผ๊ฑฐ ๊ธฐ๋ก ๊ฒ์, ๋ฉ๋ชจ๋ฆฌ ์กฐํ, store memory, recall memory, search past decisions |
| allowed-tools | ["Read","Write","Grep","Glob","Bash"] |
Quick Reference
- Recall:
Grep โ Glob ์์, ๋๋ md-recall-memory.sh <query> [path] [limit] [mode] [hop]
- Store:
md-store-memory.sh <title> <content> [tags] [type] [keywords] [contextual_desc] [related]
- A-Mem ํ๋:
contextual_description, keywords, related (2-hop ๊ฒ์์ฉ)
- ์ค๋ณต ๋ฐฉ์ง: ๋์ผ title/slug โ ์๋ ์คํต (Nemori Predict-Calibrate)
- ์คํค๋ง:
.hxsk/memories/_schema/*.schema.json, type-relations.yaml
Memory Protocol
Goal: .hxsk/memories/ ํ์ผ ๊ธฐ๋ฐ ๋ฉ๋ชจ๋ฆฌ ์์คํ
์ ์ฌ์ฉ ๊ท์น์ ์ค์ ์ ์ํ์ฌ ๋ชจ๋ ์คํฌ๊ณผ ํ
์ด ์ผ๊ด๋ ๋ฉ๋ชจ๋ฆฌ ํจํด์ ๋ฐ๋ฅด๋๋ก ํ๋ค.
Scope: search/store ์์, ํ์ ํ๋, type ๋ ์ง์คํธ๋ฆฌ, A-Mem ํ์ฅ ํ๋, 2-hop ๊ฒ์. ๋ชจ๋ ๋ฉ๋ชจ๋ฆฌ๋ ๋งํฌ๋ค์ด ํ์ผ๋ก ์ ์ฅ/๊ฒ์.
Recall Protocol
๋ฉ๋ชจ๋ฆฌ ์กฐํ๋ ๋ฐ๋์ Grep ํ
์คํธ ๊ฒ์ โ ํ๊ทธ ํํฐ๋ง ์์๋ฅผ ๋ฐ๋ฅธ๋ค.
1. Grep ๊ฒ์ (์ฐ์ )
์ธ์
/ํ์คํฌ ์์ ์ broad context๋ฅผ ๋จผ์ ๊ฐ์ ธ์จ๋ค:
grep -rli "{keyword}" .hxsk/memories/ | sort -r | head -5
๋๋ Grep ๋๊ตฌ ์ฌ์ฉ:
Grep(pattern: "{keyword}", path: ".hxsk/memories/", output_mode: "files_with_matches")
2. ํ๊ทธ ๊ธฐ๋ฐ ํํฐ (๋ณด์ถฉ)
ํน์ ํ์
์ด๋ ํ๊ทธ๋ก ์ขํ์ผ ํ ๋:
Glob(pattern: ".hxsk/memories/{type}/*.md")
Grep(pattern: "tags:.*{tag}", path: ".hxsk/memories/", output_mode: "files_with_matches")
3. ํ
๊ธฐ๋ฐ ๊ฒ์ (์๋ํ)
ํ
์์ ์ฌ์ฉํ ๋:
bash scripts/md-recall-memory.sh "{query}" "$PROJECT_DIR" 5
bash scripts/md-recall-memory.sh "{query}" "$PROJECT_DIR" 5 full
bash scripts/md-recall-memory.sh "{query}" "$PROJECT_DIR" 5 compact 1
4. 2-hop ์ด์ ๊ฒ์ (A-Mem)
๊ฒ์๋ ๋ฉ๋ชจ๋ฆฌ์ related ํ๋๋ฅผ ์๋ ์ถ์ ํ์ฌ ์ฐ๊ฒฐ๋ ๋ฉ๋ชจ๋ฆฌ๋ ํจ๊ป ๋ฐํ:
bash scripts/md-recall-memory.sh "auth" "." 5 compact 2
Output์์ [โrelated] ํ์๋ก 2-hop ๊ฒฐ๊ณผ ๊ตฌ๋ถ ๊ฐ๋ฅ.
When to Recall
| Timing | Required | Example |
|---|
| Session start | YES (์๋: session-start.sh) | ํ๋ก์ ํธ ์ปจํ
์คํธ ๊ฒ์ |
| Task start | YES | ๊ด๋ จ ๊ณผ๊ฑฐ ์์
/๊ฒฐ์ ๊ฒ์ |
| Debug start | YES | ์ ์ฌ ๋ฒ๊ทธ/eliminated hypotheses ๊ฒ์ |
| Plan creation | YES | ๊ณผ๊ฑฐ deviation/execution-summary ๊ฒ์ |
| Arch review | YES | ๊ณผ๊ฑฐ architecture-decision ๊ฒ์ |
| Before store | NO | ์ค๋ณต ๋ฐฉ์ง ๋ชฉ์ ์ผ๋ก ์ ํ์ |
Storage Protocol
Required Fields
๋ชจ๋ ๋ฉ๋ชจ๋ฆฌ ํ์ผ์ ์๋ YAML frontmatter๋ฅผ ํ์ ํฌํจ:
| Field | Description | Required |
|---|
title | ๋ฉ๋ชจ๋ฆฌ ์ ๋ชฉ (markdown ํค๋๋ก๋ ๋ฐ๋ณต) | โ |
tags | YAML ๋ฐฐ์ด (์ต์ 2๊ฐ) | โ |
type | Type Registry์์ ์ ํ | โ |
created | ISO-8601 ํ์์คํฌํ | โ |
contextual_description | A-Mem: 1์ค ์์ฝ (200์ ์ ํ) | ์๋์์ฑ |
keywords | A-Mem: LLM ์์ฑ ๊ฒ์ ํค์๋ | ๊ถ์ฅ |
related | A-Mem Link: ๊ด๋ จ ๋ฉ๋ชจ๋ฆฌ ํ์ผ๋ช
๋ฐฐ์ด | ์ ํ |
ํ์ผ ์ ์ฅ ๋ฐฉ๋ฒ
๋ฐฉ๋ฒ 1: ํ
์ฌ์ฉ (๊ถ์ฅ, A-Mem ํ์ฅ)
bash scripts/md-store-memory.sh "{title}" "{content}" "{tag1,tag2}" "{type}"
bash scripts/md-store-memory.sh "{title}" "{content}" "{tags}" "{type}" "{keywords}" "{contextual_desc}" "{related}"
์ค๋ณต ๋ฐฉ์ง (Nemori Predict-Calibrate):
- ๋์ผ ๋ ์ง+title์ด๋ฉด
[SKIP:DUPLICATE] ๋ฐํํ๊ณ ์ ์ฅ ์ ํจ
- ์ค๋ณต ์ ๊ธฐ์กด ํ์ผ ๊ฒฝ๋ก ์ถ๋ ฅ
๋ฐฉ๋ฒ 2: ์ง์ ํ์ผ ์์ฑ
---
title: "{title}"
tags:
- tag1
- tag2
type: {type}
created: {ISO-8601}
---
## {title}
{content}
ํ์ผ ๊ฒฝ๋ก: .hxsk/memories/{type}/{YYYY-MM-DD}_{slug}.md
Storage Triggers
| Trigger | Type | Timing |
|---|
| Bug root cause found | root-cause | Immediate |
| Architecture decision | architecture-decision | Immediate |
| Pattern discovered | pattern-discovery | Immediate |
| Security finding | security-finding | Immediate |
| Hypothesis eliminated | debug-eliminated | Immediate |
| Plan deviation | deviation | On commit |
| Execution summary | execution-summary | On commit |
| Health event | health-event | On event |
| Session end | session-summary | Auto (hook) |
| Pre-compact snapshot | session-snapshot | Auto (hook) |
| Debug blocked (3-strike) | debug-blocked | Immediate |
| Bootstrap record | bootstrap | On complete |
Importance Scoring
ํ์ผ ๊ธฐ๋ฐ ์์คํ
์์ ์ค์๋๋ content์ ์์ธ๋์ ํ๊ทธ ํ๋ถ๋๋ก ๊ฒฐ์ ๋๋ค.
์ค์๋๋ฅผ ๋์ด๋ ค๋ฉด content์ ๋งฅ๋ฝ๊ณผ ์ฆ๊ฑฐ๋ฅผ ํ๋ถํ๊ฒ ๊ธฐ์ ํ๋ค.
| ์ค์๋ ์์ค | Content ์ ๋ต |
|---|
| Critical | ์ํคํ
์ฒ ๊ฒฐ์ ๊ทผ๊ฑฐ, ์ํฅ ๋ฒ์, ๋์ ๋น๊ต ๋ฑ ์์ธ ๊ธฐ์ |
| High | ๊ทผ๋ณธ ์์ธ, ๋ฐ๊ฒฌ ํจํด์ ์ฆ๊ฑฐ์ ์ฌํ ๊ฒฝ๋ก ํฌํจ |
| Medium | ๋ฐฐ์ ๊ฐ์ค์ ์ฆ๊ฑฐ, ์ดํ ์ฌ์ ๊ฐ๊ฒฐํ ๊ธฐ์ |
| Low | ์์ฝ ์์ค (์ธ์
์์ฝ, ์๋ ์ค๋
์ท) |
Relationship Handling
A-Mem Link (๊ถ์ฅ)
related ํ๋๋ฅผ ์ฌ์ฉํ์ฌ ๋ฉ๋ชจ๋ฆฌ ๊ฐ ์ฐ๊ฒฐ:
related:
- 2024-01-15_auth-token-expired
- 2024-01-16_jwt-validation-fix
์ฐ๊ด ์กฐํ (2-hop)
md-recall-memory.sh๊ฐ ์๋์ผ๋ก related ํ๋๋ฅผ ์ถ์ :
bash scripts/md-recall-memory.sh "auth" "." 5 compact 2
ํ๊ทธ ๊ธฐ๋ฐ ์ฐ๊ฒฐ (๋ ๊ฑฐ์)
ํ๊ทธ์ related:{slug} ํจํด๋ ์ฌ์ ํ ์ง์:
tags:
- debug
- root-cause
- related:2024-01-15_auth-token-expired
Type Relations (Ontology)
Note: ์๋ ๊ฒ์ ์ฒด์ธ์ ์ค๊ณ ๋ ํผ๋ฐ์ค์ด๋ฉฐ, ํ์ฌ ์๋ ๊ตฌํ๋์ง ์์.
md-recall-memory.sh์ 2-hop ๊ฒ์์ related ํ๋ ๊ธฐ๋ฐ์ด๋ฉฐ, ์ฒด์ธ ์๋ ์ํ๋ ๋ฏธ๊ตฌํ.
.hxsk/memories/_schema/type-relations.yaml์์ 14๊ฐ ํ์
๊ฐ ๊ด๊ณ ์ ์:
| Relation | ์๋ฏธ | ์์ |
|---|
resolves | A๊ฐ B ๋ฌธ์ ๋ฅผ ํด๊ฒฐ | root-cause โ debug-eliminated |
informs | A๊ฐ B ๊ฒฐ์ ์ ์ํฅ | architecture-decision โ pattern-discovery |
triggers | A ๋ฐ์ ์ B ์์ฑ | debug-blocked โ health-event |
generates | A์์ B ๋์ถ | root-cause โ pattern-discovery |
Search Chains (์ต์ ํ๋ ๊ฒ์ ์์)
debugging_chain: [debug-blocked, debug-eliminated, root-cause, pattern-discovery]
architecture_chain: [bootstrap, architecture-decision, pattern-discovery]
session_chain: [session-snapshot, session-summary, session-handoff]
Schema Validation
.hxsk/memories/_schema/ ๋๋ ํ ๋ฆฌ์ JSON Schema ์ ์:
base.schema.json: ๊ณตํต ํ๋ (A-Mem ํ์ฅ ํฌํจ)
root-cause.schema.json: ๊ทผ๋ณธ ์์ธ ์ ์ฉ ํ๋
architecture-decision.schema.json: ADR ์คํ์ผ ํ๋
session-summary.schema.json: Nemori ์์ฌ ํํ ํ๋
Type Registry
| Type | Description | Primary Tags | Directory |
|---|
architecture-decision | ์ํคํ
์ฒ ๊ฒฐ์ ์ฌํญ | arch,decision | memories/architecture-decision/ |
root-cause | ๋๋ฒ๊น
๊ทผ๋ณธ ์์ธ | debug,root-cause | memories/root-cause/ |
debug-eliminated | ๋ฐฐ์ ๋ ๊ฐ์ค | debug,eliminated | memories/debug-eliminated/ |
debug-blocked | 3-strike๋ก ์ฐจ๋จ๋ ์กฐ์ฌ | debug,blocked,3-strike | memories/debug-blocked/ |
health-event | ์ปจํ
์คํธ ๊ฑด๊ฐ ์ด๋ฒคํธ | health,context | memories/health-event/ |
session-handoff | ์ธ์
์ธ์์ธ๊ณ ์ ๋ณด | handoff,session | memories/session-handoff/ |
execution-summary | ์คํ ๊ฒฐ๊ณผ ์์ฝ | execution,summary | memories/execution-summary/ |
deviation | ๊ณํ ๋๋น ์ดํ | deviation,plan | memories/deviation/ |
pattern-discovery | ๋ฐ๊ฒฌ๋ ํจํด/ํ์ต | pattern,learning | memories/pattern-discovery/ |
bootstrap | ํ๋ก์ ํธ ์ด๊ธฐ ์ค์ ๊ธฐ๋ก | bootstrap,setup | memories/bootstrap/ |
session-summary | ์ธ์
์ข
๋ฃ ์์ฝ | session,auto | memories/session-summary/ |
session-snapshot | Pre-compact ์ค๋
์ท | session-snapshot,pre-compact | memories/session-snapshot/ |
security-finding | ๋ณด์ ๋ฐ๊ฒฌ ์ฌํญ | security,finding | memories/security-finding/ |
general | ๊ธฐํ | context-dependent | memories/general/ |
Anti-Patterns
| Anti-Pattern | Why | Instead |
|---|
| Grep ์์ด ๋ฐ๋ก ํ์ผ ์ด๊ธฐ | ๊ด๋ จ ์๋ ํ์ผ ์ฝ๋ ์๊ฐ ๋ญ๋น | Grep ๊ฒ์ โ ๊ด๋ จ ํ์ผ๋ง Read |
| content์ title ๋ฏธํฌํจ | ๊ฒ์ ์ ๋งฅ๋ฝ ๋ถ์กฑ | ## {title}\n\n{content} ํ์ ์ฌ์ฉ |
| ๋จ์ผ ํ๊ทธ ์ฌ์ฉ | ๊ฒ์ ์ ๋ฐ๋ ์ ํ | ์ต์ 2๊ฐ ํ๊ทธ (type + domain) |
| ๋งค ์ปค๋ฐ๋ง๋ค ์๋ ์ ์ฅ | noise > signal | Trigger ํ
์ด๋ธ์ ์์ ๋ง ์ ์ฅ |
| ์ค๋ณต ์ ์ฅ | ๋๋ ํ ๋ฆฌ ๋น๋ํ | ์ ์ฅ ์ Grep์ผ๋ก ์ค๋ณต ํ์ธ (์ ํ์ ) |