@leejungkiin/awkit 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/GEMINI.md.bak +168 -181
- package/package.json +2 -2
- package/schemas/brain-snapshot.json +167 -0
- package/skills/CATALOG.md +70 -0
- package/skills/beads-manager/SKILL.md +20 -1
- package/skills/memory-sync/SKILL.md +20 -2
- package/skills/nm-memory-audit/SKILL.md +157 -0
- package/skills/nm-memory-evolution/SKILL.md +202 -0
- package/skills/nm-memory-intake/SKILL.md +135 -0
- package/skills/nm-memory-sync/SKILL.md +184 -0
- package/skills/orchestrator/SKILL.md +41 -50
- package/skills/schemas/brain-snapshot.json +167 -0
- package/skills/skills/nm-memory-audit/SKILL.md +157 -0
- package/skills/skills/nm-memory-evolution/SKILL.md +202 -0
- package/skills/skills/nm-memory-intake/SKILL.md +135 -0
- package/skills/skills/nm-memory-sync/SKILL.md +184 -0
- package/skills/smali-to-kotlin/SKILL.md +331 -85
- package/skills/smali-to-kotlin/phase-0-discovery.md +93 -94
- package/skills/smali-to-kotlin/phase-1-architecture.md +67 -58
- package/skills/smali-to-kotlin/phase-2-blueprint.md +228 -0
- package/skills/smali-to-kotlin/phase-3-build.md +248 -0
- package/skills/smali-to-kotlin/templates/app-map.md +101 -0
- package/skills/smali-to-kotlin/templates/architecture.md +142 -0
- package/skills/smali-to-kotlin/templates/blueprint.md +145 -0
- package/skills/smali-to-swift/SKILL.md +532 -91
- package/skills/smali-to-swift/phase-0-discovery.md +101 -118
- package/skills/smali-to-swift/phase-1-architecture.md +62 -67
- package/skills/smali-to-swift/phase-2-blueprint.md +173 -0
- package/skills/smali-to-swift/phase-3-build.md +257 -0
- package/skills/smali-to-swift/templates/app-map.md +82 -0
- package/skills/smali-to-swift/templates/architecture.md +97 -0
- package/skills/smali-to-swift/templates/blueprint.md +82 -0
- package/skills/workflows/nm-import.md +73 -0
- package/skills/workflows/nm-recall.md +67 -0
- package/skills/workflows/nm-snapshot.md +69 -0
- package/workflows/_uncategorized/nm-import.md +73 -0
- package/workflows/_uncategorized/nm-recall.md +67 -0
- package/workflows/_uncategorized/nm-snapshot.md +69 -0
- package/workflows/_uncategorized/reverse-android-build.md +222 -0
- package/workflows/_uncategorized/reverse-android-design.md +139 -0
- package/workflows/_uncategorized/reverse-android-discover.md +150 -0
- package/workflows/_uncategorized/reverse-android-scan.md +158 -0
- package/workflows/_uncategorized/reverse-android.md +143 -0
- package/workflows/_uncategorized/reverse-ios-build.md +240 -0
- package/workflows/_uncategorized/reverse-ios-design.md +112 -0
- package/workflows/_uncategorized/reverse-ios-discover.md +120 -0
- package/workflows/_uncategorized/reverse-ios-scan.md +155 -0
- package/workflows/_uncategorized/reverse-ios.md +152 -0
- package/skills/adaptive-language/SKILL.md +0 -189
- package/skills/ambient-brain/SKILL.md +0 -314
- package/skills/ambient-brain/brain-router.md +0 -185
- package/skills/ambient-brain/brain-templates.md +0 -201
- package/skills/context-help/SKILL.md +0 -180
- package/skills/error-translator/SKILL.md +0 -153
- package/skills/session-restore/SKILL.md +0 -240
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: nm-memory-sync
|
|
3
|
+
description: |
|
|
4
|
+
NeuralMemory-powered ambient brain sync. Replaces flat-file memory-sync with
|
|
5
|
+
associative graph recall via spreading activation. Auto-reads/writes brain on
|
|
6
|
+
every session, debug, task, and error — with richer context than keyword matching.
|
|
7
|
+
metadata:
|
|
8
|
+
stage: core
|
|
9
|
+
version: "1.0"
|
|
10
|
+
replaces: memory-sync, ambient-brain
|
|
11
|
+
requires: neural-memory (pip install neural-memory)
|
|
12
|
+
tags: [memory, neural, sync, core, ambient]
|
|
13
|
+
agent: Ambient Neural Brain
|
|
14
|
+
allowed-tools:
|
|
15
|
+
- nmem_remember
|
|
16
|
+
- nmem_recall
|
|
17
|
+
- nmem_context
|
|
18
|
+
- nmem_stats
|
|
19
|
+
- nmem_auto
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
# NM Memory Sync — Ambient Neural Brain
|
|
23
|
+
|
|
24
|
+
> Drop-in upgrade for `memory-sync` and `ambient-brain`.
|
|
25
|
+
> Uses NeuralMemory's spreading activation instead of keyword overlap.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Core Difference vs memory-sync
|
|
30
|
+
|
|
31
|
+
| Feature | memory-sync (flat-file) | nm-memory-sync (this) |
|
|
32
|
+
|---------|------------------------|----------------------|
|
|
33
|
+
| Storage | Markdown files | SQLite graph (neurons + synapses) |
|
|
34
|
+
| Recall | keyword overlap > 2 | Spreading activation graph |
|
|
35
|
+
| Causality | None | `CAUSED_BY`, `LEADS_TO` links |
|
|
36
|
+
| Time decay | None | Natural decay by age/priority |
|
|
37
|
+
| Dedup | None | Automatic conflict detection |
|
|
38
|
+
| Context | Whole file | Scoped activation subgraph |
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## READ TRIGGERS (Auto-Read từ Brain)
|
|
43
|
+
|
|
44
|
+
### R1: Session Start
|
|
45
|
+
**Condition:** Conversation bắt đầu
|
|
46
|
+
**Action:** `nmem_context()` → load recent + high-activation memories
|
|
47
|
+
**Output:** Silent loading, brief summary nếu relevant
|
|
48
|
+
|
|
49
|
+
### R2: New Task / Debugging
|
|
50
|
+
**Condition:** User bắt đầu task mới hoặc debug session
|
|
51
|
+
**Action:** `nmem_recall(task_keywords)` → associative recall
|
|
52
|
+
**Output:** Show relevant decisions, past errors, solutions
|
|
53
|
+
|
|
54
|
+
### R3: Error Encountered
|
|
55
|
+
**Condition:** Exception, crash, hoặc lỗi xuất hiện
|
|
56
|
+
**Action:** `nmem_recall(error_type + keywords)` → find past similar errors
|
|
57
|
+
**Output:** Auto-propose known solutions if confidence > 0.7
|
|
58
|
+
|
|
59
|
+
### R4: Architecture Question
|
|
60
|
+
**Condition:** User hỏi về design, pattern, tech choice
|
|
61
|
+
**Action:** `nmem_recall(topic, depth=3)` → deep associative recall
|
|
62
|
+
**Output:** Related decisions, constraints, context
|
|
63
|
+
|
|
64
|
+
### R5: Recurring Problem (Enhanced)
|
|
65
|
+
**Condition:** Vấn đề tương tự đã gặp (spreading activation detects similarity)
|
|
66
|
+
**Action:** Activate related memory cluster
|
|
67
|
+
**Output:** "🧠 Similar to [memory]: [solution]" — NO keyword threshold needed
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## WRITE TRIGGERS (Auto-Write vào Brain)
|
|
72
|
+
|
|
73
|
+
### W1: Decision Made → `decision` type
|
|
74
|
+
**Condition:** AI hoặc user đưa ra quyết định kỹ thuật
|
|
75
|
+
**Capture:** "Chose X because Y" format
|
|
76
|
+
**Store:** `nmem_remember(content, type="decision", priority=7)`
|
|
77
|
+
**Links:** Auto-link to related memories via NeuralMemory engine
|
|
78
|
+
|
|
79
|
+
### W2: Bug Fixed → `error` type
|
|
80
|
+
**Condition:** User confirm fix thành công ("xong", "ok", "chạy rồi")
|
|
81
|
+
**Capture:** Error + root cause + solution
|
|
82
|
+
**Store:** `nmem_remember(content, type="error", priority=8)`
|
|
83
|
+
**Links:** `CAUSED_BY` → triggering condition, `LEADS_TO` → fix applied
|
|
84
|
+
|
|
85
|
+
### W3: Architecture Change → `instruction` type
|
|
86
|
+
**Condition:** File structure thay đổi, pattern mới được áp dụng
|
|
87
|
+
**Capture:** What changed + why
|
|
88
|
+
**Store:** `nmem_remember(content, type="instruction", priority=7)`
|
|
89
|
+
**Links:** `SUPERSEDES` → old pattern if exists
|
|
90
|
+
|
|
91
|
+
### W4: Task Complete → `workflow` type
|
|
92
|
+
**Condition:** Task marked done trong Beads
|
|
93
|
+
**Capture:** What was done + approach taken
|
|
94
|
+
**Store:** `nmem_remember(content, type="workflow", priority=5)`
|
|
95
|
+
|
|
96
|
+
### W5: User Preference Detected → `preference` type
|
|
97
|
+
**Condition:** User consistently uses pattern or expresses preference
|
|
98
|
+
**Capture:** The preference + context
|
|
99
|
+
**Store:** `nmem_remember(content, type="preference", priority=6)`
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Sync Protocol
|
|
104
|
+
|
|
105
|
+
### Session Start Flow
|
|
106
|
+
```
|
|
107
|
+
1. nmem_context() → get active memory cluster
|
|
108
|
+
2. Filter by project tags (from .project-identity if available)
|
|
109
|
+
3. SILENT load — no output unless > 3 highly relevant memories
|
|
110
|
+
4. If relevant: "🧠 Recalled: [brief summary]"
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Error Flow
|
|
114
|
+
```
|
|
115
|
+
1. Extract: error_type, file, function, keywords
|
|
116
|
+
2. nmem_recall(f"{error_type} {keywords}", depth=2)
|
|
117
|
+
3. If match (activation > 0.6):
|
|
118
|
+
→ "🧠 Similar error: [past error] — Solution: [fix]"
|
|
119
|
+
4. After fix confirmed:
|
|
120
|
+
→ nmem_remember(error + solution, type="error", tags=[...])
|
|
121
|
+
→ Create CAUSED_BY + LEADS_TO synapses
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Decision Write Flow
|
|
125
|
+
```
|
|
126
|
+
1. Detect decision signal words: "chose", "decided", "going with", "will use"
|
|
127
|
+
2. Extract: choice + reason (requires both for quality decision memory)
|
|
128
|
+
3. nmem_recall(topic) → check for conflicts
|
|
129
|
+
4. SILENT store: nmem_remember(content, type="decision", priority=7)
|
|
130
|
+
5. Confirm: "💾 Saved decision: [brief]"
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Associative Recall Strategy
|
|
136
|
+
|
|
137
|
+
Unlike keyword overlap (old memory-sync), nm-memory-sync uses:
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
Query: "API authentication failing"
|
|
141
|
+
↓ spreading activation
|
|
142
|
+
Anchor neurons: [api, auth, fail]
|
|
143
|
+
↓ activate synapses (depth=2)
|
|
144
|
+
Related neurons: [jwt, token, session, middleware]
|
|
145
|
+
↓ intersect top activations
|
|
146
|
+
Surface memories:
|
|
147
|
+
- "Decided JWT over sessions for stateless API" (decision, auth tags)
|
|
148
|
+
- "Fixed middleware order causing 401" (error, api tags)
|
|
149
|
+
- "Never store tokens in localStorage" (instruction, security tags)
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
This surfaces memories that a keyword search would miss.
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Notification Behavior
|
|
157
|
+
|
|
158
|
+
| Event | Output |
|
|
159
|
+
|-------|--------|
|
|
160
|
+
| Relevant memory found (activation > 0.7) | `🧠 [brief recall]` |
|
|
161
|
+
| Decision auto-saved | `💾 Saved: [brief]` |
|
|
162
|
+
| Bug solution stored | `🔧 Stored fix: [brief]` |
|
|
163
|
+
| No relevant memory | Silent (no output) |
|
|
164
|
+
| Conflict detected | `⚠️ Conflicts with: [memory]` |
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Fallback Mode (NeuralMemory Not Installed)
|
|
169
|
+
|
|
170
|
+
If `nmem` is not available, falls back to flat-file behavior:
|
|
171
|
+
```
|
|
172
|
+
- Reads from brain/decisions/, brain/solutions/
|
|
173
|
+
- Keyword overlap matching (legacy behavior)
|
|
174
|
+
- Shows warning once: "⚠️ NeuralMemory not installed. Using flat-file fallback."
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Integration
|
|
180
|
+
|
|
181
|
+
- Works alongside `beads-manager` for task lifecycle hooks
|
|
182
|
+
- Reads `.project-identity` for project-scoped memory filtering
|
|
183
|
+
- Feeds data to `nm-memory-audit` for quality checks
|
|
184
|
+
- Activated before `orchestrator` dispatches (priority 2.5 in skill chain)
|
|
@@ -3,32 +3,33 @@ name: orchestrator
|
|
|
3
3
|
description: >-
|
|
4
4
|
Intelligent dispatcher — analyzes context, injects project brain, then
|
|
5
5
|
delegates to the right skill or workflow. Always runs first.
|
|
6
|
-
|
|
6
|
+
invocation-type: auto
|
|
7
|
+
version: 2.1.0
|
|
7
8
|
trigger: always
|
|
8
9
|
priority: 1
|
|
9
10
|
---
|
|
10
11
|
|
|
11
|
-
# Orchestrator Skill v2.
|
|
12
|
+
# Orchestrator Skill v2.1 — Project-Aware + Self-Evolving
|
|
12
13
|
|
|
13
14
|
> **Role:** First-layer processor. Chạy trước MỌI skill khác.
|
|
14
|
-
> **
|
|
15
|
+
> **v2.0:** Project Brain Lookup — inject project context trước khi route.
|
|
16
|
+
> **v2.1:** Self-Evolution Pattern — tự ghi learnings sau mỗi session.
|
|
15
17
|
|
|
16
18
|
---
|
|
17
19
|
|
|
18
20
|
## Execution Order (MANDATORY)
|
|
19
21
|
|
|
20
22
|
```
|
|
21
|
-
Step 1: Project Brain Lookup ←
|
|
23
|
+
Step 1: Project Brain Lookup ← chạy đầu tiên
|
|
22
24
|
Step 2: Intent Detection
|
|
23
25
|
Step 3: Route to skill/workflow
|
|
26
|
+
Step 4: Self-Evolution ← ghi learnings nếu có
|
|
24
27
|
```
|
|
25
28
|
|
|
26
29
|
---
|
|
27
30
|
|
|
28
31
|
## Step 1: Project Brain Lookup (LUÔN CHẠY)
|
|
29
32
|
|
|
30
|
-
Trước khi làm bất cứ điều gì, orchestrator phải load project context:
|
|
31
|
-
|
|
32
33
|
### 1.1 — Đọc `.project-identity`
|
|
33
34
|
|
|
34
35
|
```yaml
|
|
@@ -38,10 +39,9 @@ IF EXISTS:
|
|
|
38
39
|
read: .project-identity
|
|
39
40
|
extract:
|
|
40
41
|
- projectName
|
|
41
|
-
- stage
|
|
42
|
+
- stage
|
|
42
43
|
- architecture (clean_architecture, mvvm)
|
|
43
44
|
- tech stack (swift, react, node, etc.)
|
|
44
|
-
- currentWork / nextMilestones
|
|
45
45
|
|
|
46
46
|
SET: project_context = { name, stage, arch, stack }
|
|
47
47
|
```
|
|
@@ -57,9 +57,6 @@ IF EXISTS:
|
|
|
57
57
|
- layer_map: { layer_name → files[] }
|
|
58
58
|
- feature_areas: { feature → directory }
|
|
59
59
|
- naming_conventions
|
|
60
|
-
- data_flow_diagrams
|
|
61
|
-
|
|
62
|
-
SET: codebase_map = { layers, features, conventions }
|
|
63
60
|
|
|
64
61
|
RULES:
|
|
65
62
|
→ KHÔNG scan raw directory nếu CODEBASE.md tồn tại
|
|
@@ -69,15 +66,11 @@ RULES:
|
|
|
69
66
|
### 1.3 — Resolve Target từ Request
|
|
70
67
|
|
|
71
68
|
```yaml
|
|
72
|
-
# Khi user đề cập feature/bug/area:
|
|
73
69
|
resolve_target(user_request, codebase_map):
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
# Match theo thứ tự ưu tiên:
|
|
77
|
-
1. Layer match: "crash khi login" → AuthenticationViewModel, AuthUseCases
|
|
70
|
+
1. Layer match: "crash khi login" → AuthenticationViewModel
|
|
78
71
|
2. Feature match: "water tracking" → Features/Water/
|
|
79
|
-
3. Service match: "camera chậm" → CameraViewModel
|
|
80
|
-
4. Fallback:
|
|
72
|
+
3. Service match: "camera chậm" → CameraViewModel
|
|
73
|
+
4. Fallback: list top 3 candidates từ CODEBASE.md
|
|
81
74
|
```
|
|
82
75
|
|
|
83
76
|
### 1.4 — Brief Confirm Output (LUÔN HIỂN THỊ)
|
|
@@ -87,27 +80,17 @@ Format:
|
|
|
87
80
|
"📚 [ProjectName] | [Stage] | [Architecture]
|
|
88
81
|
🗺️ Targeting: [resolved file/layer]"
|
|
89
82
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
🗺️ Targeting: AuthenticationViewModel → SignInUseCase"
|
|
93
|
-
|
|
94
|
-
Nếu CODEBASE.md không có:
|
|
95
|
-
"📚 [ProjectName] — CODEBASE.md chưa có, đang scan cấu trúc..."
|
|
96
|
-
|
|
97
|
-
Nếu file được nhắc đến KHÔNG có trong CODEBASE.md:
|
|
98
|
-
→ Thực hiện xong, thêm footer: "⚠️ CODEBASE.md có thể outdated — dùng /codebase-sync"
|
|
83
|
+
Nếu file được nhắc KHÔNG có trong CODEBASE.md:
|
|
84
|
+
→ Footer: "⚠️ CODEBASE.md có thể outdated — dùng /codebase-sync"
|
|
99
85
|
```
|
|
100
86
|
|
|
101
87
|
---
|
|
102
88
|
|
|
103
89
|
## Step 2: Intent Detection
|
|
104
90
|
|
|
105
|
-
Sau khi có project context, detect intent từ request:
|
|
106
|
-
|
|
107
91
|
```yaml
|
|
108
92
|
debug_intent:
|
|
109
93
|
keywords: ["error", "bug", "crash", "fix", "lỗi", "sửa", "fail", "không chạy"]
|
|
110
|
-
+ image: [screenshot of error/crash]
|
|
111
94
|
action: Execute debug flow với target đã resolve từ Step 1
|
|
112
95
|
|
|
113
96
|
code_intent:
|
|
@@ -145,25 +128,16 @@ image_intent:
|
|
|
145
128
|
→ Không hỏi "file này ở đâu?" — đã biết từ CODEBASE.md
|
|
146
129
|
```
|
|
147
130
|
|
|
148
|
-
### Without Project Context
|
|
149
|
-
|
|
150
|
-
```
|
|
151
|
-
→ Route bình thường theo intent
|
|
152
|
-
→ Suggest workflow phù hợp
|
|
153
|
-
→ Có thể hỏi clarifying question (max 2 lần)
|
|
154
|
-
```
|
|
155
|
-
|
|
156
131
|
### Slash Command Detection
|
|
157
132
|
|
|
158
133
|
```yaml
|
|
159
|
-
|
|
160
|
-
/
|
|
161
|
-
/
|
|
162
|
-
/
|
|
163
|
-
/
|
|
164
|
-
/
|
|
165
|
-
/
|
|
166
|
-
/codebase-sync → global_workflows/codebase-sync.md # MỚI
|
|
134
|
+
/plan → workflows/lifecycle/plan.md
|
|
135
|
+
/planExpert → workflows/lifecycle/planExpert.md
|
|
136
|
+
/code → workflows/lifecycle/code.md
|
|
137
|
+
/codeExpert → workflows/lifecycle/codeExpert.md
|
|
138
|
+
/debug → workflows/lifecycle/debug.md
|
|
139
|
+
/debugExpert → workflows/lifecycle/debugExpert.md
|
|
140
|
+
/codebase-sync → workflows/context/codebase-sync.md
|
|
167
141
|
# ...etc (see GEMINI.md)
|
|
168
142
|
```
|
|
169
143
|
|
|
@@ -176,18 +150,35 @@ Still unclear → Suggest /help
|
|
|
176
150
|
|
|
177
151
|
---
|
|
178
152
|
|
|
153
|
+
## Step 4: Self-Evolution Protocol
|
|
154
|
+
|
|
155
|
+
After each session, if a routing decision was suboptimal or a new intent was discovered:
|
|
156
|
+
|
|
157
|
+
1. **Record** the finding in the Learnings section below
|
|
158
|
+
2. **Update** routing rules in Step 2 if a new keyword pattern should be added
|
|
159
|
+
3. **Cross-check** skill catalog (`skills/CATALOG.md`) to ensure new skills are routable
|
|
160
|
+
|
|
161
|
+
> This ensures the orchestrator improves its routing accuracy over time.
|
|
162
|
+
|
|
163
|
+
## Learnings
|
|
164
|
+
|
|
165
|
+
_Findings from past sessions are recorded here. Add new entries as bullet points._
|
|
166
|
+
|
|
167
|
+
- v2.0: Added project brain lookup — significantly reduces unnecessary questions about file locations.
|
|
168
|
+
- v2.1: Added self-evolution pattern — skill now self-improves by recording routing insights.
|
|
169
|
+
- `invocation-type` field added to help distinguish auto vs manual skills in routing decisions.
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
179
173
|
## Integration
|
|
180
174
|
|
|
181
175
|
```yaml
|
|
182
176
|
runs_before: awf-session-restore, memory-sync, all workflows
|
|
183
177
|
provides_to: [project_context, resolved_target, intent]
|
|
184
178
|
receives_from: user_request, active_document
|
|
185
|
-
|
|
186
|
-
# Khi có CODEBASE.md → memory-sync R2 chỉ cần query với resolved_target
|
|
187
|
-
# thay vì query toàn bộ brain/
|
|
188
179
|
```
|
|
189
180
|
|
|
190
181
|
---
|
|
191
182
|
|
|
192
|
-
*orchestrator v2.
|
|
183
|
+
*orchestrator v2.1 — Project-Aware + Self-Evolving Dispatcher*
|
|
193
184
|
*Created by Kien AI*
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "NeuralMemory Brain Snapshot",
|
|
4
|
+
"description": "Schema for nm-snapshot exported brain state — Portable Consciousness",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": [
|
|
7
|
+
"version",
|
|
8
|
+
"exported_at",
|
|
9
|
+
"memories",
|
|
10
|
+
"synapses"
|
|
11
|
+
],
|
|
12
|
+
"properties": {
|
|
13
|
+
"version": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"const": "1.0"
|
|
16
|
+
},
|
|
17
|
+
"exported_at": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"format": "date-time"
|
|
20
|
+
},
|
|
21
|
+
"project": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "Project name from .project-identity"
|
|
24
|
+
},
|
|
25
|
+
"scope": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"enum": [
|
|
28
|
+
"full",
|
|
29
|
+
"topic",
|
|
30
|
+
"recent",
|
|
31
|
+
"high-priority"
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
"memories": {
|
|
35
|
+
"type": "array",
|
|
36
|
+
"items": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"required": [
|
|
39
|
+
"id",
|
|
40
|
+
"content",
|
|
41
|
+
"type",
|
|
42
|
+
"priority",
|
|
43
|
+
"created_at"
|
|
44
|
+
],
|
|
45
|
+
"properties": {
|
|
46
|
+
"id": {
|
|
47
|
+
"type": "string"
|
|
48
|
+
},
|
|
49
|
+
"content": {
|
|
50
|
+
"type": "string"
|
|
51
|
+
},
|
|
52
|
+
"type": {
|
|
53
|
+
"type": "string",
|
|
54
|
+
"enum": [
|
|
55
|
+
"fact",
|
|
56
|
+
"decision",
|
|
57
|
+
"todo",
|
|
58
|
+
"error",
|
|
59
|
+
"insight",
|
|
60
|
+
"preference",
|
|
61
|
+
"instruction",
|
|
62
|
+
"workflow",
|
|
63
|
+
"context"
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
"priority": {
|
|
67
|
+
"type": "integer",
|
|
68
|
+
"minimum": 0,
|
|
69
|
+
"maximum": 10
|
|
70
|
+
},
|
|
71
|
+
"tags": {
|
|
72
|
+
"type": "array",
|
|
73
|
+
"items": {
|
|
74
|
+
"type": "string"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"created_at": {
|
|
78
|
+
"type": "string",
|
|
79
|
+
"format": "date-time"
|
|
80
|
+
},
|
|
81
|
+
"expires_at": {
|
|
82
|
+
"type": "string",
|
|
83
|
+
"format": "date-time"
|
|
84
|
+
},
|
|
85
|
+
"activation_score": {
|
|
86
|
+
"type": "number",
|
|
87
|
+
"minimum": 0,
|
|
88
|
+
"maximum": 1
|
|
89
|
+
},
|
|
90
|
+
"recall_count": {
|
|
91
|
+
"type": "integer",
|
|
92
|
+
"minimum": 0
|
|
93
|
+
},
|
|
94
|
+
"status": {
|
|
95
|
+
"type": "string",
|
|
96
|
+
"enum": [
|
|
97
|
+
"active",
|
|
98
|
+
"archived",
|
|
99
|
+
"expired"
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
"synapses": {
|
|
106
|
+
"type": "array",
|
|
107
|
+
"items": {
|
|
108
|
+
"type": "object",
|
|
109
|
+
"required": [
|
|
110
|
+
"from_id",
|
|
111
|
+
"to_id",
|
|
112
|
+
"type",
|
|
113
|
+
"weight"
|
|
114
|
+
],
|
|
115
|
+
"properties": {
|
|
116
|
+
"from_id": {
|
|
117
|
+
"type": "string"
|
|
118
|
+
},
|
|
119
|
+
"to_id": {
|
|
120
|
+
"type": "string"
|
|
121
|
+
},
|
|
122
|
+
"type": {
|
|
123
|
+
"type": "string",
|
|
124
|
+
"enum": [
|
|
125
|
+
"CAUSED_BY",
|
|
126
|
+
"LEADS_TO",
|
|
127
|
+
"DISCUSSED",
|
|
128
|
+
"CONTRADICTS",
|
|
129
|
+
"SUPERSEDES",
|
|
130
|
+
"COMPLEMENTS",
|
|
131
|
+
"RELATED"
|
|
132
|
+
]
|
|
133
|
+
},
|
|
134
|
+
"weight": {
|
|
135
|
+
"type": "number",
|
|
136
|
+
"minimum": 0,
|
|
137
|
+
"maximum": 1
|
|
138
|
+
},
|
|
139
|
+
"created_at": {
|
|
140
|
+
"type": "string",
|
|
141
|
+
"format": "date-time"
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"stats": {
|
|
147
|
+
"type": "object",
|
|
148
|
+
"properties": {
|
|
149
|
+
"total_memories": {
|
|
150
|
+
"type": "integer"
|
|
151
|
+
},
|
|
152
|
+
"total_synapses": {
|
|
153
|
+
"type": "integer"
|
|
154
|
+
},
|
|
155
|
+
"avg_priority": {
|
|
156
|
+
"type": "number"
|
|
157
|
+
},
|
|
158
|
+
"active_memories": {
|
|
159
|
+
"type": "integer"
|
|
160
|
+
},
|
|
161
|
+
"archived_memories": {
|
|
162
|
+
"type": "integer"
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: nm-memory-audit
|
|
3
|
+
description: |
|
|
4
|
+
6-dimension quality review of NeuralMemory brain health.
|
|
5
|
+
Grades each dimension (A-F), produces graded findings, and recommends
|
|
6
|
+
concrete actions for improvement. Run weekly or before major sprints.
|
|
7
|
+
metadata:
|
|
8
|
+
stage: review
|
|
9
|
+
version: "1.0"
|
|
10
|
+
requires: neural-memory (pip install neural-memory)
|
|
11
|
+
tags: [memory, audit, quality, review, neuralmemory]
|
|
12
|
+
agent: Memory Quality Inspector
|
|
13
|
+
trigger:
|
|
14
|
+
commands: ["/memory-audit", "/nm-audit"]
|
|
15
|
+
keywords: ["audit brain", "check memory", "memory health"]
|
|
16
|
+
allowed-tools:
|
|
17
|
+
- nmem_recall
|
|
18
|
+
- nmem_stats
|
|
19
|
+
- nmem_context
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
# NM Memory Audit — Memory Quality Inspector
|
|
23
|
+
|
|
24
|
+
> Systematic quality review of the NeuralMemory brain.
|
|
25
|
+
> Grades memory health across 6 dimensions, surfaces actionable findings.
|
|
26
|
+
|
|
27
|
+
## Trigger
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
/memory-audit
|
|
31
|
+
/nm-audit
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## 6 Audit Dimensions
|
|
37
|
+
|
|
38
|
+
### 1. Purity (A-F)
|
|
39
|
+
**Question:** Are memories well-typed and single-concept?
|
|
40
|
+
|
|
41
|
+
Check for:
|
|
42
|
+
- Mixed types in one memory (fact + decision combined)
|
|
43
|
+
- Vague or generic content ("fixed a bug" → F)
|
|
44
|
+
- Missing source attribution
|
|
45
|
+
- Over-broad scope ("everything about auth")
|
|
46
|
+
|
|
47
|
+
**Grade:**
|
|
48
|
+
- A: 90%+ memories are single-concept, well-typed
|
|
49
|
+
- B: 75-89% clean
|
|
50
|
+
- C: 60-74% — noticeable clutter
|
|
51
|
+
- D: 40-59% — significant cleanup needed
|
|
52
|
+
- F: <40% — urgent restructuring required
|
|
53
|
+
|
|
54
|
+
### 2. Freshness (A-F)
|
|
55
|
+
**Question:** Are memories still current and relevant?
|
|
56
|
+
|
|
57
|
+
Check for:
|
|
58
|
+
- Expired memories (past TTL) still active
|
|
59
|
+
- Outdated decisions (superseded but not marked)
|
|
60
|
+
- Stale context (project state changed)
|
|
61
|
+
- Memories about deprecated features/APIs
|
|
62
|
+
|
|
63
|
+
**Grade based on:** % expired / stale vs total
|
|
64
|
+
|
|
65
|
+
### 3. Coverage (A-F)
|
|
66
|
+
**Question:** Are important areas of the project well-documented?
|
|
67
|
+
|
|
68
|
+
Check for:
|
|
69
|
+
- Core architecture decisions — present? complete?
|
|
70
|
+
- Recent bugs/fixes — all captured?
|
|
71
|
+
- Team preferences — documented?
|
|
72
|
+
- Onboarding knowledge — accessible?
|
|
73
|
+
|
|
74
|
+
**Grade based on:** Key areas vs documented areas ratio
|
|
75
|
+
|
|
76
|
+
### 4. Clarity (A-F)
|
|
77
|
+
**Question:** Can memories be understood without context?
|
|
78
|
+
|
|
79
|
+
Check for:
|
|
80
|
+
- Jargon without explanation ("the THING was fixed")
|
|
81
|
+
- Missing who/what/why ("updated it")
|
|
82
|
+
- Inconsistent terminology (same concept, multiple names)
|
|
83
|
+
- Vietnamese/English mixing without clear pattern
|
|
84
|
+
|
|
85
|
+
**Grade based on:** Avg clarity score across sampled memories
|
|
86
|
+
|
|
87
|
+
### 5. Relevance (A-F)
|
|
88
|
+
**Question:** Are memories being recalled and used?
|
|
89
|
+
|
|
90
|
+
Check for:
|
|
91
|
+
- Low-activation memories (never recalled in 30d)
|
|
92
|
+
- Duplicate memories competing for activation
|
|
93
|
+
- Orphaned memories (no synapse connections)
|
|
94
|
+
- Memories blocking relevant recall (noise)
|
|
95
|
+
|
|
96
|
+
**Grade based on:** Recall frequency + synapse connectivity
|
|
97
|
+
|
|
98
|
+
### 6. Structure (A-F)
|
|
99
|
+
**Question:** Is the synapse graph healthy?
|
|
100
|
+
|
|
101
|
+
Check for:
|
|
102
|
+
- Isolated neurons (no connections)
|
|
103
|
+
- Missing causal links (decisions without causes)
|
|
104
|
+
- Tag inconsistency (similar concepts, different tags)
|
|
105
|
+
- Temporal gaps (events without before/after links)
|
|
106
|
+
|
|
107
|
+
**Grade based on:** Graph connectivity metrics from nmem_stats
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Output Format
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
🔍 Memory Brain Audit — [date]
|
|
115
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
116
|
+
|
|
117
|
+
📊 Health Overview
|
|
118
|
+
Total memories: 127
|
|
119
|
+
Active (recalled 7d): 43 (34%)
|
|
120
|
+
Expired/stale: 12 (9%)
|
|
121
|
+
Orphaned neurons: 8 (6%)
|
|
122
|
+
|
|
123
|
+
📋 Dimension Grades
|
|
124
|
+
Purity: B (78%) — Some mixed-concept memories found
|
|
125
|
+
Freshness: A (92%) — Brain is current ✨
|
|
126
|
+
Coverage: C (61%) — Auth and deploy areas sparse
|
|
127
|
+
Clarity: B (80%) — Minor jargon issues
|
|
128
|
+
Relevance: B (75%) — 8 orphaned low-priority memories
|
|
129
|
+
Structure: C (65%) — Missing causal links in 15 decisions
|
|
130
|
+
|
|
131
|
+
Overall: B- (75%)
|
|
132
|
+
|
|
133
|
+
🔴 Critical Findings (fix now)
|
|
134
|
+
1. 3 expired `todo` memories still active — run /memory-evolution to prune
|
|
135
|
+
2. Auth architecture has no decision memories — document now
|
|
136
|
+
|
|
137
|
+
🟡 Moderate Findings (fix this week)
|
|
138
|
+
3. 8 orphaned memories — no synapse connections
|
|
139
|
+
4. "deployment" and "deploy" tags used inconsistently (15 memories)
|
|
140
|
+
|
|
141
|
+
🟢 Minor Findings (optional)
|
|
142
|
+
5. 5 memories could be split into smaller single-concept memories
|
|
143
|
+
6. 3 decisions missing "because Y" reasoning
|
|
144
|
+
|
|
145
|
+
💡 Recommended Next Step
|
|
146
|
+
Run: /memory-evolution "prune expired, fix auth coverage"
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Rules
|
|
152
|
+
|
|
153
|
+
- Always show the full 6-dimension breakdown
|
|
154
|
+
- Never modify memories during audit — report only
|
|
155
|
+
- Grade based on objective metrics when possible
|
|
156
|
+
- Prioritize by impact: Critical > Moderate > Minor
|
|
157
|
+
- End with one concrete "next step" recommendation
|