| allowed-tools | ["Read","Write","Grep","Glob","Bash"] |
| description | Use when starting sessions, making architecture decisions, finding root causes, or ending sessions to store or recall project knowledge. |
| name | memory-protocol |
| trigger | ๋ฉ๋ชจ๋ฆฌ ์ ์ฅ, ๊ณผ๊ฑฐ ๊ธฐ๋ก ๊ฒ์, ๋ฉ๋ชจ๋ฆฌ ์กฐํ, store memory, recall memory, search past decisions, ์ ์ฅ ๋ฉ๋ชจ๋ฆฌ, ๊ธฐ๋ก ์ ์ฅ, ๊ณผ๊ฑฐ ๊ฒฐ์ ๊ฒ์, ์ ์ฅํ๊ธฐ, ์กฐํํ๊ธฐ, bug root cause found, architecture decision, pattern discovered, security finding, hypothesis eliminated, plan deviation, execution summary, health event, session end, debug blocked, bootstrap record, root-cause, architecture-decision, pattern-discovery, security-finding, debug-eliminated, deviation, execution-summary, health-event, session-summary, session-snapshot, debug-blocked, bootstrap, md-recall-memory, md-store-memory, 2-hop ๊ฒ์, related ๋ฉ๋ชจ๋ฆฌ ์กฐํ, A-Mem ์ ์ฅ, ์ธ์
์์ ๊ฒ์, ๋๋ฒ๊ทธ ์์ ๊ฒ์, ๊ณํ ์์ฑ ๊ฒ์, ์ํคํ
์ฒ ๋ฆฌ๋ทฐ ๊ฒ์, ์ค๋ณต ๋ฐฉ์ง ์ ์ฅ, grep ๊ฒ์, ํ๊ทธ ํํฐ๋ง, ๋ฉ๋ชจ๋ฆฌ ํ์
์ ์ฅ, ๋ฉ๋ชจ๋ฆฌ ์คํค๋ง ํ์ธ, type-relations, search chains, debugging_chain, architecture_chain, session_chain, lessons-learned ์ ์ฅ, doc-drift, test-quality, state-sync, lifecycle, compat, general ๋ฉ๋ชจ๋ฆฌ |
| version | 4.0.0 |
Quick Reference
- ๊ฒ์ ์์: ๋ฐ๋์
Grep ํ
์คํธ ๊ฒ์ ํ Glob ํ๊ทธ ํํฐ๋ง ์ ์ฉ (ํ์ผ ์ง์ ์ด๊ธฐ ๊ธ์ง)
- ์ ์ฅ ์์ :
root-cause, architecture-decision ๋ฑ ๋ช
์์ Trigger ๋ฐ์ ์ ์ฆ์ ์ ์ฅ
- ํ์ ํ๋:
title, tags(์ต์ 2๊ฐ), type, contextual_description ํฌํจ (A-Mem ์ฐ๋ ํ์)
- ์ฐ๊ฒฐ์ฑ: ๊ด๋ จ ๋ฉ๋ชจ๋ฆฌ ๊ฐ ์ฐ๊ฒฐ์ ์ํด
related ํ๋ ๋ช
์ (2-hop ๊ฒ์ ํ์ฑํ)
- ์ค๋ณต ๋ฐฉ์ง: ์ ์ฅ ์ ๋์ผ
title/slug ํ์ธ, ์ค๋ณต ์ ์๋ ์คํต (Nemori Predict-Calibrate)
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 .hxsk/hooks/md-recall-memory.sh "{query}" "$PROJECT_DIR" 5
bash .hxsk/hooks/md-recall-memory.sh "{query}" "$PROJECT_DIR" 5 full
bash .hxsk/hooks/md-recall-memory.sh "{query}" "$PROJECT_DIR" 5 compact 1
4. 2-hop ์ด์ ๊ฒ์ (A-Mem)
๊ฒ์๋ ๋ฉ๋ชจ๋ฆฌ์ related ํ๋๋ฅผ ์๋ ์ถ์ ํ์ฌ ์ฐ๊ฒฐ๋ ๋ฉ๋ชจ๋ฆฌ๋ ํจ๊ป ๋ฐํ:
bash .hxsk/hooks/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 .hxsk/hooks/md-store-memory.sh "{title}" "{content}" "{tag1,tag2}" "{type}"
bash .hxsk/hooks/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 .hxsk/hooks/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/ |
lessons-learned/A-doc-drift | ์ฝ๋โ๋ฌธ์ drift ํจํด | lessons-learned,category-A | memories/lessons-learned/A-doc-drift/ |
lessons-learned/B-test-quality | ํ
์คํธ ํ์ง ํจํด | lessons-learned,category-B | memories/lessons-learned/B-test-quality/ |
lessons-learned/C-state-sync | ์ํ ๋๊ธฐํ/์๋ฏธ๋ก ํจํด | lessons-learned,category-C | memories/lessons-learned/C-state-sync/ |
lessons-learned/D-lifecycle | Resource/Lifecycle ํจํด | lessons-learned,category-D | memories/lessons-learned/D-lifecycle/ |
lessons-learned/E-compat | Forward-compat ํจํด | lessons-learned,category-E | memories/lessons-learned/E-compat/ |
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์ผ๋ก ์ค๋ณต ํ์ธ (์ ํ์ ) |
Iron Laws
NO RECALL WITHOUT GREP SEARCH FIRST
NO STORE WITHOUT REQUIRED METADATA (title, tags, type, created)
NO STORE WITHOUT DUPLICATE CHECK
NO STORE WITHOUT VALID TRIGGER TIMING
NO FILE CONTENT WITHOUT TITLE HEADER
NO MEMORY WITHOUT MINIMUM TWO TAGS
NO TYPE CREATION WITHOUT REGISTRY DEFINITION